1

HKEY_LOCAL_MACHINE、 "SOFTWARE \ Microsoft \ Windows NT \ CurrentVersion \ Winlogon"、 "Shell"は、シェル名(通常はExplorer.exe)を返します。ただし、パスが含まれていないか、特定の実行可能ファイルを識別しません。

タスクリストを列挙すると、タスクExplorer.exeが見つかります。

しかし、ユーザーがExplorer.exeと呼ばれる別の無関係なタスクを実行した場合はどうなるでしょうか。

Explorer.exeの特定のインスタンスが実際にシェルであると判断するための最良の方法は何ですか?

シェルであるタスクと、シェルではないかもしれないが同じ名前、つまりExplorer.exeを共有するタスクとの間の混乱を避ける必要があります。

4

4 に答える 4

0

Process Explorerを使用して、プロセスの詳細を取得できます。各エクスプローラープロセスで実行されているプログラム、エクスプローラープロセスファイルの場所、およびその他のいくつかのことでわかります。

于 2010-06-18T18:43:07.470 に答える
0

たぶん、次のようにコマンドラインユーティリティのタスクリストを使用できます。

tasklist /FI "imagename eq explorer.exe" /FI "session eq 1" /FI "sessionname eq Console"
于 2010-06-18T18:50:32.527 に答える
0

Explorer.exe を探すのではなく、シェルのフル パスを探しますC:\Windows\Explorer.exe

于 2010-06-18T20:42:34.780 に答える
0

I don't think there is a foolproof method; the best you could do is emulate what CreateProcess does:

If the file name does not contain a directory path, the system searches for the executable file in the following sequence:

  1. The directory from which the application loaded.
  2. The current directory for the parent process.
  3. The 32-bit Windows system directory. Use the GetSystemDirectory function to get the path of this directory.
  4. The 16-bit Windows system directory. There is no function that obtains the path of this directory, but it is searched. The name of this directory is System.
  5. The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
  6. The directories that are listed in the PATH environment variable.
于 2010-06-18T20:50:51.313 に答える