2

我正在尝试枚举在 Windows 中运行的所有进程,包括 32 位和 64 位,对于 64 位我需要调用 EnumProcessModulesEx,它在我正在使用的 Devc++ 的 psapi.h 中不可用,所以我下载了 Windows8 SDK。

所以现在我定义了 EnumProcessModulesEx 的 psapi.h,但是当我将它包含在我的项目中时,它给了我各种错误。我包含了包含 SDK 附带的所有头文件的目录的路径,我应该做什么?

这是错误列表:

    main.cpp:35: error: `K32EnumProcessModulesEx' cannot be used as a function
    main.cpp:63: error: `K32EnumProcessModulesEx' cannot be used as a function
    main.cpp:65: error: `K32GetModuleBaseNameA' cannot be used as a function

    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:89: warning: `__stdcall__' attribute only applies to function types
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:90: error: `cb' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:90: error: `_Out_writes_bytes_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:91: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:92: error: `_Out_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:93: error: initializer expression list treated as compound expression
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:97: warning: `__stdcall__' attribute only applies to function types
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:98: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:99: error: `cb' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:99: error: `_Out_writes_bytes_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:100: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:101: error: `_Out_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:102: error: initializer expression list treated as compound expression
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:106: warning: `__stdcall__' attribute only applies to function types
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:107: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:108: error: `cb' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:108: error: `_Out_writes_bytes_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:109: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:110: error: `_Out_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:111: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:112: error: initializer expression list treated as compound expression
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:116: warning: `__stdcall__' attribute only applies to function types
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:117: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:118: error: `_In_opt_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:119: error: `nSize' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:119: error: `_Out_writes_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:120: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:121: error: initializer expression list treated as compound expression
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:125: warning: `__stdcall__' attribute only applies to function types
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:126: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:127: error: `_In_opt_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:128: error: `nSize' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:128: error: `_Out_writes_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:129: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:130: error: initializer expression list treated as compound expression
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:139: error: expected constructor, destructor, or type conversion before '(' token
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:139: error: expected `,' or `;' before '(' token
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:152: error: expected constructor, destructor, or type conversion before '(' token
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:152: error: expected `,' or `;' before '(' token
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:181: warning: `__stdcall__' attribute only applies to function types
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:182: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:183: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:184: error: `_Out_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:185: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:186: error: initializer expression list treated as compound expression
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:191: warning: `__stdcall__' attribute only applies to function types
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:192: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:271: warning: `__stdcall__' attribute only applies to function types
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:272: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:273: error: `cb' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:273: error: `_Out_writes_bytes_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:274: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:275: error: initializer expression list treated as compound expression
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:279: warning: `__stdcall__' attribute only applies to function types
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:280: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:281: error: `cb' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:281: error: `_Out_writes_bytes_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:282: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:283: error: initializer expression list treated as compound expression
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:287: warning: `__stdcall__' attribute only applies to function types
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:288: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:304: warning: `__stdcall__' attribute only applies to function types
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:305: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:306: error: `cb' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:306: error: `_Out_writes_bytes_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:307: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:308: error: initializer expression list treated as compound expression
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:312: warning: `__stdcall__' attribute only applies to function types
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:313: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:314: error: `cb' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:314: error: `cb' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:314: error: `_Out_writes_bytes_to_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:315: error: `_Inout_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:316: error: initializer expression list treated as compound expression
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:320: warning: `__stdcall__' attribute only applies to function types
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:321: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:322: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:323: error: `nSize' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:323: error: `_Out_writes_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:324: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:325: error: initializer expression list treated as compound expression
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:329: warning: `__stdcall__' attribute only applies to function types
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:330: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:331: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:332: error: `nSize' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:332: error: `_Out_writes_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:333: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:334: error: initializer expression list treated as compound expression
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:344: warning: `__stdcall__' attribute only applies to function types
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:345: error: `cb' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:345: error: `_Out_writes_bytes_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:346: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:347: error: `_Out_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:348: error: initializer expression list treated as compound expression
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:353: warning: `__stdcall__' attribute only applies to function types
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:354: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:355: error: `nSize' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:355: error: `_Out_writes_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:356: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:357: error: initializer expression list treated as compound expression
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:361: warning: `__stdcall__' attribute only applies to function types
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:362: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:363: error: `nSize' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:363: error: `_Out_writes_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:364: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:365: error: initializer expression list treated as compound expression
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:376: warning: `__stdcall__' attribute only applies to function types
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:377: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:378: error: `nSize' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:378: error: `_Out_writes_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:379: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:380: error: initializer expression list treated as compound expression
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:384: warning: `__stdcall__' attribute only applies to function types
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:385: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:386: error: `nSize' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:386: error: `_Out_writes_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:387: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:388: error: initializer expression list treated as compound expression
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:499: warning: `__stdcall__' attribute only applies to function types
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:500: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:501: error: `nSize' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:501: error: `_Out_writes_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:502: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:503: error: initializer expression list treated as compound expression
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:507: warning: `__stdcall__' attribute only applies to function types
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:508: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:509: error: `nSize' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:509: error: `_Out_writes_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:510: error: `_In_' was not declared in this scope
    C:/Program Files (x86)/Windows Kits/8.0/Include/um/Psapi.h:511: error: initializer expression list treated as compound expression
4

0 回答 0