From 50afa42d93ee403698670ae9d55f6f46ab081419 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 20 Feb 2016 18:38:17 +0100 Subject: [PATCH] Use ANSI versions of Win32 functions when not using Unicode text, issue #261 --- .../3d/driver/direct3d/driver_direct3d.cpp | 20 ++++----- .../src/3d/driver/opengl/driver_opengl.cpp | 10 ++--- .../3d/driver/opengl/driver_opengl_window.cpp | 14 +++---- code/nel/src/misc/debug.cpp | 14 +++---- code/nel/src/misc/displayer.cpp | 2 +- code/nel/src/misc/inter_window_msg_queue.cpp | 4 +- code/nel/src/misc/mem_displayer.cpp | 13 +++--- code/nel/src/misc/mutex.cpp | 2 +- code/nel/src/misc/shared_memory.cpp | 4 +- code/nel/src/misc/system_info.cpp | 26 ++++++------ code/nel/src/misc/system_utils.cpp | 4 +- code/nel/src/misc/win_displayer.cpp | 42 +++++++++---------- code/nel/src/misc/win_thread.cpp | 2 +- code/ryzom/client/src/init.cpp | 2 +- 14 files changed, 79 insertions(+), 80 deletions(-) diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp index 1adaeb73f..2b90ea1ed 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp @@ -1243,23 +1243,23 @@ bool CDriverD3D::init (uintptr_t windowIcon, emptyProc exitFunc) createCursors(); + _WindowClass = "NLD3D" + toString(windowIcon); + // Register a window class - WNDCLASSW wc; + WNDCLASSA wc; memset(&wc,0,sizeof(wc)); wc.style = 0; // CS_HREDRAW | CS_VREDRAW ;//| CS_DBLCLKS; wc.lpfnWndProc = (WNDPROC)WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; - wc.hInstance = GetModuleHandleW(NULL); + wc.hInstance = GetModuleHandleA(NULL); wc.hIcon = (HICON)windowIcon; wc.hCursor = _DefaultCursor; wc.hbrBackground = WHITE_BRUSH; - _WindowClass = "NLD3D" + toString(windowIcon); - ucstring us = _WindowClass; - wc.lpszClassName = (LPCWSTR)us.c_str(); + wc.lpszClassName = _WindowClass.c_str(); wc.lpszMenuName = NULL; - if (!RegisterClassW(&wc)) + if (!RegisterClassA(&wc)) { DWORD error = GetLastError(); if (error != ERROR_CLASS_ALREADY_EXISTS) @@ -2327,13 +2327,13 @@ void CDriverD3D::setWindowIcon(const std::vector &bitmaps) if (winIconBig) { - SendMessage(_HWnd, WM_SETICON, 0 /* ICON_SMALL */, (LPARAM)winIconSmall); - SendMessage(_HWnd, WM_SETICON, 1 /* ICON_BIG */, (LPARAM)winIconBig); + SendMessageA(_HWnd, WM_SETICON, 0 /* ICON_SMALL */, (LPARAM)winIconSmall); + SendMessageA(_HWnd, WM_SETICON, 1 /* ICON_BIG */, (LPARAM)winIconBig); } else { - SendMessage(_HWnd, WM_SETICON, 0 /* ICON_SMALL */, (LPARAM)winIconSmall); - SendMessage(_HWnd, WM_SETICON, 1 /* ICON_BIG */, (LPARAM)winIconSmall); + SendMessageA(_HWnd, WM_SETICON, 0 /* ICON_SMALL */, (LPARAM)winIconSmall); + SendMessageA(_HWnd, WM_SETICON, 1 /* ICON_BIG */, (LPARAM)winIconSmall); } } diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.cpp b/code/nel/src/3d/driver/opengl/driver_opengl.cpp index 2b7f76515..e247275ab 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl.cpp @@ -2527,7 +2527,7 @@ void CDriverGL::retrieveATIDriverVersion() // get from the registry HKEY parentKey; // open key about current video card - LONG result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E968-E325-11CE-BFC1-08002BE10318}", 0, KEY_READ, &parentKey); + LONG result = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E968-E325-11CE-BFC1-08002BE10318}", 0, KEY_READ, &parentKey); if (result == ERROR_SUCCESS) { // find last config @@ -2541,7 +2541,7 @@ void CDriverGL::retrieveATIDriverVersion() for(;;) { nameBufferSize = sizeof(subKeyName) / sizeof(subKeyName[0]); - result = RegEnumKeyEx(parentKey, keyIndex, subKeyName, &nameBufferSize, NULL, NULL, NULL, &lastWriteTime); + result = RegEnumKeyExA(parentKey, keyIndex, subKeyName, &nameBufferSize, NULL, NULL, NULL, &lastWriteTime); if (result == ERROR_NO_MORE_ITEMS) break; if (result == ERROR_SUCCESS) { @@ -2577,14 +2577,14 @@ void CDriverGL::retrieveATIDriverVersion() if (configFound) { HKEY subKey; - result = RegOpenKeyEx(parentKey, latestSubKeyName, 0, KEY_READ, &subKey); + result = RegOpenKeyExA(parentKey, latestSubKeyName, 0, KEY_READ, &subKey); if (result == ERROR_SUCCESS) { // see if it is a radeon card DWORD valueType; char driverDesc[256]; DWORD driverDescBufSize = sizeof(driverDesc) / sizeof(driverDesc[0]); - result = RegQueryValueEx(subKey, "DriverDesc", NULL, &valueType, (unsigned char *) driverDesc, &driverDescBufSize); + result = RegQueryValueExA(subKey, "DriverDesc", NULL, &valueType, (unsigned char *) driverDesc, &driverDescBufSize); if (result == ERROR_SUCCESS && valueType == REG_SZ) { toLower(driverDesc); @@ -2592,7 +2592,7 @@ void CDriverGL::retrieveATIDriverVersion() { char driverVersion[256]; DWORD driverVersionBufSize = sizeof(driverVersion) / sizeof(driverVersion[0]); - result = RegQueryValueEx(subKey, "DriverVersion", NULL, &valueType, (unsigned char *) driverVersion, &driverVersionBufSize); + result = RegQueryValueExA(subKey, "DriverVersion", NULL, &valueType, (unsigned char *) driverVersion, &driverVersionBufSize); if (result == ERROR_SUCCESS && valueType == REG_SZ) { int subVersionNumber[4]; diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp index 5c6d63045..db6400042 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp @@ -326,7 +326,7 @@ bool CDriverGL::init (uintptr_t windowIcon, emptyProc exitFunc) } // Backup monitor color parameters - HDC dc = CreateDC ("DISPLAY", NULL, NULL, NULL); + HDC dc = CreateDCA ("DISPLAY", NULL, NULL, NULL); if (dc) { _NeedToRestoreGammaRamp = GetDeviceGammaRamp (dc, _GammaRampBackuped) != FALSE; @@ -468,7 +468,7 @@ bool CDriverGL::unInit() // Restore monitor color parameters if (_NeedToRestoreGammaRamp) { - HDC dc = CreateDC ("DISPLAY", NULL, NULL, NULL); + HDC dc = CreateDCA ("DISPLAY", NULL, NULL, NULL); if (dc) { if (!SetDeviceGammaRamp (dc, _GammaRampBackuped)) @@ -558,13 +558,13 @@ void CDriverGL::setWindowIcon(const std::vector &bitmaps) if (winIconBig) { - SendMessage(_win, WM_SETICON, 0 /* ICON_SMALL */, (LPARAM)winIconSmall); - SendMessage(_win, WM_SETICON, 1 /* ICON_BIG */, (LPARAM)winIconBig); + SendMessageA(_win, WM_SETICON, 0 /* ICON_SMALL */, (LPARAM)winIconSmall); + SendMessageA(_win, WM_SETICON, 1 /* ICON_BIG */, (LPARAM)winIconBig); } else { - SendMessage(_win, WM_SETICON, 0 /* ICON_SMALL */, (LPARAM)winIconSmall); - SendMessage(_win, WM_SETICON, 1 /* ICON_BIG */, (LPARAM)winIconSmall); + SendMessageA(_win, WM_SETICON, 0 /* ICON_SMALL */, (LPARAM)winIconSmall); + SendMessageA(_win, WM_SETICON, 1 /* ICON_BIG */, (LPARAM)winIconSmall); } #elif defined(NL_OS_MAC) @@ -2847,7 +2847,7 @@ bool CDriverGL::setMonitorColorProperties (const CMonitorColorProperties &proper #ifdef NL_OS_WINDOWS // Get a DC - HDC dc = CreateDC ("DISPLAY", NULL, NULL, NULL); + HDC dc = CreateDCA ("DISPLAY", NULL, NULL, NULL); if (dc) { // The ramp diff --git a/code/nel/src/misc/debug.cpp b/code/nel/src/misc/debug.cpp index f6794761b..1f0bb4fd1 100644 --- a/code/nel/src/misc/debug.cpp +++ b/code/nel/src/misc/debug.cpp @@ -315,9 +315,9 @@ static DWORD __stdcall GetModuleBase(HANDLE hProcess, DWORD dwReturnAddress) cch = GetModuleFileNameW((HINSTANCE)memoryBasicInfo.AllocationBase, szFile, MAX_PATH); - if (cch && (lstrcmpA(szFile, "DBFN")== 0)) - { - if (!SymLoadModule(hProcess, + if (cch && (lstrcmpA(szFile, "DBFN")== 0)) + { + if (!SymLoadModule(hProcess, NULL, "MN", NULL, (DWORD) memoryBasicInfo.AllocationBase, 0)) { @@ -1171,12 +1171,12 @@ void createDebug (const char *logPath, bool logInFile, bool eraseLastLog) // Use an environment variable to share the value among the EXE and its child DLLs // (otherwise there would be one distinct bool by module, and the last // _set_se_translator would overwrite the previous ones) - const TCHAR *SE_TRANSLATOR_IN_MAIN_MODULE = _T("NEL_SE_TRANS"); - TCHAR envBuf [2]; - if ( GetEnvironmentVariable( SE_TRANSLATOR_IN_MAIN_MODULE, envBuf, 2 ) == 0) + const char *SE_TRANSLATOR_IN_MAIN_MODULE = "NEL_SE_TRANS"; + char envBuf [2]; + if ( GetEnvironmentVariableA( SE_TRANSLATOR_IN_MAIN_MODULE, envBuf, 2 ) == 0) { _set_se_translator(exceptionTranslator); - SetEnvironmentVariable( SE_TRANSLATOR_IN_MAIN_MODULE, _T("1") ); + SetEnvironmentVariableA( SE_TRANSLATOR_IN_MAIN_MODULE, "1" ); } } # endif // NL_OS_WINDOWS diff --git a/code/nel/src/misc/displayer.cpp b/code/nel/src/misc/displayer.cpp index 0749ecfc3..798a4f80a 100644 --- a/code/nel/src/misc/displayer.cpp +++ b/code/nel/src/misc/displayer.cpp @@ -216,7 +216,7 @@ void CStdDisplayer::doDisplay ( const CLog::TDisplayInfo& args, const char *mess static bool consoleModeTest = false; if (!consoleModeTest) { - HANDLE handle = CreateFile ("CONOUT$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0); + HANDLE handle = CreateFileA ("CONOUT$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0); consoleMode = handle != INVALID_HANDLE_VALUE; if (consoleMode) CloseHandle (handle); diff --git a/code/nel/src/misc/inter_window_msg_queue.cpp b/code/nel/src/misc/inter_window_msg_queue.cpp index 77e72e654..cca8f1a37 100644 --- a/code/nel/src/misc/inter_window_msg_queue.cpp +++ b/code/nel/src/misc/inter_window_msg_queue.cpp @@ -96,7 +96,7 @@ namespace NLMISC nlassert(_Id == 0); // init done twice release(); // create a system wide mutex - _SharedMemMutex = CreateMutex(NULL, FALSE, toString("NL_MUTEX_%d", (int) id).c_str()); + _SharedMemMutex = CreateMutexA(NULL, FALSE, toString("NL_MUTEX_%d", (int) id).c_str()); if (!_SharedMemMutex) return false; _Id = id; return true; @@ -197,7 +197,7 @@ namespace NLMISC cds.lpData = (PVOID) msgOut.buffer(); for(;;) { - LRESULT result = ::SendMessage(targetWindow, WM_COPYDATA, (WPARAM) _Parent->_LocalWindow.getWnd(), (LPARAM) &cds); + LRESULT result = ::SendMessageA(targetWindow, WM_COPYDATA, (WPARAM) _Parent->_LocalWindow.getWnd(), (LPARAM) &cds); if (result) break; // retry ... Sleep(30); diff --git a/code/nel/src/misc/mem_displayer.cpp b/code/nel/src/misc/mem_displayer.cpp index 47b262ec8..b8f4f2ea3 100644 --- a/code/nel/src/misc/mem_displayer.cpp +++ b/code/nel/src/misc/mem_displayer.cpp @@ -165,16 +165,15 @@ static DWORD __stdcall GetModuleBase(HANDLE hProcess, DWORD dwReturnAddress) DWORD cch = 0; char szFile[MAX_PATH] = { 0 }; - cch = GetModuleFileNameA((HINSTANCE)memoryBasicInfo.AllocationBase, - szFile, MAX_PATH); + cch = GetModuleFileNameA((HINSTANCE)memoryBasicInfo.AllocationBase, szFile, MAX_PATH); - if (cch && (lstrcmp(szFile, "DBFN")== 0)) - { - char mn[] = { 'M', 'N', 0x00 }; + if (cch && (lstrcmpA(szFile, "DBFN")== 0)) + { + char mn[] = { 'M', 'N', 0x00 }; #ifdef NL_OS_WIN64 - if (!SymLoadModule64( + if (!SymLoadModule64( #else - if (!SymLoadModule( + if (!SymLoadModule( #endif hProcess, NULL, mn, diff --git a/code/nel/src/misc/mutex.cpp b/code/nel/src/misc/mutex.cpp index 098bce795..ef0cb4216 100644 --- a/code/nel/src/misc/mutex.cpp +++ b/code/nel/src/misc/mutex.cpp @@ -159,7 +159,7 @@ bool CSharedMutex::createByName( const char *objectName ) #ifdef NL_DEBUG nlassert( _Mutex == NULL ); #endif - _Mutex = (void *) CreateMutex( NULL, FALSE, objectName ); + _Mutex = (void *) CreateMutexA( NULL, FALSE, objectName ); //nldebug( "Creating mutex %s: handle %p", objectName, _Mutex ); return ( _Mutex != NULL ); } diff --git a/code/nel/src/misc/shared_memory.cpp b/code/nel/src/misc/shared_memory.cpp index 3afe795f1..99333a9c8 100644 --- a/code/nel/src/misc/shared_memory.cpp +++ b/code/nel/src/misc/shared_memory.cpp @@ -51,7 +51,7 @@ void *CSharedMemory::createSharedMemory( TSharedMemId sharedMemId, uint32 size #ifdef NL_OS_WINDOWS // Create a file mapping backed by the virtual memory swap file (not a data file) - HANDLE hMapFile = CreateFileMapping( INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, size, sharedMemId ); + HANDLE hMapFile = CreateFileMappingA( INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, size, sharedMemId ); if ( (hMapFile == NULL) || (GetLastError() == ERROR_ALREADY_EXISTS) ) { nlwarning( "SHDMEM: Cannot create file mapping for smid %s: error %u%s, mapFile %p", sharedMemId, GetLastError(), (GetLastError()==ERROR_ALREADY_EXISTS) ? " (already exists) ": "", hMapFile ); @@ -97,7 +97,7 @@ void *CSharedMemory::accessSharedMemory( TSharedMemId sharedMemId ) #ifdef NL_OS_WINDOWS // Open the existing file mapping by name - HANDLE hMapFile = OpenFileMapping( FILE_MAP_ALL_ACCESS, false, sharedMemId ); + HANDLE hMapFile = OpenFileMappingA( FILE_MAP_ALL_ACCESS, false, sharedMemId ); if ( hMapFile == NULL ) return NULL; //nldebug( "SHDMEM: Opening smid %s --> mapFile %p", sharedMemId, hMapFile ); diff --git a/code/nel/src/misc/system_info.cpp b/code/nel/src/misc/system_info.cpp index aa826bccd..7f8a47ee1 100644 --- a/code/nel/src/misc/system_info.cpp +++ b/code/nel/src/misc/system_info.cpp @@ -638,7 +638,7 @@ string CSystemInfo::getOS() else // Test for specific product on Windows NT 4.0 SP5 and earlier { HKEY hKey; - TCHAR szProductType[BUFSIZE]; + char szProductType[BUFSIZE]; DWORD dwBufLen=BUFSIZE; LONG lRet; @@ -652,18 +652,18 @@ string CSystemInfo::getOS() RegCloseKey( hKey ); - if ( lstrcmpi( _T("WINNT"), szProductType) == 0 ) + if ( lstrcmpiA( "WINNT", szProductType) == 0 ) OSString += " Workstation"; - if ( lstrcmpi( _T("LANMANNT"), szProductType) == 0 ) + if ( lstrcmpiA( "LANMANNT", szProductType) == 0 ) OSString += " Server"; - if ( lstrcmpi( _T("SERVERNT"), szProductType) == 0 ) + if ( lstrcmpiA( "SERVERNT", szProductType) == 0 ) OSString += " Advanced Server"; } } std::string servicePack; - if( osvi.dwMajorVersion == 4 && lstrcmpi( osvi.szCSDVersion, _T("Service Pack 6") ) == 0 ) + if (osvi.dwMajorVersion == 4 && lstrcmpiA(osvi.szCSDVersion, "Service Pack 6") == 0 ) { HKEY hKey; LONG lRet; @@ -768,7 +768,7 @@ string CSystemInfo::getProc () { // get processor name valueSize = 1024; - result = ::RegQueryValueEx (hKey, _T("ProcessorNameString"), NULL, NULL, (LPBYTE)value, &valueSize); + result = ::RegQueryValueExA (hKey, "ProcessorNameString", NULL, NULL, (LPBYTE)value, &valueSize); if (result == ERROR_SUCCESS) ProcString = value; else @@ -778,7 +778,7 @@ string CSystemInfo::getProc () // get processor identifier valueSize = 1024; - result = ::RegQueryValueEx (hKey, _T("Identifier"), NULL, NULL, (LPBYTE)value, &valueSize); + result = ::RegQueryValueExA (hKey, "Identifier", NULL, NULL, (LPBYTE)value, &valueSize); if (result == ERROR_SUCCESS) ProcString += value; else @@ -788,7 +788,7 @@ string CSystemInfo::getProc () // get processor vendor valueSize = 1024; - result = ::RegQueryValueEx (hKey, _T("VendorIdentifier"), NULL, NULL, (LPBYTE)value, &valueSize); + result = ::RegQueryValueExA (hKey, "VendorIdentifier", NULL, NULL, (LPBYTE)value, &valueSize); if (result == ERROR_SUCCESS) ProcString += value; else @@ -797,7 +797,7 @@ string CSystemInfo::getProc () ProcString += " / "; // get processor frequency - result = ::RegQueryValueEx (hKey, _T("~MHz"), NULL, NULL, (LPBYTE)value, &valueSize); + result = ::RegQueryValueExA (hKey, "~MHz", NULL, NULL, (LPBYTE)value, &valueSize); if (result == ERROR_SUCCESS) { uint32 freq = *(int *)value; @@ -1387,12 +1387,12 @@ bool CSystemInfo::getVideoInfo (std::string &deviceName, uint64 &driverVersion) } // Version dll link - HMODULE hmVersion = LoadLibrary (_T("version")); + HMODULE hmVersion = LoadLibraryA ("version.dll"); if (hmVersion) { - BOOL (WINAPI* _GetFileVersionInfo)(LPTSTR, DWORD, DWORD, LPVOID) = NULL; - DWORD (WINAPI* _GetFileVersionInfoSize)(LPTSTR, LPDWORD) = NULL; - BOOL (WINAPI* _VerQueryValue)(const LPVOID, LPTSTR, LPVOID*, PUINT) = NULL; + BOOL (WINAPI* _GetFileVersionInfo)(LPSTR, DWORD, DWORD, LPVOID) = NULL; + DWORD (WINAPI* _GetFileVersionInfoSize)(LPSTR, LPDWORD) = NULL; + BOOL (WINAPI* _VerQueryValue)(const LPVOID, LPSTR, LPVOID*, PUINT) = NULL; *(FARPROC*)&_GetFileVersionInfo = GetProcAddress(hmVersion, "GetFileVersionInfoA"); *(FARPROC*)&_GetFileVersionInfoSize = GetProcAddress(hmVersion, "GetFileVersionInfoSizeA"); *(FARPROC*)&_VerQueryValue = GetProcAddress(hmVersion, "VerQueryValueA"); diff --git a/code/nel/src/misc/system_utils.cpp b/code/nel/src/misc/system_utils.cpp index 8f5c678f8..7ea9ad544 100644 --- a/code/nel/src/misc/system_utils.cpp +++ b/code/nel/src/misc/system_utils.cpp @@ -273,14 +273,14 @@ bool CSystemUtils::isScreensaverEnabled() // SystemParametersInfoA(SPI_GETSCREENSAVEACTIVE, 0, &bRetValue, 0); // res = (bRetValue == TRUE); HKEY hKeyScreenSaver = NULL; - LSTATUS lReturn = RegOpenKeyExA(HKEY_CURRENT_USER, TEXT("Control Panel\\Desktop"), 0, KEY_QUERY_VALUE, &hKeyScreenSaver); + LSTATUS lReturn = RegOpenKeyExA(HKEY_CURRENT_USER, "Control Panel\\Desktop", 0, KEY_QUERY_VALUE, &hKeyScreenSaver); if (lReturn == ERROR_SUCCESS) { DWORD dwType = 0L; DWORD dwSize = KeyMaxLength; unsigned char Buffer[KeyMaxLength] = {0}; - lReturn = RegQueryValueExA(hKeyScreenSaver, TEXT("SCRNSAVE.EXE"), NULL, &dwType, NULL, &dwSize); + lReturn = RegQueryValueExA(hKeyScreenSaver, "SCRNSAVE.EXE", NULL, &dwType, NULL, &dwSize); // if SCRNSAVE.EXE is present, check also if it's empty if (lReturn == ERROR_SUCCESS) res = (Buffer[0] != '\0'); diff --git a/code/nel/src/misc/win_displayer.cpp b/code/nel/src/misc/win_displayer.cpp index 48a8f20c7..e81b7623e 100644 --- a/code/nel/src/misc/win_displayer.cpp +++ b/code/nel/src/misc/win_displayer.cpp @@ -40,7 +40,7 @@ using namespace std; namespace NLMISC { -static CHARFORMAT2 CharFormat; +static CHARFORMAT2A CharFormat; CWinDisplayer::CWinDisplayer(const char *displayerName) : CWindowDisplayer(displayerName), Exit(false) { @@ -221,7 +221,7 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) ucs.fromUtf8(cwd->_History[cwd->_PosInHistory]); // set the text as unicode string SetWindowTextW(cwd->_HInputEdit, (LPCWSTR)ucs.c_str()); - SendMessage (cwd->_HInputEdit, EM_SETSEL, (WPARAM)ucs.size(), (LPARAM)ucs.size()); + SendMessageA (cwd->_HInputEdit, EM_SETSEL, (WPARAM)ucs.size(), (LPARAM)ucs.size()); } } else if (pmf->wParam == VK_DOWN) @@ -238,7 +238,7 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) ucs.fromUtf8(cwd->_History[cwd->_PosInHistory]); // set the text as unicode string SetWindowTextW(cwd->_HInputEdit, (LPCWSTR)ucs.c_str()); - SendMessage (cwd->_HInputEdit, EM_SETSEL, (WPARAM)ucs.size(), (LPARAM)ucs.size()); + SendMessageA (cwd->_HInputEdit, EM_SETSEL, (WPARAM)ucs.size(), (LPARAM)ucs.size()); } } } @@ -268,7 +268,7 @@ void CWinDisplayer::updateLabels () { access.value()[i].Hwnd = CreateWindowW (L"STATIC", L"", WS_CHILD | WS_VISIBLE | SS_SIMPLE, 0, 0, 0, 0, _HWnd, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(_HWnd, GWLP_HINSTANCE), NULL); } - SendMessage ((HWND)access.value()[i].Hwnd, WM_SETFONT, (WPARAM)_HFont, TRUE); + SendMessageA ((HWND)access.value()[i].Hwnd, WM_SETFONT, (WPARAM)_HFont, TRUE); needResize = true; } @@ -427,14 +427,14 @@ void CWinDisplayer::open (string titleBar, bool iconified, sint x, sint y, sint dwStyle |= WS_HSCROLL; _HEdit = CreateWindowExW(WS_EX_OVERLAPPEDWINDOW, RICHEDIT_CLASSW, L"", dwStyle, 0, _ToolBarHeight, w, h-_ToolBarHeight-_InputEditHeight, _HWnd, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(_HWnd, GWLP_HINSTANCE), NULL); - SendMessage (_HEdit, WM_SETFONT, (WPARAM)_HFont, TRUE); + SendMessageA (_HEdit, WM_SETFONT, (WPARAM)_HFont, TRUE); // set the edit text limit to lot of :) - SendMessage (_HEdit, EM_LIMITTEXT, -1, 0); + SendMessageA (_HEdit, EM_LIMITTEXT, -1, 0); CharFormat.cbSize = sizeof(CharFormat); CharFormat.dwMask = CFM_COLOR; - SendMessage(_HEdit,EM_GETCHARFORMAT,(WPARAM)0,(LPARAM)&CharFormat); + SendMessageA(_HEdit,EM_GETCHARFORMAT,(WPARAM)0,(LPARAM)&CharFormat); CharFormat.dwEffects &= ~CFE_AUTOCOLOR; // create the input edit control @@ -445,7 +445,7 @@ void CWinDisplayer::open (string titleBar, bool iconified, sint x, sint y, sint LRESULT dwEvent = SendMessageW(_HInputEdit, EM_GETEVENTMASK, (WPARAM)0, (LPARAM)0); dwEvent |= ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_CHANGE; - SendMessage(_HInputEdit, EM_SETEVENTMASK, (WPARAM)0, (LPARAM)dwEvent); + SendMessageA(_HInputEdit, EM_SETEVENTMASK, (WPARAM)0, (LPARAM)dwEvent); // resize the window RECT rc; @@ -477,8 +477,8 @@ void CWinDisplayer::clear () bool focus = (GetFocus() == _HEdit); if (focus) { - SendMessage(_HEdit,EM_SETOPTIONS,ECOOP_AND,(LPARAM)~ECO_AUTOVSCROLL); - SendMessage(_HEdit,EM_SETOPTIONS,ECOOP_AND,(LPARAM)~ECO_AUTOHSCROLL); + SendMessageA(_HEdit,EM_SETOPTIONS,ECOOP_AND,(LPARAM)~ECO_AUTOVSCROLL); + SendMessageA(_HEdit,EM_SETOPTIONS,ECOOP_AND,(LPARAM)~ECO_AUTOHSCROLL); } // get number of line @@ -534,13 +534,13 @@ void CWinDisplayer::display_main () bool focus = (GetFocus() == _HEdit); if (focus) { - SendMessage(_HEdit,EM_SETOPTIONS,ECOOP_AND,(LPARAM)~ECO_AUTOVSCROLL); - SendMessage(_HEdit,EM_SETOPTIONS,ECOOP_AND,(LPARAM)~ECO_AUTOHSCROLL); + SendMessageA(_HEdit,EM_SETOPTIONS,ECOOP_AND,(LPARAM)~ECO_AUTOVSCROLL); + SendMessageA(_HEdit,EM_SETOPTIONS,ECOOP_AND,(LPARAM)~ECO_AUTOHSCROLL); } // store old selection DWORD startSel, endSel; - SendMessage (_HEdit, EM_GETSEL, (WPARAM)&startSel, (LPARAM)&endSel); + SendMessageA (_HEdit, EM_GETSEL, (WPARAM)&startSel, (LPARAM)&endSel); // find how many lines we have to remove in the current output to add new lines @@ -554,7 +554,7 @@ void CWinDisplayer::display_main () if (nblineremove == _HistorySize) { - SendMessage (_HEdit, WM_SETTEXT, 0, (LPARAM) ""); + SendMessageA (_HEdit, WM_SETTEXT, 0, (LPARAM) ""); startSel = endSel = -1; } else @@ -594,13 +594,13 @@ void CWinDisplayer::display_main () str += ucstring::makeFromUtf8((*it).second); } - SendMessage (_HEdit, EM_SETSEL, -1, -1); + SendMessageA(_HEdit, EM_SETSEL, -1, -1); if ((col>>24) == 0) { // there s a specific color CharFormat.crTextColor = RGB ((col>>16)&0xFF, (col>>8)&0xFF, col&0xFF); - SendMessage((HWND) _HEdit, EM_SETCHARFORMAT, (WPARAM) SCF_SELECTION, (LPARAM) &CharFormat); + SendMessageA(_HEdit, EM_SETCHARFORMAT, (WPARAM) SCF_SELECTION, (LPARAM) &CharFormat); } // add the string to the edit control @@ -608,17 +608,17 @@ void CWinDisplayer::display_main () } // restore old selection - SendMessage (_HEdit, EM_SETSEL, startSel, endSel); + SendMessageA(_HEdit, EM_SETSEL, startSel, endSel); - SendMessage(_HEdit,EM_SETMODIFY,(WPARAM)TRUE,(LPARAM)0); + SendMessageA(_HEdit,EM_SETMODIFY,(WPARAM)TRUE,(LPARAM)0); if (bottom) - SendMessage(_HEdit,WM_VSCROLL,(WPARAM)SB_BOTTOM,(LPARAM)0L); + SendMessageA(_HEdit,WM_VSCROLL,(WPARAM)SB_BOTTOM,(LPARAM)0L); if (focus) { - SendMessage(_HEdit,EM_SETOPTIONS,ECOOP_OR,(LPARAM)ECO_AUTOVSCROLL); - SendMessage(_HEdit,EM_SETOPTIONS,ECOOP_OR,(LPARAM)ECO_AUTOHSCROLL); + SendMessageA(_HEdit,EM_SETOPTIONS,ECOOP_OR,(LPARAM)ECO_AUTOVSCROLL); + SendMessageA(_HEdit,EM_SETOPTIONS,ECOOP_OR,(LPARAM)ECO_AUTOHSCROLL); } } diff --git a/code/nel/src/misc/win_thread.cpp b/code/nel/src/misc/win_thread.cpp index 2bdb5ea3b..f8063b6b7 100644 --- a/code/nel/src/misc/win_thread.cpp +++ b/code/nel/src/misc/win_thread.cpp @@ -373,7 +373,7 @@ bool CPSAPILib::init() if (_LoadFailed) return false; if (!_PSAPILibHandle) { - _PSAPILibHandle = LoadLibrary("psapi.dll"); + _PSAPILibHandle = LoadLibraryA("psapi.dll"); if (!_PSAPILibHandle) { nlwarning("couldn't load psapi.dll, possibly not supported by os"); diff --git a/code/ryzom/client/src/init.cpp b/code/ryzom/client/src/init.cpp index a203614e4..864451718 100644 --- a/code/ryzom/client/src/init.cpp +++ b/code/ryzom/client/src/init.cpp @@ -271,7 +271,7 @@ static INT_PTR CALLBACK ExitClientErrorDialogProc(HWND hwndDlg, UINT uMsg, WPARA GetWindowRect (GetDesktopWindow (), &rectDesktop); SetWindowPos (hwndDlg, HWND_TOPMOST, (rectDesktop.right-rectDesktop.left-rect.right+rect.left)/2, (rectDesktop.bottom-rectDesktop.top-rect.bottom+rect.top)/2, 0, 0, SWP_NOSIZE); HICON exitClientDlgIcon = LoadIcon(HInstance, MAKEINTRESOURCE(IDI_MAIN_ICON)); - ::SendMessage(hwndDlg, WM_SETICON, (WPARAM) ICON_BIG, (LPARAM) exitClientDlgIcon); + ::SendMessageA(hwndDlg, WM_SETICON, (WPARAM) ICON_BIG, (LPARAM) exitClientDlgIcon); } break; case WM_COMMAND: