From 7175324992f250eca138e2a8b2397920333866e5 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 19 Jan 2012 21:05:28 +0100 Subject: [PATCH] winetest: Avoid Unicode macros. --- programs/winetest/Makefile.in | 1 + programs/winetest/gui.c | 57 +++++++++++++++-------------------- programs/winetest/main.c | 57 +++++++++++++++++------------------ programs/winetest/send.c | 2 +- programs/winetest/util.c | 2 +- programs/winetest/winetest.rc | 8 ++--- 6 files changed, 60 insertions(+), 67 deletions(-) diff --git a/programs/winetest/Makefile.in b/programs/winetest/Makefile.in index cddea98a71c..7948e262c5c 100644 --- a/programs/winetest/Makefile.in +++ b/programs/winetest/Makefile.in @@ -1,5 +1,6 @@ MODULE = winetest.exe APPMODE = -mconsole +EXTRADEFS = -DWINE_NO_UNICODE_MACROS IMPORTS = uuid comctl32 version user32 gdi32 advapi32 wsock32 DELAYIMPORTS = ole32 diff --git a/programs/winetest/gui.c b/programs/winetest/gui.c index 6bbe9401847..a8bcf05d5e2 100644 --- a/programs/winetest/gui.c +++ b/programs/winetest/gui.c @@ -77,7 +77,7 @@ guiStatus (va_list ap) char *str = vstrmake (&len, ap); if (len > 128) str[129] = 0; - SetDlgItemText (dialog, IDC_SB, str); + SetDlgItemTextA (dialog, IDC_SB, str); heap_free (str); return 0; } @@ -107,8 +107,8 @@ guiProgress (va_list ap) } else progressScale = 1; pb = GetDlgItem (dialog, IDC_PB0 + progressGroup * 2); - SendMessage (pb, PBM_SETRANGE, 0, MAKELPARAM (0, max)); - SendMessage (pb, PBM_SETSTEP, 1, 0); + SendMessageA(pb, PBM_SETRANGE, 0, MAKELPARAM (0, max)); + SendMessageA(pb, PBM_SETSTEP, 1, 0); return 0; } @@ -132,8 +132,8 @@ guiStep (va_list ap) char *str = vstrmake (NULL, ap); progressCurr++; - SetDlgItemText (dialog, pgID, str); - SendDlgItemMessage (dialog, pgID+1, PBM_SETPOS, + SetDlgItemTextA (dialog, pgID, str); + SendDlgItemMessageA(dialog, pgID+1, PBM_SETPOS, progressScale * progressCurr, 0); heap_free (str); return 0; @@ -161,8 +161,8 @@ guiDelta (va_list ap) char *str = vstrmake (NULL, ap); progressCurr += inc; - SetDlgItemText (dialog, pgID, str); - SendDlgItemMessage (dialog, pgID+1, PBM_SETPOS, + SetDlgItemTextA (dialog, pgID, str); + SendDlgItemMessageA(dialog, pgID+1, PBM_SETPOS, progressScale * progressCurr, 0); heap_free (str); return 0; @@ -181,7 +181,7 @@ textTag (va_list ap) static int guiTag (va_list ap) { - SetDlgItemText (dialog, IDC_TAG, tag); + SetDlgItemTextA (dialog, IDC_TAG, tag); return 0; } @@ -203,7 +203,7 @@ guiDir (va_list ap) { char *str = vstrmake (NULL, ap); - SetDlgItemText (dialog, IDC_DIR, str); + SetDlgItemTextA (dialog, IDC_DIR, str); heap_free (str); return 0; } @@ -226,7 +226,7 @@ guiOut (va_list ap) { char *str = vstrmake (NULL, ap); - SetDlgItemText (dialog, IDC_OUT, str); + SetDlgItemTextA (dialog, IDC_OUT, str); heap_free (str); return 0; } @@ -245,7 +245,7 @@ guiWarning (va_list ap) { char *str = vstrmake (NULL, ap); - MessageBox (dialog, str, "Warning", MB_ICONWARNING | MB_OK); + MessageBoxA (dialog, str, "Warning", MB_ICONWARNING | MB_OK); heap_free (str); return 0; } @@ -264,7 +264,7 @@ guiError (va_list ap) { char *str = vstrmake (NULL, ap); - MessageBox (dialog, str, "Error", MB_ICONERROR | MB_OK); + MessageBoxA (dialog, str, "Error", MB_ICONERROR | MB_OK); heap_free (str); return 0; } @@ -303,8 +303,7 @@ guiAsk (va_list ap) { int uType = va_arg (ap, int); char *str = vstrmake (NULL, ap); - int ret = MessageBox (dialog, str, "Question", - MB_ICONQUESTION | uType); + int ret = MessageBoxA (dialog, str, "Question", MB_ICONQUESTION | uType); heap_free (str); return ret; @@ -330,7 +329,7 @@ AskTagProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) switch (msg) { case WM_INITDIALOG: - DefEditProc = (WNDPROC)SetWindowLongPtr + DefEditProc = (WNDPROC)SetWindowLongPtrA (GetDlgItem (hwnd, IDC_TAG), GWLP_WNDPROC, (LONG_PTR)EditTagProc); return TRUE; case WM_COMMAND: @@ -356,9 +355,7 @@ AskTagProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) int guiAskTag (void) { - return DialogBox (GetModuleHandle (NULL), - MAKEINTRESOURCE (IDD_TAG), - dialog, AskTagProc); + return DialogBoxA(GetModuleHandleA(NULL), MAKEINTRESOURCEA(IDD_TAG), dialog, AskTagProc); } static INT_PTR CALLBACK @@ -391,7 +388,7 @@ AskEmailProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) int guiAskEmail (void) { - return DialogBox (GetModuleHandle (NULL), MAKEINTRESOURCE (IDD_EMAIL), dialog, AskEmailProc); + return DialogBoxA(GetModuleHandleA(NULL), MAKEINTRESOURCEA(IDD_EMAIL), dialog, AskEmailProc); } /* Quiet functions */ @@ -426,13 +423,12 @@ DlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: - SendMessage (hwnd, WM_SETICON, ICON_SMALL, - (LPARAM)LoadImage( GetModuleHandle (NULL), MAKEINTRESOURCE (IDI_WINE), IMAGE_ICON, - GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), - LR_SHARED )); - SendMessage (hwnd, WM_SETICON, ICON_BIG, - (LPARAM)LoadIcon (GetModuleHandle (NULL), - MAKEINTRESOURCE (IDI_WINE))); + SendMessageA(hwnd, WM_SETICON, ICON_SMALL, + (LPARAM)LoadImageA( GetModuleHandleA(NULL), MAKEINTRESOURCEA(IDI_WINE), IMAGE_ICON, + GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), + LR_SHARED )); + SendMessageA(hwnd, WM_SETICON, ICON_BIG, + (LPARAM)LoadIconA( GetModuleHandleA(NULL), MAKEINTRESOURCEA(IDI_WINE))); dialog = hwnd; if (!SetEvent (initEvent)) { report (R_STATUS, "Can't signal main thread: %d", @@ -446,8 +442,7 @@ DlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_COMMAND: switch (LOWORD (wParam)) { case IDHELP: - DialogBox (GetModuleHandle (NULL), - MAKEINTRESOURCE (IDD_ABOUT), hwnd, AboutProc); + DialogBoxA(GetModuleHandleA(NULL), MAKEINTRESOURCEA(IDD_ABOUT), hwnd, AboutProc); return TRUE; case IDABORT: report (R_STATUS, "Aborting, please wait..."); @@ -464,9 +459,7 @@ DlgThreadProc (LPVOID param) int ret; InitCommonControls (); - ret = DialogBox (GetModuleHandle (NULL), - MAKEINTRESOURCE (IDD_STATUS), - NULL, DlgProc); + ret = DialogBoxA(GetModuleHandleA(NULL), MAKEINTRESOURCEA(IDD_STATUS), NULL, DlgProc); switch (ret) { case 0: report (R_FATAL, "Cannot display dialog"); @@ -520,7 +513,7 @@ report (enum report_type t, ...) DWORD DlgThreadID; funcs = text_funcs; - initEvent = CreateEvent (NULL, FALSE, FALSE, NULL); + initEvent = CreateEventA(NULL, FALSE, FALSE, NULL); if (!initEvent) report (R_STATUS, "Can't create event object: %d", GetLastError ()); diff --git a/programs/winetest/main.c b/programs/winetest/main.c index 3f6dd6bc3ec..ea74a06a941 100644 --- a/programs/winetest/main.c +++ b/programs/winetest/main.c @@ -188,7 +188,7 @@ static int check_display_driver(void) static int running_on_visible_desktop (void) { HWND desktop; - HMODULE huser32 = GetModuleHandle("user32.dll"); + HMODULE huser32 = GetModuleHandleA("user32.dll"); HWINSTA (WINAPI *pGetProcessWindowStation)(void); BOOL (WINAPI *pGetUserObjectInformationA)(HANDLE,INT,LPVOID,DWORD,LPDWORD); @@ -323,18 +323,18 @@ static void print_version (void) #else # error CPU unknown #endif - OSVERSIONINFOEX ver; + OSVERSIONINFOEXA ver; BOOL ext; int is_win2k3_r2, is_admin, is_elevated; const char *(CDECL *wine_get_build_id)(void); void (CDECL *wine_get_host_version)( const char **sysname, const char **release ); BOOL (WINAPI *pGetProductInfo)(DWORD, DWORD, DWORD, DWORD, DWORD *); - ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); - if (!(ext = GetVersionEx ((OSVERSIONINFO *) &ver))) + ver.dwOSVersionInfoSize = sizeof(ver); + if (!(ext = GetVersionExA ((OSVERSIONINFOA *) &ver))) { - ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - if (!GetVersionEx ((OSVERSIONINFO *) &ver)) + ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA); + if (!GetVersionExA ((OSVERSIONINFOA *) &ver)) report (R_FATAL, "Can't get OS version."); } xprintf (" Platform=%s%s\n", platform, is_wow64 ? " (WOW64)" : ""); @@ -416,14 +416,14 @@ static inline int is_dot_dir(const char* x) static void remove_dir (const char *dir) { HANDLE hFind; - WIN32_FIND_DATA wfd; + WIN32_FIND_DATAA wfd; char path[MAX_PATH]; size_t dirlen = strlen (dir); /* Make sure the directory exists before going further */ memcpy (path, dir, dirlen); strcpy (path + dirlen++, "\\*"); - hFind = FindFirstFile (path, &wfd); + hFind = FindFirstFileA (path, &wfd); if (hFind == INVALID_HANDLE_VALUE) return; do { @@ -434,12 +434,12 @@ static void remove_dir (const char *dir) strcpy (path + dirlen, lp); if (FILE_ATTRIBUTE_DIRECTORY & wfd.dwFileAttributes) remove_dir(path); - else if (!DeleteFile (path)) + else if (!DeleteFileA(path)) report (R_WARNING, "Can't delete file %s: error %d", path, GetLastError ()); - } while (FindNextFile (hFind, &wfd)); + } while (FindNextFileA(hFind, &wfd)); FindClose (hFind); - if (!RemoveDirectory (dir)) + if (!RemoveDirectoryA(dir)) report (R_WARNING, "Can't remove directory %s: error %d", dir, GetLastError ()); } @@ -471,13 +471,13 @@ static const char* get_test_source_file(const char* test, const char* subtest) return buffer; } -static void* extract_rcdata (LPCTSTR name, LPCTSTR type, DWORD* size) +static void* extract_rcdata (LPCSTR name, LPCSTR type, DWORD* size) { HRSRC rsrc; HGLOBAL hdl; LPVOID addr; - if (!(rsrc = FindResource (NULL, name, type)) || + if (!(rsrc = FindResourceA(NULL, name, type)) || !(*size = SizeofResource (0, rsrc)) || !(hdl = LoadResource (0, rsrc)) || !(addr = LockResource (hdl))) @@ -487,7 +487,7 @@ static void* extract_rcdata (LPCTSTR name, LPCTSTR type, DWORD* size) /* Fills in the name and exename fields */ static void -extract_test (struct wine_test *test, const char *dir, LPTSTR res_name) +extract_test (struct wine_test *test, const char *dir, LPSTR res_name) { BYTE* code; DWORD size; @@ -526,7 +526,7 @@ static DWORD wait_process( HANDLE process, DWORD timeout ) { wait = MsgWaitForMultipleObjects( 1, &process, FALSE, timeout - diff, QS_ALLINPUT ); if (wait != WAIT_OBJECT_0 + 1) return wait; - while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessage( &msg ); + while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); diff = GetTickCount() - start; } return WAIT_TIMEOUT; @@ -554,11 +554,11 @@ static void append_path( const char *path) static int run_ex (char *cmd, HANDLE out_file, const char *tempdir, DWORD ms) { - STARTUPINFO si; + STARTUPINFOA si; PROCESS_INFORMATION pi; DWORD wait, status; - GetStartupInfo (&si); + GetStartupInfoA (&si); si.dwFlags = STARTF_USESTDHANDLES; si.hStdInput = GetStdHandle( STD_INPUT_HANDLE ); si.hStdOutput = out_file ? out_file : GetStdHandle( STD_OUTPUT_HANDLE ); @@ -607,7 +607,7 @@ run_ex (char *cmd, HANDLE out_file, const char *tempdir, DWORD ms) } static DWORD -get_subtests (const char *tempdir, struct wine_test *test, LPTSTR res_name) +get_subtests (const char *tempdir, struct wine_test *test, LPSTR res_name) { char *cmd; HANDLE subfile; @@ -733,8 +733,8 @@ run_test (struct wine_test* test, const char* subtest, HANDLE out_file, const ch } static BOOL CALLBACK -EnumTestFileProc (HMODULE hModule, LPCTSTR lpszType, - LPTSTR lpszName, LONG_PTR lParam) +EnumTestFileProc (HMODULE hModule, LPCSTR lpszType, + LPSTR lpszName, LONG_PTR lParam) { if (!test_filtered_out( lpszName, NULL )) (*(int*)lParam)++; return TRUE; @@ -812,8 +812,7 @@ static void get_dll_path(HMODULE dll, char **path, char *filename) } static BOOL CALLBACK -extract_test_proc (HMODULE hModule, LPCTSTR lpszType, - LPTSTR lpszName, LONG_PTR lParam) +extract_test_proc (HMODULE hModule, LPCSTR lpszType, LPSTR lpszName, LONG_PTR lParam) { const char *tempdir = (const char *)lParam; char dllname[MAX_PATH]; @@ -847,7 +846,7 @@ extract_test_proc (HMODULE hModule, LPCTSTR lpszType, actctxinfo.cbSize = sizeof(ACTCTXA); actctxinfo.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID; actctxinfo.lpSource = wine_tests[nr_of_files].exename; - actctxinfo.lpResourceName = CREATEPROCESS_MANIFEST_RESOURCE_ID; + actctxinfo.lpResourceName = (LPSTR)CREATEPROCESS_MANIFEST_RESOURCE_ID; actctx = pCreateActCtxA(&actctxinfo); if (actctx != INVALID_HANDLE_VALUE && ! pActivateActCtx(actctx, &cookie)) @@ -1010,7 +1009,7 @@ run_tests (char *logname, char *outdir) xprintf ("Dll info:\n" ); report (R_STATUS, "Counting tests"); - if (!EnumResourceNames (NULL, "TESTRES", EnumTestFileProc, (LPARAM)&nr_of_files)) + if (!EnumResourceNamesA (NULL, "TESTRES", EnumTestFileProc, (LPARAM)&nr_of_files)) report (R_FATAL, "Can't enumerate test files: %d", GetLastError ()); wine_tests = heap_alloc (nr_of_files * sizeof wine_tests[0]); @@ -1031,7 +1030,7 @@ run_tests (char *logname, char *outdir) nr_of_files = 0; nr_of_tests = 0; nr_of_skips = 0; - if (!EnumResourceNames (NULL, "TESTRES", extract_test_proc, (LPARAM)tempdir)) + if (!EnumResourceNamesA (NULL, "TESTRES", extract_test_proc, (LPARAM)tempdir)) report (R_FATAL, "Can't enumerate test files: %d", GetLastError ()); @@ -1094,7 +1093,7 @@ static BOOL WINAPI ctrl_handler(DWORD ctrl_type) static BOOL CALLBACK -extract_only_proc (HMODULE hModule, LPCTSTR lpszType, LPTSTR lpszName, LONG_PTR lParam) +extract_only_proc (HMODULE hModule, LPCSTR lpszType, LPSTR lpszName, LONG_PTR lParam) { const char *target_dir = (const char *)lParam; char filename[MAX_PATH]; @@ -1120,7 +1119,7 @@ static void extract_only (const char *target_dir) nr_of_files = 0; report (R_STATUS, "Counting tests"); - if (!EnumResourceNames (NULL, "TESTRES", EnumTestFileProc, (LPARAM)&nr_of_files)) + if (!EnumResourceNamesA(NULL, "TESTRES", EnumTestFileProc, (LPARAM)&nr_of_files)) report (R_FATAL, "Can't enumerate test files: %d", GetLastError ()); wine_tests = heap_alloc (nr_of_files * sizeof wine_tests[0] ); @@ -1128,7 +1127,7 @@ static void extract_only (const char *target_dir) report (R_STATUS, "Extracting tests"); report (R_PROGRESS, 0, nr_of_files); nr_of_files = 0; - if (!EnumResourceNames (NULL, "TESTRES", extract_only_proc, (LPARAM)target_dir)) + if (!EnumResourceNamesA(NULL, "TESTRES", extract_only_proc, (LPARAM)target_dir)) report (R_FATAL, "Can't enumerate test files: %d", GetLastError ()); report (R_DELTA, 0, "Extracting: Done"); @@ -1362,7 +1361,7 @@ int main( int argc, char *argv[] ) /* enable the shutdown privilege for the current process */ if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken)) { - LookupPrivilegeValueA(0, SE_SHUTDOWN_NAME, &npr.Privileges[0].Luid); + LookupPrivilegeValueA(0, "SeShutdownPrivilege", &npr.Privileges[0].Luid); npr.PrivilegeCount = 1; npr.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; AdjustTokenPrivileges(hToken, FALSE, &npr, 0, 0, 0); diff --git a/programs/winetest/send.c b/programs/winetest/send.c index 11c9f334198..4a3cc7d228a 100644 --- a/programs/winetest/send.c +++ b/programs/winetest/send.c @@ -263,7 +263,7 @@ send_file_wininet (const char *name) static const char extra_headers[] = CONTENT_HEADERS; - wininet_mod = LoadLibrary ("wininet.dll"); + wininet_mod = LoadLibraryA("wininet.dll"); if (wininet_mod == NULL) goto done; pInternetOpen = (void *)GetProcAddress(wininet_mod, "InternetOpenA"); diff --git a/programs/winetest/util.c b/programs/winetest/util.c index d0776eaf72e..af625e7d971 100644 --- a/programs/winetest/util.c +++ b/programs/winetest/util.c @@ -45,7 +45,7 @@ void *heap_realloc (void *op, size_t len) char *heap_strdup( const char *str ) { - int len = lstrlen(str) + 1; + int len = strlen(str) + 1; char* res = HeapAlloc(GetProcessHeap(), 0, len); if (!res) report (R_FATAL, "Out of memory."); memcpy(res, str, len); diff --git a/programs/winetest/winetest.rc b/programs/winetest/winetest.rc index 5b5d6e09d17..ff9ca7b4772 100644 --- a/programs/winetest/winetest.rc +++ b/programs/winetest/winetest.rc @@ -51,11 +51,11 @@ STYLE WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX CAPTION "Wine Test Shell" BEGIN LTEXT "Extracting:", IDC_ST0, 10, 5, 140, 10 - CONTROL "PB0", IDC_PB0, PROGRESS_CLASS, 0, 5, 15, 150, 10 + CONTROL "PB0", IDC_PB0, PROGRESS_CLASSA, 0, 5, 15, 150, 10 LTEXT "Running:", IDC_ST1, 10, 30, 140, 10 - CONTROL "PB1", IDC_PB1, PROGRESS_CLASS, 0, 5, 40, 150, 10 + CONTROL "PB1", IDC_PB1, PROGRESS_CLASSA, 0, 5, 40, 150, 10 LTEXT "Network transfer:", IDC_ST2, 10, 55, 140, 10 - CONTROL "PB2", IDC_PB2, PROGRESS_CLASS, 0, 5, 65, 150, 10 + CONTROL "PB2", IDC_PB2, PROGRESS_CLASSA, 0, 5, 65, 150, 10 LTEXT "Tag:", IDC_STATIC, 10, 89, 100, 10 EDITTEXT IDC_TAG, 25, 88, 125, 10, @@ -72,7 +72,7 @@ BEGIN WS_DISABLED PUSHBUTTON "Stop", IDABORT, 110, 123, 30, 14 - CONTROL "Created", IDC_SB, STATUSCLASSNAME, 0, 0,0,0,0 + CONTROL "Created", IDC_SB, STATUSCLASSNAMEA, 0, 0,0,0,0 END IDD_ABOUT DIALOG 0, 0, 150, 60