Fix exehead unicode compil warnings

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6048 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
wizou 2010-04-13 15:01:14 +00:00
parent 64a0f32e52
commit f5df185ba2
4 changed files with 56 additions and 17 deletions

View file

@ -492,7 +492,7 @@ void RenameViaWininit(const TCHAR* prevName, const TCHAR* newName)
char *pszNextSec = mystrstriA(pszFirstRenameLine,"\n[");
if (pszNextSec)
{
TCHAR *p = ++pszNextSec;
char *p = ++pszNextSec;
while (p < pszWinInit + dwFileSize) {
p[cchRenameLine] = *p;
p++;
@ -1031,3 +1031,25 @@ void NSISCALL MessageLoop(UINT uCheckedMsg)
while (PeekMessage(&msg, NULL, uCheckedMsg, uCheckedMsg, PM_REMOVE))
DispatchMessage(&msg);
}
/**
* This function is useful for Unicode support. Since the Windows
* GetProcAddress function always takes a char*, this function wraps
* the windows call and does the appropriate translation when
* appropriate.
*
* @param dllHandle Handle to the DLL loaded by LoadLibraryEx.
* @param funcName The name of the function to get the address of.
* @return The pointer to the function. Null if failure.
*/
void * NSISCALL NSISGetProcAddress(HANDLE dllHandle, TCHAR* funcName)
{
#ifdef _UNICODE
char ansiName[NSIS_MAX_STRLEN];
if (WideCharToMultiByte(CP_ACP, 0, funcName, -1, ansiName, NSIS_MAX_STRLEN, NULL, NULL) != 0)
return GetProcAddress(dllHandle, ansiName);
return NULL;
#else
return GetProcAddress(dllHandle, funcName);
#endif
}