[SETUPAPI] Prepare Wine syncing.

- Rename global hInstance to SETUPAPI_hInstance;
- Add ARRAY_SIZE in case it is not defined.

- Use the CRT oldnames library.
  Remove the '-Dwcsnicmp=_wcsnicmp' and use the alias in the oldnames lib.
  This will also fix wcslwr() usage in the next commits.
This commit is contained in:
Hermès Bélusca-Maïto 2023-09-26 17:59:41 +02:00
parent 4648a2210f
commit 5a17e99bdb
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
6 changed files with 17 additions and 17 deletions

View file

@ -4,11 +4,7 @@ include_directories(
${REACTOS_SOURCE_DIR}/sdk/include/reactos/idl
${CMAKE_CURRENT_BINARY_DIR})
add_definitions(
-D_SETUPAPI_
-D_CFGMGR32_
)
add_definitions(-D_SETUPAPI_ -D_CFGMGR32_)
remove_definitions(-D_CRT_NON_CONFORMING_SWPRINTFS)
add_rpc_files(client ${REACTOS_SOURCE_DIR}/sdk/include/reactos/idl/pnp.idl)

View file

@ -572,7 +572,7 @@ SetupDiGetClassImageListExW(
}
else if(!DllName)
{
hIcon = LoadImage(hInstance, MAKEINTRESOURCE(miniIconIndex), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
hIcon = LoadImage(SETUPAPI_hInstance, MAKEINTRESOURCE(miniIconIndex), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
list->IconIndexes[i] = ImageList_AddIcon(ClassImageListData->ImageList, hIcon);
}
@ -593,7 +593,7 @@ SetupDiGetClassImageListExW(
/* Finally, add the overlay icons to the image list */
for (i = 0; i <= 2; i++)
{
hIcon = LoadImage(hInstance, MAKEINTRESOURCE(500 + i), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
hIcon = LoadImage(SETUPAPI_hInstance, MAKEINTRESOURCE(500 + i), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
if (hIcon)
{
idx = ImageList_AddIcon(ClassImageListData->ImageList, hIcon);
@ -676,7 +676,7 @@ SetupDiLoadClassIcon(
if(DllName)
iconIndex = UNKNOWN_ICON_INDEX;
hIcon = LoadImage(hInstance, MAKEINTRESOURCE(iconIndex), IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR);
hIcon = LoadImage(SETUPAPI_hInstance, MAKEINTRESOURCE(iconIndex), IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR);
if(!hIcon)
goto cleanup;

View file

@ -49,7 +49,7 @@ static void promptdisk_init(HWND hwnd, struct promptdisk_params *params)
WCHAR format[256];
WCHAR unknown[256];
DWORD_PTR args[2];
LoadStringW(hInstance, IDS_PROMPTDISK, format,
LoadStringW(SETUPAPI_hInstance, IDS_PROMPTDISK, format,
sizeof(format)/sizeof(format[0]));
args[0] = (DWORD_PTR)params->FileSought;
@ -57,7 +57,7 @@ static void promptdisk_init(HWND hwnd, struct promptdisk_params *params)
args[1] = (DWORD_PTR)params->DiskName;
else
{
LoadStringW(hInstance, IDS_UNKNOWN, unknown,
LoadStringW(SETUPAPI_hInstance, IDS_UNKNOWN, unknown,
sizeof(unknown)/sizeof(unknown[0]));
args[1] = (DWORD_PTR)unknown;
}
@ -66,10 +66,10 @@ static void promptdisk_init(HWND hwnd, struct promptdisk_params *params)
(__ms_va_list*)args);
SetDlgItemTextW(hwnd, IDC_FILENEEDED, message);
LoadStringW(hInstance, IDS_INFO, message,
LoadStringW(SETUPAPI_hInstance, IDS_INFO, message,
sizeof(message)/sizeof(message[0]));
SetDlgItemTextW(hwnd, IDC_INFO, message);
LoadStringW(hInstance, IDS_COPYFROM, message,
LoadStringW(SETUPAPI_hInstance, IDS_COPYFROM, message,
sizeof(message)/sizeof(message[0]));
SetDlgItemTextW(hwnd, IDC_COPYFROM, message);
}
@ -272,7 +272,7 @@ UINT WINAPI SetupPromptForDiskW(HWND hwndParent, PCWSTR DialogTitle, PCWSTR Disk
params.PathBufferSize = PathBufferSize;
params.PathRequiredSize = PathRequiredSize;
ret = DialogBoxParamW(hInstance, MAKEINTRESOURCEW(IDPROMPTFORDISK),
ret = DialogBoxParamW(SETUPAPI_hInstance, MAKEINTRESOURCEW(IDPROMPTFORDISK),
hwndParent, promptdisk_proc, (LPARAM)&params);
if(ret == DPROMPT_CANCEL)

View file

@ -911,7 +911,7 @@ VOID WINAPI AssertFail(LPSTR lpFile, UINT uLine, LPSTR lpMessage)
TRACE("%s %u %s\n", lpFile, uLine, lpMessage);
GetModuleFileNameA(hInstance, szModule, MAX_PATH);
GetModuleFileNameA(SETUPAPI_hInstance, szModule, MAX_PATH);
lpName = strrchr(szModule, '\\');
if (lpName != NULL)
lpName++;

View file

@ -58,6 +58,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
#undef __WINESRC__
#endif
#ifdef __REACTOS__
#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
#endif
#include "resource.h"
#define SETUP_DEVICE_INFO_SET_MAGIC 0xd00ff057
@ -245,7 +249,7 @@ struct FileLog /* HSPFILELOG */
LPWSTR LogName;
};
extern HINSTANCE hInstance;
extern HINSTANCE SETUPAPI_hInstance;
extern OSVERSIONINFOEXW OsVersionInfo;
/*

View file

@ -29,7 +29,7 @@
#include <share.h>
#include <fdi.h>
HINSTANCE hInstance = NULL;
HINSTANCE SETUPAPI_hInstance = NULL;
OSVERSIONINFOEXW OsVersionInfo;
static HINSTANCE CABINET_hInstance = NULL;
@ -655,7 +655,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
OsVersionInfo.dwOSVersionInfoSize = sizeof(OsVersionInfo);
if (!GetVersionExW((POSVERSIONINFOW)&OsVersionInfo))
return FALSE;
hInstance = (HINSTANCE)hinstDLL;
SETUPAPI_hInstance = hinstDLL;
break;
case DLL_PROCESS_DETACH:
if (lpvReserved) break;