From e7bf97583d1f2e3744474ec8fffac06f50a78338 Mon Sep 17 00:00:00 2001 From: Davide Beatrici Date: Mon, 1 Mar 2021 01:46:11 +0100 Subject: [PATCH] Mayaqua/Microsoft: Fix several warnings related to Windows data type mismatches Also, reported unused variables are removed. --- src/Mayaqua/Microsoft.c | 111 ++++++++++++++----------------- src/Mayaqua/Microsoft.h | 143 ++++++++++++++++++++-------------------- 2 files changed, 122 insertions(+), 132 deletions(-) diff --git a/src/Mayaqua/Microsoft.c b/src/Mayaqua/Microsoft.c index b4ad140a..a3592cdf 100644 --- a/src/Mayaqua/Microsoft.c +++ b/src/Mayaqua/Microsoft.c @@ -98,12 +98,10 @@ static SERVICE_FUNCTION *g_start, *g_stop; static bool exiting = false; static bool wnd_end; static bool is_usermode = false; -static bool wts_is_locked_flag = false; static HICON tray_icon; static NOTIFYICONDATA nid; static NOTIFYICONDATAW nid_nt; static bool service_for_9x_mode = false; -static THREAD *service_stopper_thread = NULL; static bool tray_inited = false; static HWND hWndUsermode = NULL; static HANDLE hLsa = NULL; @@ -535,7 +533,7 @@ void *MsGetCurrentModuleHandle() } // Resource enumeration procedure -bool CALLBACK MsEnumResourcesInternalProc(HMODULE hModule, const char *type, char *name, LONG_PTR lParam) +BOOL CALLBACK MsEnumResourcesInternalProc(HMODULE hModule, const char *type, char *name, LONG_PTR lParam) { LIST *o = (LIST *)lParam; // Validate arguments @@ -716,7 +714,7 @@ bool MsPerformMsChapV2AuthByLsa(char *username, UCHAR *challenge8, UCHAR *client DWORD sz; void *profile_buffer = NULL; LUID logon_id; - UINT profile_buffer_size = 0; + ULONG profile_buffer_size = 0; UINT i; HANDLE hLogon = NULL; QUOTA_LIMITS q; @@ -1226,7 +1224,7 @@ void MsUpdateSystem() UINT MsWaitProcessExit(void *process_handle) { HANDLE h = (HANDLE)process_handle; - UINT ret = 1; + DWORD ret = 1; if (h == NULL) { @@ -1463,7 +1461,7 @@ static wchar_t ms_computer_name_full_cache[MAX_SIZE] = {0}; // Get the full name of the computer void MsGetComputerNameFullEx(wchar_t *name, UINT size, bool with_cache) { - UINT size2 = size; + DWORD size2 = size; // Validate arguments UniStrCpy(name, size, L""); if (name == NULL || size == 0) @@ -1615,9 +1613,9 @@ void *MsRunAsUserExInnerW(wchar_t *filename, wchar_t *arg, bool hide) SID *MsGetSidFromAccountName(char *name) { SID *sid; - UINT sid_size = 4096; + DWORD sid_size = 4096; char *domain_name; - UINT domain_name_size = 4096; + DWORD domain_name_size = 4096; SID_NAME_USE use = SidTypeUser; // Validate arguments if (name == NULL) @@ -1660,9 +1658,8 @@ void MsFreeSid(SID *sid) // Create a token of standard user HANDLE MsCreateUserToken() { - char *medium_sid = "S-1-16-8192"; - char *administrators_sid = "S-1-5-32-544"; - SID *sid = NULL; + const char *medium_sid = "S-1-16-8192"; + PSID sid = NULL; TOKEN_MANDATORY_LABEL til; HANDLE hCurrentToken, hNewToken; if (MsIsNt() == false) @@ -1969,7 +1966,7 @@ bool MsIs64BitWindows() } else { - bool b = false; + BOOL b = false; if (ms->nt->IsWow64Process(GetCurrentProcess(), &b) == false) { return false; @@ -2096,7 +2093,7 @@ bool MsExecDriverInstaller(char *arg) wchar_t lang_config_src[MAX_PATH]; wchar_t lang_config_dst[MAX_PATH]; HANDLE h; - UINT retcode; + DWORD retcode; SHELLEXECUTEINFOW info; wchar_t *arg_w; // Validate arguments @@ -2477,8 +2474,8 @@ MS_ADAPTER *MsGetAdapter(char *title) void MsGetAdapterTcpIpInformation(MS_ADAPTER *a) { IP_ADAPTER_INFO *info, *info_top; - UINT info_size; - UINT ret; + ULONG info_size; + ULONG ret; // Validate arguments if (a == NULL) { @@ -2720,7 +2717,7 @@ MS_ADAPTER_LIST *MsCreateAdapterListInnerEx(bool no_info) UINT i; UINT retcode; MIB_IFTABLE *table; - UINT table_size = sizeof(MIB_IFTABLE); + ULONG table_size = sizeof(MIB_IFTABLE); MS_ADAPTER_LIST *ret; if (w32net->GetIfTable2 != NULL && w32net->FreeMibTable != NULL) @@ -2759,7 +2756,6 @@ MS_ADAPTER_LIST *MsCreateAdapterListInnerEx(bool no_info) { MIB_IFROW *r = &table->table[i]; char title[MAX_PATH]; - UINT num = 0; MS_ADAPTER *a; UINT j; @@ -2850,8 +2846,7 @@ MS_ADAPTER_LIST *MsCreateAdapterListInnerExVista(bool no_info) LIST *o; UINT i; UINT retcode; - MIB_IF_TABLE2 *table; - UINT table_size = sizeof(MIB_IFTABLE); + PMIB_IF_TABLE2 table; MS_ADAPTER_LIST *ret; if (w32net->GetIfTable2 == NULL || w32net->FreeMibTable == NULL) @@ -2859,7 +2854,7 @@ MS_ADAPTER_LIST *MsCreateAdapterListInnerExVista(bool no_info) return ZeroMalloc(sizeof(MS_ADAPTER_LIST)); } - retcode = w32net->GetIfTable2(&table); + retcode = w32net->GetIfTable2((void **)&table); if (retcode != NO_ERROR || table == NULL) { return ZeroMalloc(sizeof(MS_ADAPTER_LIST)); @@ -2871,7 +2866,6 @@ MS_ADAPTER_LIST *MsCreateAdapterListInnerExVista(bool no_info) { MIB_IF_ROW2 *r = &table->Table[i]; wchar_t title[MAX_PATH]; - UINT num = 0; MS_ADAPTER *a; UINT j; @@ -3349,7 +3343,8 @@ LIST *MsGetProcessListNt() LIST *o; UINT max = 16384; DWORD *processes; - UINT needed, num; + DWORD needed; + UINT num; UINT i; o = NewListFast(MsCompareProcessList); @@ -4427,7 +4422,7 @@ bool MsServiceStopProc() } // Service handler -void CALLBACK MsServiceHandler(UINT opcode) +void CALLBACK MsServiceHandler(DWORD opcode) { switch (opcode) { @@ -4451,7 +4446,7 @@ void CALLBACK MsServiceHandler(UINT opcode) } // Dispatch function of the service -void CALLBACK MsServiceDispatcher(UINT argc, LPTSTR *argv) +void CALLBACK MsServiceDispatcher(DWORD argc, LPTSTR *argv) { // Creating a stopping event service_stop_event = CreateEventA(NULL, true, false, NULL); @@ -5281,7 +5276,7 @@ wchar_t *MsGetSessionUserName(UINT session_id) { wchar_t *ret; wchar_t *name; - UINT size = 0; + DWORD size = 0; if (ms->nt->WTSQuerySessionInformation(WTS_CURRENT_SERVER_HANDLE, session_id, WTSUserName, (wchar_t *)&name, &size) == false) { @@ -5316,7 +5311,7 @@ bool MsIsTerminalSessionActive(UINT session_id) if (MsIsTerminalServiceInstalled() || MsIsUserSwitchingInstalled()) { UINT *status = NULL; - UINT size = sizeof(status); + DWORD size = sizeof(status); bool active = true; if (ms->nt->WTSQuerySessionInformation(WTS_CURRENT_SERVER_HANDLE, session_id, @@ -5351,7 +5346,7 @@ UINT MsGetCurrentTerminalSessionId() { UINT ret; UINT *session_id = NULL; - UINT size = sizeof(session_id); + DWORD size = sizeof(session_id); if (ms->nt->WTSQuerySessionInformation(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, WTSSessionId, (wchar_t *)&session_id, &size) == false) { @@ -6512,7 +6507,7 @@ bool MsInstallVLan9x(char *instance_name, MS_DRIVER_VER *ver) } // Child window enumeration procedure -bool CALLBACK MsEnumChildWindowProc(HWND hWnd, LPARAM lParam) +BOOL CALLBACK MsEnumChildWindowProc(HWND hWnd, LPARAM lParam) { LIST *o = (LIST *)lParam; @@ -6561,7 +6556,7 @@ void MsAddWindowToList(LIST *o, HWND hWnd) } // Enumeration of the window that the thread owns -bool CALLBACK MsEnumThreadWindowProc(HWND hWnd, LPARAM lParam) +BOOL CALLBACK MsEnumThreadWindowProc(HWND hWnd, LPARAM lParam) { LIST *o = (LIST *)lParam; @@ -6986,8 +6981,6 @@ bool MsCloseWarningWindow(NO_WARNING *nw, UINT thread_id) if (hWnd != NULL) { - OS_INFO *info = GetOsInfo(); - if (MsIsNt()) { // Get whether this window is a warning screen of driver @@ -7592,7 +7585,7 @@ void MsTest() // Install a virtual LAN card (by calling Win32 API) bool MsInstallVLanInternal(wchar_t *infpath, wchar_t *hwid_w, char *hwid) { - bool need_reboot; + BOOL need_reboot; bool ret = false; wchar_t inf_class_name[MAX_PATH]; GUID inf_class_guid; @@ -7776,7 +7769,7 @@ HDEVINFO MsGetDevInfoFromDeviceId(SP_DEVINFO_DATA *dev_info_data, char *device_i bool MsIsDeviceRunning(HDEVINFO info, SP_DEVINFO_DATA *dev_info_data) { SP_DEVINFO_LIST_DETAIL_DATA detail; - UINT status = 0, problem = 0; + DWORD status = 0, problem = 0; // Validate arguments if (info == NULL || dev_info_data == NULL) { @@ -8886,9 +8879,7 @@ void MsNormalizeInterfaceDefaultGatewaySettings(char *tag_name, char *instance_n { char *s = LIST_DATA(o, i); char tmp[MAX_SIZE]; - - char *cm = NULL; - UINT current_metric; + UINT current_metric = 0; if (o2 != NULL) { @@ -10158,7 +10149,7 @@ NT_API *MsLoadNtApiFunctions() GetProcAddress(nt->hAdvapi32, "LookupAccountNameA"); nt->SetNamedSecurityInfoW = - (DWORD (__stdcall *)(LPWSTR,UINT,SECURITY_INFORMATION,PSID,PSID,PACL,PACL)) + (DWORD (__stdcall *)(LPWSTR,DWORD,SECURITY_INFORMATION,PSID,PSID,PACL,PACL)) GetProcAddress(nt->hAdvapi32, "SetNamedSecurityInfoW"); nt->AddAccessAllowedAceEx = @@ -10184,15 +10175,15 @@ NT_API *MsLoadNtApiFunctions() if (info.dwMajorVersion >= 5) { nt->UpdateDriverForPlugAndPlayDevicesW = - (BOOL (__stdcall *)(HWND,wchar_t *,wchar_t *,UINT,BOOL *)) + (BOOL (__stdcall *)(HWND,LPCWSTR,LPCWSTR,DWORD,PBOOL)) GetProcAddress(nt->hNewDev, "UpdateDriverForPlugAndPlayDevicesW"); nt->CM_Get_Device_ID_ExA = - (UINT (__stdcall *)(DWORD,char *,UINT,UINT,HANDLE)) + (DWORD (__stdcall *)(DWORD,LPSTR,ULONG,ULONG,HANDLE)) GetProcAddress(nt->hSetupApi, "CM_Get_Device_ID_ExA"); nt->CM_Get_DevNode_Status_Ex = - (UINT (__stdcall *)(UINT *,UINT *,DWORD,UINT,HANDLE)) + (DWORD (__stdcall *)(PULONG,PULONG,DWORD,ULONG,HANDLE)) GetProcAddress(nt->hSetupApi, "CM_Get_DevNode_Status_Ex"); } @@ -10201,7 +10192,7 @@ NT_API *MsLoadNtApiFunctions() { // Terminal Services related API nt->WTSQuerySessionInformation = - (UINT (__stdcall *)(HANDLE,DWORD,WTS_INFO_CLASS,wchar_t *,DWORD *)) + (BOOL (__stdcall *)(HANDLE,DWORD,WTS_INFO_CLASS,wchar_t *,DWORD *)) GetProcAddress(nt->hWtsApi32, "WTSQuerySessionInformationW"); nt->WTSFreeMemory = (void (__stdcall *)(void *)) @@ -10491,7 +10482,7 @@ bool MsIsAeroColor() // Get whether Aero is enabled bool MsIsAeroEnabled() { - bool ret; + BOOL ret; if (MsIsNt() == false) { return false; @@ -10691,7 +10682,7 @@ TOKEN_LIST *MsRegEnumValueEx2(UINT root, char *keyname, bool force32bit, bool fo { char tmp[MAX_SIZE]; UINT ret; - UINT size = sizeof(tmp); + DWORD size = sizeof(tmp); Zero(tmp, sizeof(tmp)); ret = RegEnumValue(h, i, tmp, &size, NULL, NULL, NULL, NULL); @@ -10761,7 +10752,7 @@ TOKEN_LIST *MsRegEnumKeyEx2(UINT root, char *keyname, bool force32bit, bool forc { char tmp[MAX_SIZE]; UINT ret; - UINT size = sizeof(tmp); + DWORD size = sizeof(tmp); FILETIME ft; Zero(tmp, sizeof(tmp)); @@ -11022,7 +11013,7 @@ BUF *MsRegReadBinEx(UINT root, char *keyname, char *valuename, bool force32bit) BUF *MsRegReadBinEx2(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit) { char *ret; - UINT type, size; + DWORD type, size; BUF *b; // Validate arguments if (keyname == NULL || valuename == NULL) @@ -11031,7 +11022,7 @@ BUF *MsRegReadBinEx2(UINT root, char *keyname, char *valuename, bool force32bit, } // Read the value - if (MsRegReadValueEx2(root, keyname, valuename, &ret, &type, &size, force32bit, force64bit) == false) + if (MsRegReadValueEx2(root, keyname, valuename, (void **)&ret, &type, &size, force32bit, force64bit) == false) { return 0; } @@ -11058,7 +11049,7 @@ UINT MsRegReadIntEx(UINT root, char *keyname, char *valuename, bool force32bit) UINT MsRegReadIntEx2(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit) { char *ret; - UINT type, size; + DWORD type, size; UINT value; // Validate arguments if (keyname == NULL || valuename == NULL) @@ -11067,7 +11058,7 @@ UINT MsRegReadIntEx2(UINT root, char *keyname, char *valuename, bool force32bit, } // Read the value - if (MsRegReadValueEx2(root, keyname, valuename, &ret, &type, &size, force32bit, force64bit) == false) + if (MsRegReadValueEx2(root, keyname, valuename, (void **)&ret, &type, &size, force32bit, force64bit) == false) { return 0; } @@ -11127,7 +11118,7 @@ LIST *MsRegReadStrListEx2(UINT root, char *keyname, char *valuename, bool force3 { LIST *o; char *ret; - UINT type, size; + DWORD type, size; // Validate arguments if (keyname == NULL || valuename == NULL) { @@ -11135,7 +11126,7 @@ LIST *MsRegReadStrListEx2(UINT root, char *keyname, char *valuename, bool force3 } // Read the value - if (MsRegReadValueEx2(root, keyname, valuename, &ret, &type, &size, force32bit, force64bit) == false) + if (MsRegReadValueEx2(root, keyname, valuename, (void **)&ret, &type, &size, force32bit, force64bit) == false) { return NULL; } @@ -11182,7 +11173,7 @@ char *MsRegReadStrEx(UINT root, char *keyname, char *valuename, bool force32bit) char *MsRegReadStrEx2(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit) { char *ret; - UINT type, size; + DWORD type, size; // Validate arguments if (keyname == NULL || valuename == NULL) { @@ -11190,7 +11181,7 @@ char *MsRegReadStrEx2(UINT root, char *keyname, char *valuename, bool force32bit } // Read the value - if (MsRegReadValueEx2(root, keyname, valuename, &ret, &type, &size, force32bit, force64bit) == false) + if (MsRegReadValueEx2(root, keyname, valuename, (void **)&ret, &type, &size, force32bit, force64bit) == false) { return NULL; } @@ -11246,7 +11237,7 @@ wchar_t *MsRegReadStrExW(UINT root, char *keyname, char *valuename, bool force32 wchar_t *MsRegReadStrEx2W(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit) { wchar_t *ret; - UINT type, size; + DWORD type, size; // Validate arguments if (keyname == NULL || valuename == NULL) { @@ -11254,7 +11245,7 @@ wchar_t *MsRegReadStrEx2W(UINT root, char *keyname, char *valuename, bool force3 } // Read the value - if (MsRegReadValueEx2W(root, keyname, valuename, &ret, &type, &size, force32bit, force64bit) == false) + if (MsRegReadValueEx2W(root, keyname, valuename, (void **)&ret, &type, &size, force32bit, force64bit) == false) { return NULL; } @@ -11279,7 +11270,7 @@ wchar_t *MsRegReadStrEx2W(UINT root, char *keyname, char *valuename, bool force3 } // Read the value -bool MsRegReadValueEx2(UINT root, char *keyname, char *valuename, void **data, UINT *type, UINT *size, bool force32bit, bool force64bit) +bool MsRegReadValueEx2(UINT root, char *keyname, char *valuename, void **data, DWORD *type, DWORD *size, bool force32bit, bool force64bit) { HKEY h; UINT ret; @@ -11332,7 +11323,7 @@ bool MsRegReadValueEx2(UINT root, char *keyname, char *valuename, void **data, U return true; } -bool MsRegReadValueEx2W(UINT root, char *keyname, char *valuename, void **data, UINT *type, UINT *size, bool force32bit, bool force64bit) +bool MsRegReadValueEx2W(UINT root, char *keyname, char *valuename, void **data, DWORD *type, DWORD *size, bool force32bit, bool force64bit) { HKEY h; UINT ret; @@ -11349,7 +11340,7 @@ bool MsRegReadValueEx2W(UINT root, char *keyname, char *valuename, void **data, { bool ret; void *data_a = NULL; - UINT type_a = 0, size_a = 0; + DWORD type_a = 0, size_a = 0; ret = MsRegReadValueEx2(root, keyname, valuename, &data_a, &type_a, &size_a, force32bit, force64bit); @@ -11435,7 +11426,7 @@ bool MsRegIsValueEx(UINT root, char *keyname, char *valuename, bool force32bit) bool MsRegIsValueEx2(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit) { HKEY h; - UINT type, size; + DWORD type, size; UINT ret; // Validate arguments if (keyname == NULL) @@ -11969,7 +11960,7 @@ void MsInit() wchar_t *str_unicode; OSVERSIONINFO os; char tmp[MAX_SIZE]; - UINT size; + DWORD size; if (ms != NULL) { // Already initialized @@ -12269,7 +12260,7 @@ bool MsGetMsiInstalledDir(char *component_code, wchar_t *dir, UINT dir_size) wchar_t *component_code_w; bool ret = false; wchar_t tmp[MAX_SIZE]; - UINT sz = sizeof(tmp) / sizeof(wchar_t); + DWORD sz = sizeof(tmp) / sizeof(wchar_t); // Validate arguments if (component_code == NULL || dir == NULL) { diff --git a/src/Mayaqua/Microsoft.h b/src/Mayaqua/Microsoft.h index 29512a4f..17ff0a13 100644 --- a/src/Mayaqua/Microsoft.h +++ b/src/Mayaqua/Microsoft.h @@ -11,13 +11,13 @@ #ifndef _WINDEF_ typedef void *HWND; +typedef unsigned long DWORD; #endif // _WINDEF_ #ifndef MICROSOFT_H #define MICROSOFT_H - // Constant for Event log #define MS_EVENTLOG_TYPE_INFORMATION 0 #define MS_EVENTLOG_TYPE_WARNING 1 @@ -158,33 +158,32 @@ typedef struct NETWORK_WIN32_FUNCTIONS { HINSTANCE hIpHlpApi32; HINSTANCE hIcmp; - UINT (WINAPI *DeleteIpForwardEntry)(PMIB_IPFORWARDROW); - UINT (WINAPI *CreateIpForwardEntry)(PMIB_IPFORWARDROW); - UINT (WINAPI *GetIpForwardTable)(PMIB_IPFORWARDTABLE, PULONG, BOOL); - UINT (WINAPI *GetNetworkParams)(PFIXED_INFO, PULONG); + DWORD (WINAPI *DeleteIpForwardEntry)(PMIB_IPFORWARDROW); + DWORD (WINAPI *CreateIpForwardEntry)(PMIB_IPFORWARDROW); + DWORD (WINAPI *GetIpForwardTable)(PMIB_IPFORWARDTABLE, PULONG, BOOL); + DWORD (WINAPI *GetNetworkParams)(PFIXED_INFO, PULONG); ULONG (WINAPI *GetAdaptersAddresses)(ULONG, ULONG, PVOID, PIP_ADAPTER_ADDRESSES, PULONG); - UINT (WINAPI *GetIfTable)(PMIB_IFTABLE, PULONG, BOOL); - UINT (WINAPI *GetIfTable2)(void **); + DWORD (WINAPI *GetIfTable)(PMIB_IFTABLE, PULONG, BOOL); + DWORD (WINAPI *GetIfTable2)(void **); void (WINAPI *FreeMibTable)(PVOID); - UINT (WINAPI *IpRenewAddress)(PIP_ADAPTER_INDEX_MAP); - UINT (WINAPI *IpReleaseAddress)(PIP_ADAPTER_INDEX_MAP); - UINT (WINAPI *GetInterfaceInfo)(PIP_INTERFACE_INFO, PULONG); - UINT (WINAPI *GetAdaptersInfo)(PIP_ADAPTER_INFO, PULONG); - UINT (WINAPI *GetExtendedTcpTable)(PVOID, PUINT, BOOL, ULONG, _TCP_TABLE_CLASS, ULONG); - UINT (WINAPI *AllocateAndGetTcpExTableFromStack)(PVOID *, BOOL, HANDLE, UINT, UINT); - UINT (WINAPI *GetTcpTable)(PMIB_TCPTABLE, PUINT, BOOL); - UINT (WINAPI *NotifyRouteChange)(PHANDLE, LPOVERLAPPED); + DWORD (WINAPI *IpRenewAddress)(PIP_ADAPTER_INDEX_MAP); + DWORD (WINAPI *IpReleaseAddress)(PIP_ADAPTER_INDEX_MAP); + DWORD (WINAPI *GetInterfaceInfo)(PIP_INTERFACE_INFO, PULONG); + DWORD (WINAPI *GetAdaptersInfo)(PIP_ADAPTER_INFO, PULONG); + DWORD (WINAPI *GetExtendedTcpTable)(PVOID, PDWORD, BOOL, ULONG, _TCP_TABLE_CLASS, ULONG); + DWORD (WINAPI *AllocateAndGetTcpExTableFromStack)(PVOID *, BOOL, HANDLE, DWORD, DWORD); + DWORD (WINAPI *GetTcpTable)(PMIB_TCPTABLE, PULONG, BOOL); + DWORD (WINAPI *NotifyRouteChange)(PHANDLE, LPOVERLAPPED); BOOL (WINAPI *CancelIPChangeNotify)(LPOVERLAPPED); - UINT (WINAPI *NhpAllocateAndGetInterfaceInfoFromStack)(IP_INTERFACE_NAME_INFO **, - PUINT, BOOL, HANDLE, UINT); + DWORD (WINAPI *NhpAllocateAndGetInterfaceInfoFromStack)(IP_INTERFACE_NAME_INFO **, + PDWORD, BOOL, HANDLE, DWORD); HANDLE (WINAPI *IcmpCreateFile)(); BOOL (WINAPI *IcmpCloseHandle)(HANDLE); - UINT (WINAPI *IcmpSendEcho)(HANDLE, IPAddr, LPVOID, WORD, PIP_OPTION_INFORMATION, - LPVOID, UINT, UINT); + DWORD (WINAPI *IcmpSendEcho)(HANDLE, IPAddr, LPVOID, WORD, PIP_OPTION_INFORMATION, + LPVOID, DWORD, DWORD); } NETWORK_WIN32_FUNCTIONS; #endif - #ifdef MICROSOFT_C // WCM related code on Windows 8 typedef enum _MS_WCM_PROPERTY @@ -310,68 +309,68 @@ typedef struct NT_API HINSTANCE hDbgHelp; HINSTANCE hWcmapi; HINSTANCE hDwmapi; - BOOL (WINAPI *OpenProcessToken)(HANDLE, UINT, PHANDLE); + BOOL (WINAPI *OpenProcessToken)(HANDLE, DWORD, PHANDLE); BOOL (WINAPI *LookupPrivilegeValue)(char *, char *, PLUID); - BOOL (WINAPI *AdjustTokenPrivileges)(HANDLE, BOOL, PTOKEN_PRIVILEGES, UINT, PTOKEN_PRIVILEGES, PUINT); - BOOL (WINAPI *InitiateSystemShutdown)(LPTSTR, LPTSTR, UINT, BOOL, BOOL); - BOOL (WINAPI *LogonUserW)(wchar_t *, wchar_t *, wchar_t *, UINT, UINT, HANDLE *); - BOOL (WINAPI *LogonUserA)(char *, char *, char *, UINT, UINT, HANDLE *); - BOOL (WINAPI *UpdateDriverForPlugAndPlayDevicesW)(HWND hWnd, wchar_t *hardware_id, wchar_t *inf_path, UINT flag, BOOL *need_reboot); - UINT (WINAPI *CM_Get_DevNode_Status_Ex)(UINT *, UINT *, UINT, UINT, HANDLE); - UINT (WINAPI *CM_Get_Device_ID_ExA)(UINT, char *, UINT, UINT, HANDLE); - UINT (WINAPI *WTSQuerySessionInformation)(HANDLE, UINT, WTS_INFO_CLASS, wchar_t *, UINT *); + BOOL (WINAPI *AdjustTokenPrivileges)(HANDLE, BOOL, PTOKEN_PRIVILEGES, DWORD, PTOKEN_PRIVILEGES, PDWORD); + BOOL (WINAPI *InitiateSystemShutdown)(LPTSTR, LPTSTR, DWORD, BOOL, BOOL); + BOOL (WINAPI *LogonUserW)(wchar_t *, wchar_t *, wchar_t *, DWORD, DWORD, HANDLE *); + BOOL (WINAPI *LogonUserA)(char *, char *, char *, DWORD, DWORD, HANDLE *); + BOOL (WINAPI *UpdateDriverForPlugAndPlayDevicesW)(HWND hWnd, LPCWSTR hardware_id, LPCWSTR inf_path, DWORD flag, PBOOL need_reboot); + DWORD (WINAPI *CM_Get_DevNode_Status_Ex)(PULONG, PULONG, DWORD, ULONG, HANDLE); + DWORD (WINAPI *CM_Get_Device_ID_ExA)(DWORD, LPSTR, ULONG, ULONG, HANDLE); + BOOL (WINAPI *WTSQuerySessionInformation)(HANDLE, DWORD, WTS_INFO_CLASS, wchar_t *, DWORD *); void (WINAPI *WTSFreeMemory)(void *); - BOOL (WINAPI *WTSDisconnectSession)(HANDLE, UINT, BOOL); - BOOL (WINAPI *WTSEnumerateSessions)(HANDLE, UINT, UINT, PWTS_SESSION_INFO *, UINT *); - BOOL (WINAPI *WTSRegisterSessionNotification)(HWND, UINT); + BOOL (WINAPI *WTSDisconnectSession)(HANDLE, DWORD, BOOL); + BOOL (WINAPI *WTSEnumerateSessions)(HANDLE, DWORD, DWORD, PWTS_SESSION_INFO *, DWORD *); + BOOL (WINAPI *WTSRegisterSessionNotification)(HWND, DWORD); BOOL (WINAPI *WTSUnRegisterSessionNotification)(HWND); - SC_HANDLE (WINAPI *OpenSCManager)(LPCTSTR, LPCTSTR, UINT); - SC_HANDLE (WINAPI *CreateServiceA)(SC_HANDLE, LPCTSTR, LPCTSTR, UINT, UINT, UINT, UINT, LPCTSTR, LPCTSTR, LPUINT, LPCTSTR, LPCTSTR, LPCTSTR); - SC_HANDLE (WINAPI *CreateServiceW)(SC_HANDLE, LPCWSTR, LPCWSTR, UINT, UINT, UINT, UINT, LPCWSTR, LPCWSTR, LPUINT, LPCWSTR, LPCWSTR, LPCWSTR); - BOOL (WINAPI *ChangeServiceConfig2)(SC_HANDLE, UINT, LPVOID); + SC_HANDLE (WINAPI *OpenSCManager)(LPCTSTR, LPCTSTR, DWORD); + SC_HANDLE (WINAPI *CreateServiceA)(SC_HANDLE, LPCTSTR, LPCTSTR, DWORD, DWORD, DWORD, DWORD, LPCTSTR, LPCTSTR, LPDWORD, LPCTSTR, LPCTSTR, LPCTSTR); + SC_HANDLE (WINAPI *CreateServiceW)(SC_HANDLE, LPCWSTR, LPCWSTR, DWORD, DWORD, DWORD, DWORD, LPCWSTR, LPCWSTR, LPDWORD, LPCWSTR, LPCWSTR, LPCWSTR); + BOOL (WINAPI *ChangeServiceConfig2)(SC_HANDLE, DWORD, LPVOID); BOOL (WINAPI *CloseServiceHandle)(SC_HANDLE); - SC_HANDLE (WINAPI *OpenService)(SC_HANDLE, LPCTSTR, UINT); + SC_HANDLE (WINAPI *OpenService)(SC_HANDLE, LPCTSTR, DWORD); BOOL (WINAPI *QueryServiceStatus)(SC_HANDLE, LPSERVICE_STATUS); - BOOL (WINAPI *StartService)(SC_HANDLE, UINT, LPCTSTR); - BOOL (WINAPI *ControlService)(SC_HANDLE, UINT, LPSERVICE_STATUS); + BOOL (WINAPI *StartService)(SC_HANDLE, DWORD, LPCTSTR); + BOOL (WINAPI *ControlService)(SC_HANDLE, DWORD, LPSERVICE_STATUS); BOOL (WINAPI *SetServiceStatus)(SERVICE_STATUS_HANDLE, LPSERVICE_STATUS); SERVICE_STATUS_HANDLE (WINAPI *RegisterServiceCtrlHandler)(LPCTSTR, LPHANDLER_FUNCTION); BOOL (WINAPI *StartServiceCtrlDispatcher)(CONST LPSERVICE_TABLE_ENTRY); BOOL (WINAPI *DeleteService)(SC_HANDLE); - BOOL (WINAPI *EnumProcesses)(UINT *, UINT, UINT *); - BOOL (WINAPI *EnumProcessModules)(HANDLE, HMODULE *, UINT, UINT *); - UINT (WINAPI *GetModuleFileNameExA)(HANDLE, HMODULE, LPSTR, UINT); - UINT (WINAPI *GetModuleFileNameExW)(HANDLE, HMODULE, LPWSTR, UINT); - UINT (WINAPI *GetProcessImageFileNameA)(HANDLE, LPSTR, UINT); - UINT (WINAPI *GetProcessImageFileNameW)(HANDLE, LPWSTR, UINT); - BOOL (WINAPI *QueryFullProcessImageNameA)(HANDLE, UINT, LPSTR, PUINT); - BOOL (WINAPI *QueryFullProcessImageNameW)(HANDLE, UINT, LPWSTR, PUINT); - LONG (WINAPI *RegDeleteKeyExA)(HKEY, LPCTSTR, REGSAM, UINT); + BOOL (WINAPI *EnumProcesses)(DWORD *, DWORD, DWORD *); + BOOL (WINAPI *EnumProcessModules)(HANDLE, HMODULE *, DWORD, DWORD *); + DWORD (WINAPI *GetModuleFileNameExA)(HANDLE, HMODULE, LPSTR, DWORD); + DWORD (WINAPI *GetModuleFileNameExW)(HANDLE, HMODULE, LPWSTR, DWORD); + DWORD (WINAPI *GetProcessImageFileNameA)(HANDLE, LPSTR, DWORD); + DWORD (WINAPI *GetProcessImageFileNameW)(HANDLE, LPWSTR, DWORD); + BOOL (WINAPI *QueryFullProcessImageNameA)(HANDLE, DWORD, LPSTR, PDWORD); + BOOL (WINAPI *QueryFullProcessImageNameW)(HANDLE, DWORD, LPWSTR, PDWORD); + LONG (WINAPI *RegDeleteKeyExA)(HKEY, LPCTSTR, REGSAM, DWORD); BOOL (WINAPI *IsWow64Process)(HANDLE, BOOL *); void (WINAPI *GetNativeSystemInfo)(SYSTEM_INFO *); - BOOL (WINAPI *DuplicateTokenEx)(HANDLE, UINT, SECURITY_ATTRIBUTES *, SECURITY_IMPERSONATION_LEVEL, TOKEN_TYPE, HANDLE *); + BOOL (WINAPI *DuplicateTokenEx)(HANDLE, DWORD, SECURITY_ATTRIBUTES *, SECURITY_IMPERSONATION_LEVEL, TOKEN_TYPE, HANDLE *); BOOL (WINAPI *ConvertStringSidToSidA)(LPCSTR, PSID *); - BOOL (WINAPI *SetTokenInformation)(HANDLE, TOKEN_INFORMATION_CLASS, void *, UINT); - BOOL (WINAPI *GetTokenInformation)(HANDLE, TOKEN_INFORMATION_CLASS, void *, UINT, PUINT); - BOOL (WINAPI *CreateProcessAsUserA)(HANDLE, LPCSTR, LPSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, UINT, void *, LPCSTR, LPSTARTUPINFOA, LPPROCESS_INFORMATION); - BOOL (WINAPI *CreateProcessAsUserW)(HANDLE, LPCWSTR, LPWSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, UINT, void *, LPCWSTR, LPSTARTUPINFOW, LPPROCESS_INFORMATION); - BOOL (WINAPI *LookupAccountSidA)(LPCSTR,PSID,LPSTR,LPUINT,LPSTR,LPUINT,PSID_NAME_USE); - BOOL (WINAPI *LookupAccountNameA)(LPCSTR,LPCSTR,PSID,LPUINT,LPSTR,LPUINT,PSID_NAME_USE); + BOOL (WINAPI *SetTokenInformation)(HANDLE, TOKEN_INFORMATION_CLASS, void *, DWORD); + BOOL (WINAPI *GetTokenInformation)(HANDLE, TOKEN_INFORMATION_CLASS, void *, DWORD, PDWORD); + BOOL (WINAPI *CreateProcessAsUserA)(HANDLE, LPCSTR, LPSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, DWORD, void *, LPCSTR, LPSTARTUPINFOA, LPPROCESS_INFORMATION); + BOOL (WINAPI *CreateProcessAsUserW)(HANDLE, LPCWSTR, LPWSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, DWORD, void *, LPCWSTR, LPSTARTUPINFOW, LPPROCESS_INFORMATION); + BOOL (WINAPI *LookupAccountSidA)(LPCSTR,PSID,LPSTR,LPDWORD,LPSTR,LPDWORD,PSID_NAME_USE); + BOOL (WINAPI *LookupAccountNameA)(LPCSTR,LPCSTR,PSID,LPDWORD,LPSTR,LPDWORD,PSID_NAME_USE); BOOL (WINAPI *GetUserNameExA)(EXTENDED_NAME_FORMAT, LPSTR, PULONG); BOOL (WINAPI *GetUserNameExW)(EXTENDED_NAME_FORMAT, LPWSTR, PULONG); BOOL (WINAPI *SwitchDesktop)(HDESK); - HDESK (WINAPI *OpenDesktopA)(LPTSTR, UINT, BOOL, ACCESS_MASK); + HDESK (WINAPI *OpenDesktopA)(LPTSTR, DWORD, BOOL, ACCESS_MASK); BOOL (WINAPI *CloseDesktop)(HDESK); - BOOL (WINAPI *SetProcessShutdownParameters)(UINT, UINT); + BOOL (WINAPI *SetProcessShutdownParameters)(DWORD, DWORD); HANDLE (WINAPI *RegisterEventSourceW)(LPCWSTR, LPCWSTR); - BOOL (WINAPI *ReportEventW)(HANDLE, WORD, WORD, UINT, PSID, WORD, UINT, LPCWSTR *, LPVOID); + BOOL (WINAPI *ReportEventW)(HANDLE, WORD, WORD, DWORD, PSID, WORD, DWORD, LPCWSTR *, LPVOID); BOOL (WINAPI *DeregisterEventSource)(HANDLE); BOOL (WINAPI *Wow64DisableWow64FsRedirection)(void **); BOOLEAN (WINAPI *Wow64EnableWow64FsRedirection)(BOOLEAN); BOOL (WINAPI *Wow64RevertWow64FsRedirection)(void *); BOOL (WINAPI *GetFileInformationByHandle)(HANDLE, LPBY_HANDLE_FILE_INFORMATION); HANDLE (WINAPI *GetProcessHeap)(); - BOOL (WINAPI *MiniDumpWriteDump)(HANDLE, UINT, HANDLE, MINIDUMP_TYPE, + BOOL (WINAPI *MiniDumpWriteDump)(HANDLE, DWORD, HANDLE, MINIDUMP_TYPE, PMINIDUMP_EXCEPTION_INFORMATION, PMINIDUMP_USER_STREAM_INFORMATION, PMINIDUMP_CALLBACK_INFORMATION); BOOL (WINAPI *AllocateLocallyUniqueId)(PLUID); @@ -382,14 +381,14 @@ typedef struct NT_API PQUOTA_LIMITS, PNTSTATUS); NTSTATUS (NTAPI *LsaDeregisterLogonProcess)(HANDLE); NTSTATUS (NTAPI *LsaFreeReturnBuffer)(PVOID); - UINT (WINAPI *WcmQueryProperty)(const GUID *, LPCWSTR, MS_WCM_PROPERTY, PVOID, PUINT, PBYTE *); - UINT (WINAPI *WcmSetProperty)(const GUID *, LPCWSTR, MS_WCM_PROPERTY, PVOID, UINT, const BYTE *); + DWORD (WINAPI *WcmQueryProperty)(const GUID *, LPCWSTR, MS_WCM_PROPERTY, PVOID, PDWORD, PBYTE *); + DWORD (WINAPI *WcmSetProperty)(const GUID *, LPCWSTR, MS_WCM_PROPERTY, PVOID, DWORD, const BYTE *); void (WINAPI *WcmFreeMemory)(PVOID); - UINT (WINAPI *WcmGetProfileList)(PVOID, MS_WCM_PROFILE_INFO_LIST **ppProfileList); - UINT (WINAPI *SetNamedSecurityInfoW)(LPWSTR, UINT, SECURITY_INFORMATION, PSID, PSID, PACL, PACL); - BOOL (WINAPI *AddAccessAllowedAceEx)(PACL, UINT, UINT, UINT, PSID); + DWORD (WINAPI *WcmGetProfileList)(PVOID, MS_WCM_PROFILE_INFO_LIST **ppProfileList); + DWORD (WINAPI *SetNamedSecurityInfoW)(LPWSTR, DWORD, SECURITY_INFORMATION, PSID, PSID, PACL, PACL); + BOOL (WINAPI *AddAccessAllowedAceEx)(PACL, DWORD, DWORD, DWORD, PSID); HRESULT (WINAPI *DwmIsCompositionEnabled)(BOOL *); - BOOL (WINAPI *GetComputerNameExW)(COMPUTER_NAME_FORMAT, LPWSTR, LPUINT); + BOOL (WINAPI *GetComputerNameExW)(COMPUTER_NAME_FORMAT, LPWSTR, LPDWORD); LONG (WINAPI *RegLoadKeyW)(HKEY, LPCWSTR, LPCWSTR); LONG (WINAPI *RegUnLoadKeyW)(HKEY, LPCWSTR); } NT_API; @@ -551,8 +550,8 @@ bool MsRegIsValue(UINT root, char *keyname, char *valuename); bool MsRegIsValueEx(UINT root, char *keyname, char *valuename, bool force32bit); bool MsRegIsValueEx2(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit); -bool MsRegReadValueEx2(UINT root, char *keyname, char *valuename, void **data, UINT *type, UINT *size, bool force32bit, bool force64bit); -bool MsRegReadValueEx2W(UINT root, char *keyname, char *valuename, void **data, UINT *type, UINT *size, bool force32bit, bool force64bit); +bool MsRegReadValueEx2(UINT root, char *keyname, char *valuename, void **data, DWORD *type, DWORD *size, bool force32bit, bool force64bit); +bool MsRegReadValueEx2W(UINT root, char *keyname, char *valuename, void **data, DWORD *type, DWORD *size, bool force32bit, bool force64bit); char *MsRegReadStr(UINT root, char *keyname, char *valuename); char *MsRegReadStrEx(UINT root, char *keyname, char *valuename, bool force32bit); @@ -946,8 +945,8 @@ bool MsStartDevice(HDEVINFO info, SP_DEVINFO_DATA *dev_info_data); bool MsStopDevice(HDEVINFO info, SP_DEVINFO_DATA *dev_info_data); bool MsDeleteDevice(HDEVINFO info, SP_DEVINFO_DATA *dev_info_data); bool MsIsDeviceRunning(HDEVINFO info, SP_DEVINFO_DATA *dev_info_data); -void CALLBACK MsServiceDispatcher(UINT argc, LPTSTR *argv); -void CALLBACK MsServiceHandler(UINT opcode); +void CALLBACK MsServiceDispatcher(DWORD argc, LPTSTR *argv); +void CALLBACK MsServiceHandler(DWORD opcode); bool MsServiceStopProc(); void MsServiceStoperMainThread(THREAD *t, void *p); void MsServiceStarterMainThread(THREAD *t, void *p); @@ -960,13 +959,13 @@ void MsHideIconOnTray(); void MsUserModeTrayMenu(HWND hWnd); bool MsAppendMenu(HMENU hMenu, UINT flags, UINT_PTR id, wchar_t *str); bool MsInsertMenu(HMENU hMenu, UINT pos, UINT flags, UINT_PTR id_new_item, wchar_t *lp_new_item); -bool CALLBACK MsEnumChildWindowProc(HWND hWnd, LPARAM lParam); +BOOL CALLBACK MsEnumChildWindowProc(HWND hWnd, LPARAM lParam); BOOL CALLBACK EnumTopWindowProc(HWND hWnd, LPARAM lParam); -bool CALLBACK MsEnumThreadWindowProc(HWND hWnd, LPARAM lParam); +BOOL CALLBACK MsEnumThreadWindowProc(HWND hWnd, LPARAM lParam); HANDLE MsCreateUserToken(); SID *MsGetSidFromAccountName(char *name); void MsFreeSid(SID *sid); -bool CALLBACK MsEnumResourcesInternalProc(HMODULE hModule, const char *type, char *name, LONG_PTR lParam); +BOOL CALLBACK MsEnumResourcesInternalProc(HMODULE hModule, const char *type, char *name, LONG_PTR lParam); LRESULT CALLBACK MsSuspendHandlerWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); void MsSuspendHandlerThreadProc(THREAD *thread, void *param);