MCPcopy Index your code
hub / github.com/PowerShell/DSC / check_store

Function check_store

dsc/src/main.rs:170–197  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

168// Check if the dsc binary parent process is WinStore.App or Explorer.exe
169#[cfg(windows)]
170fn check_store() {
171 use std::io::Read;
172
173 let sys = System::new_with_specifics(RefreshKind::nothing().with_processes(ProcessRefreshKind::everything()));
174 // get current process
175 let Ok(current_pid) = get_current_pid() else {
176 return;
177 };
178
179 // get parent process
180 let Some(current_process) = sys.process(current_pid) else {
181 return;
182 };
183 let Some(parent_process_pid) = current_process.parent() else {
184 return;
185 };
186 let Some(parent_process) = sys.process(parent_process_pid) else {
187 return;
188 };
189
190 // MS Store runs app using `sihost.exe`
191 if parent_process.name().eq_ignore_ascii_case("sihost.exe") || parent_process.name().eq_ignore_ascii_case("explorer.exe") {
192 eprintln!("{}", t!("main.storeMessage"));
193 // wait for keypress
194 let _ = io::stdin().read(&mut [0u8]).unwrap();
195 exit(util::EXIT_INVALID_ARGS);
196 }
197}

Callers 1

mainFunction · 0.85

Calls 1

nameMethod · 0.45

Tested by

no test coverage detected