0

有我的代码(360是我的进程 ID):

        HANDLE process = Kernel32.INSTANCE.OpenProcess(0x0400 | 0x0010,
                false, 360);
        if (process != null) {
            int len = psapi.GetModuleFileNameExW(process, null, path,
                    1024);
            if (len > 0) {
                System.out.println(new String(path, 0, len));
            } else {
                System.out.println("GetModuleFileNameW failed");
            }
        } else {
            System.out.println(kernel32.GetLastError());
        }

路径返回“ ?”。我做错了什么?

4

1 回答 1

0

试试这个:

char path[] = new char[1024];    
HANDLE process = Kernel32.INSTANCE.OpenProcess(0x0400 | 0x0010, false, 396);
if (process != 0)
{
    int len = psapi.GetModuleFileNameExW(process, null, path, 1024);
    if (len > 0)    
        System.out.println(new String(path, 0, len));
    else
        System.out.println("GetModuleFileNameW failed");
}
else
    System.out.println("OpenProcess failed");
于 2013-10-26T21:04:34.103 回答