Commit 0d4fff4f authored by Stefan Leichter's avatar Stefan Leichter Committed by Alexandre Julliard

Moved implementation of GetModuleBaseName from ascii to unicode, added

some tests for GetModuleBaseNameA.
parent 1117e69c
......@@ -20093,7 +20093,7 @@ MAKE_LIB_RULES=libs/Makelib.rules
MAKE_PROG_RULES=programs/Makeprog.rules
ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules dlls/Maketest.rules libs/Makelib.rules programs/Makeprog.rules Makefile dlls/Makefile dlls/advapi32/Makefile dlls/advapi32/tests/Makefile dlls/amstream/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/cabinet/Makefile dlls/capi2032/Makefile dlls/cards/Makefile dlls/cfgmgr32/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/comctl32/tests/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/ctl3d/Makefile dlls/d3d8/Makefile dlls/d3d9/Makefile dlls/d3dim/Makefile dlls/d3drm/Makefile dlls/d3dx8/Makefile dlls/d3dxof/Makefile dlls/dbghelp/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/ddraw/tests/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dinput8/Makefile dlls/dmband/Makefile dlls/dmcompos/Makefile dlls/dmime/Makefile dlls/dmloader/Makefile dlls/dmscript/Makefile dlls/dmstyle/Makefile dlls/dmsynth/Makefile dlls/dmusic/Makefile dlls/dmusic32/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dpnet/Makefile dlls/dpnhpast/Makefile dlls/dsound/Makefile dlls/dsound/tests/Makefile dlls/dswave/Makefile dlls/dxdiagn/Makefile dlls/dxerr8/Makefile dlls/dxerr9/Makefile dlls/dxguid/Makefile dlls/gdi/Makefile dlls/gdi/tests/Makefile dlls/glu32/Makefile dlls/glut32/Makefile dlls/hhctrl.ocx/Makefile dlls/iccvid/Makefile dlls/icmp/Makefile dlls/ifsmgr.vxd/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/iphlpapi/Makefile dlls/iphlpapi/tests/Makefile dlls/kernel/Makefile dlls/kernel/tests/Makefile dlls/lzexpand/Makefile dlls/mapi32/Makefile dlls/mapi32/tests/Makefile dlls/mmdevldr.vxd/Makefile dlls/monodebg.vxd/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msacm/imaadp32/Makefile dlls/msacm/msadp32/Makefile dlls/msacm/msg711/Makefile dlls/msacm/winemp3/Makefile dlls/msacm/tests/Makefile dlls/msdmo/Makefile dlls/mshtml/Makefile dlls/msi/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Makefile dlls/msrle32/Makefile dlls/msvcrt/Makefile dlls/msvcrt/tests/Makefile dlls/msvcrt20/Makefile dlls/msvcrt40/Makefile dlls/msvcrtd/Makefile dlls/msvcrtd/tests/Makefile dlls/msvidc32/Makefile dlls/msvideo/Makefile dlls/mswsock/Makefile dlls/netapi32/Makefile dlls/netapi32/tests/Makefile dlls/newdev/Makefile dlls/ntdll/Makefile dlls/ntdll/tests/Makefile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/oleacc/Makefile dlls/oleaut32/Makefile dlls/oleaut32/tests/Makefile dlls/olecli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Makefile dlls/opengl32/Makefile dlls/psapi/Makefile dlls/qcap/Makefile dlls/quartz/Makefile dlls/rasapi32/Makefile dlls/richedit/Makefile dlls/rpcrt4/Makefile dlls/rpcrt4/tests/Makefile dlls/rsabase/Makefile dlls/secur32/Makefile dlls/serialui/Makefile dlls/setupapi/Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shell32/tests/Makefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/shlwapi/tests/Makefile dlls/snmpapi/Makefile dlls/sti/Makefile dlls/tapi32/Makefile dlls/ttydrv/Makefile dlls/twain/Makefile dlls/unicows/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/urlmon/tests/Makefile dlls/user/Makefile dlls/user/tests/Makefile dlls/uuid/Makefile dlls/uxtheme/Makefile dlls/vdhcp.vxd/Makefile dlls/vdmdbg/Makefile dlls/version/Makefile dlls/version/tests/Makefile dlls/vmm.vxd/Makefile dlls/vnbt.vxd/Makefile dlls/vnetbios.vxd/Makefile dlls/vtdapi.vxd/Makefile dlls/vwin32.vxd/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/wined3d/Makefile dlls/winedos/Makefile dlls/wineps/Makefile dlls/wininet/Makefile dlls/wininet/tests/Makefile dlls/winmm/Makefile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/mciavi/Makefile dlls/winmm/mcicda/Makefile dlls/winmm/mciseq/Makefile dlls/winmm/mciwave/Makefile dlls/winmm/midimap/Makefile dlls/winmm/tests/Makefile dlls/winmm/wavemap/Makefile dlls/winmm/winealsa/Makefile dlls/winmm/winearts/Makefile dlls/winmm/wineaudioio/Makefile dlls/winmm/winejack/Makefile dlls/winmm/winenas/Makefile dlls/winmm/wineoss/Makefile dlls/winnls/Makefile dlls/winsock/Makefile dlls/winsock/tests/Makefile dlls/winspool/Makefile dlls/winspool/tests/Makefile dlls/wintab32/Makefile dlls/wintrust/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/x11drv/Makefile documentation/Makefile include/Makefile libs/Makefile libs/port/Makefile libs/unicode/Makefile libs/wine/Makefile libs/wpp/Makefile loader/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/expand/Makefile programs/notepad/Makefile programs/progman/Makefile programs/regedit/Makefile programs/regsvr32/Makefile programs/rpcss/Makefile programs/rundll32/Makefile programs/start/Makefile programs/taskmgr/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineboot/Makefile programs/winebrowser/Makefile programs/winecfg/Makefile programs/wineconsole/Makefile programs/winedbg/Makefile programs/winefile/Makefile programs/winemenubuilder/Makefile programs/winemine/Makefile programs/winepath/Makefile programs/winetest/Makefile programs/winevdm/Makefile programs/winhelp/Makefile programs/winver/Makefile server/Makefile tools/Makefile tools/widl/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/winegcc/Makefile tools/wmc/Makefile tools/wrc/Makefile"
ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules dlls/Maketest.rules libs/Makelib.rules programs/Makeprog.rules Makefile dlls/Makefile dlls/advapi32/Makefile dlls/advapi32/tests/Makefile dlls/amstream/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/cabinet/Makefile dlls/capi2032/Makefile dlls/cards/Makefile dlls/cfgmgr32/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/comctl32/tests/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/ctl3d/Makefile dlls/d3d8/Makefile dlls/d3d9/Makefile dlls/d3dim/Makefile dlls/d3drm/Makefile dlls/d3dx8/Makefile dlls/d3dxof/Makefile dlls/dbghelp/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/ddraw/tests/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dinput8/Makefile dlls/dmband/Makefile dlls/dmcompos/Makefile dlls/dmime/Makefile dlls/dmloader/Makefile dlls/dmscript/Makefile dlls/dmstyle/Makefile dlls/dmsynth/Makefile dlls/dmusic/Makefile dlls/dmusic32/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dpnet/Makefile dlls/dpnhpast/Makefile dlls/dsound/Makefile dlls/dsound/tests/Makefile dlls/dswave/Makefile dlls/dxdiagn/Makefile dlls/dxerr8/Makefile dlls/dxerr9/Makefile dlls/dxguid/Makefile dlls/gdi/Makefile dlls/gdi/tests/Makefile dlls/glu32/Makefile dlls/glut32/Makefile dlls/hhctrl.ocx/Makefile dlls/iccvid/Makefile dlls/icmp/Makefile dlls/ifsmgr.vxd/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/iphlpapi/Makefile dlls/iphlpapi/tests/Makefile dlls/kernel/Makefile dlls/kernel/tests/Makefile dlls/lzexpand/Makefile dlls/mapi32/Makefile dlls/mapi32/tests/Makefile dlls/mmdevldr.vxd/Makefile dlls/monodebg.vxd/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msacm/imaadp32/Makefile dlls/msacm/msadp32/Makefile dlls/msacm/msg711/Makefile dlls/msacm/winemp3/Makefile dlls/msacm/tests/Makefile dlls/msdmo/Makefile dlls/mshtml/Makefile dlls/msi/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Makefile dlls/msrle32/Makefile dlls/msvcrt/Makefile dlls/msvcrt/tests/Makefile dlls/msvcrt20/Makefile dlls/msvcrt40/Makefile dlls/msvcrtd/Makefile dlls/msvcrtd/tests/Makefile dlls/msvidc32/Makefile dlls/msvideo/Makefile dlls/mswsock/Makefile dlls/netapi32/Makefile dlls/netapi32/tests/Makefile dlls/newdev/Makefile dlls/ntdll/Makefile dlls/ntdll/tests/Makefile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/oleacc/Makefile dlls/oleaut32/Makefile dlls/oleaut32/tests/Makefile dlls/olecli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Makefile dlls/opengl32/Makefile dlls/psapi/Makefile dlls/psapi/tests/Makefile dlls/qcap/Makefile dlls/quartz/Makefile dlls/rasapi32/Makefile dlls/richedit/Makefile dlls/rpcrt4/Makefile dlls/rpcrt4/tests/Makefile dlls/rsabase/Makefile dlls/secur32/Makefile dlls/serialui/Makefile dlls/setupapi/Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shell32/tests/Makefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/shlwapi/tests/Makefile dlls/snmpapi/Makefile dlls/sti/Makefile dlls/tapi32/Makefile dlls/ttydrv/Makefile dlls/twain/Makefile dlls/unicows/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/urlmon/tests/Makefile dlls/user/Makefile dlls/user/tests/Makefile dlls/uuid/Makefile dlls/uxtheme/Makefile dlls/vdhcp.vxd/Makefile dlls/vdmdbg/Makefile dlls/version/Makefile dlls/version/tests/Makefile dlls/vmm.vxd/Makefile dlls/vnbt.vxd/Makefile dlls/vnetbios.vxd/Makefile dlls/vtdapi.vxd/Makefile dlls/vwin32.vxd/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/wined3d/Makefile dlls/winedos/Makefile dlls/wineps/Makefile dlls/wininet/Makefile dlls/wininet/tests/Makefile dlls/winmm/Makefile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/mciavi/Makefile dlls/winmm/mcicda/Makefile dlls/winmm/mciseq/Makefile dlls/winmm/mciwave/Makefile dlls/winmm/midimap/Makefile dlls/winmm/tests/Makefile dlls/winmm/wavemap/Makefile dlls/winmm/winealsa/Makefile dlls/winmm/winearts/Makefile dlls/winmm/wineaudioio/Makefile dlls/winmm/winejack/Makefile dlls/winmm/winenas/Makefile dlls/winmm/wineoss/Makefile dlls/winnls/Makefile dlls/winsock/Makefile dlls/winsock/tests/Makefile dlls/winspool/Makefile dlls/winspool/tests/Makefile dlls/wintab32/Makefile dlls/wintrust/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/x11drv/Makefile documentation/Makefile include/Makefile libs/Makefile libs/port/Makefile libs/unicode/Makefile libs/wine/Makefile libs/wpp/Makefile loader/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/expand/Makefile programs/notepad/Makefile programs/progman/Makefile programs/regedit/Makefile programs/regsvr32/Makefile programs/rpcss/Makefile programs/rundll32/Makefile programs/start/Makefile programs/taskmgr/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineboot/Makefile programs/winebrowser/Makefile programs/winecfg/Makefile programs/wineconsole/Makefile programs/winedbg/Makefile programs/winefile/Makefile programs/winemenubuilder/Makefile programs/winemine/Makefile programs/winepath/Makefile programs/winetest/Makefile programs/winevdm/Makefile programs/winhelp/Makefile programs/winver/Makefile server/Makefile tools/Makefile tools/widl/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/winegcc/Makefile tools/wmc/Makefile tools/wrc/Makefile"
cat >confcache <<\_ACEOF
......@@ -20738,6 +20738,7 @@ do
"dlls/olesvr/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/olesvr/Makefile" ;;
"dlls/opengl32/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/opengl32/Makefile" ;;
"dlls/psapi/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/psapi/Makefile" ;;
"dlls/psapi/tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/psapi/tests/Makefile" ;;
"dlls/qcap/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/qcap/Makefile" ;;
"dlls/quartz/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/quartz/Makefile" ;;
"dlls/rasapi32/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/rasapi32/Makefile" ;;
......
......@@ -1599,6 +1599,7 @@ dlls/olepro32/Makefile
dlls/olesvr/Makefile
dlls/opengl32/Makefile
dlls/psapi/Makefile
dlls/psapi/tests/Makefile
dlls/qcap/Makefile
dlls/quartz/Makefile
dlls/rasapi32/Makefile
......
......@@ -8,6 +8,8 @@ IMPORTS = kernel32 ntdll
C_SRCS = \
psapi_main.c
SUBDIRS = tests
@MAKE_DLL_RULES@
### Dependencies:
......@@ -25,6 +25,7 @@
#include "winbase.h"
#include "winerror.h"
#include "wine/server.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "winnls.h"
#include "psapi.h"
......@@ -291,15 +292,24 @@ DWORD WINAPI GetMappedFileNameW(HANDLE hProcess, LPVOID lpv, LPWSTR lpFilename,
DWORD WINAPI GetModuleBaseNameA(HANDLE hProcess, HMODULE hModule,
LPSTR lpBaseName, DWORD nSize)
{
char tmp[MAX_PATH];
char* ptr;
WCHAR *lpBaseNameW;
DWORD buflenW, ret = 0;
if (!GetModuleFileNameExA(hProcess, hModule, tmp, sizeof(tmp)))
if(!lpBaseName || !nSize) {
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
if ((ptr = strrchr(tmp, '\\')) != NULL) ptr++; else ptr = tmp;
strncpy(lpBaseName, ptr, nSize);
lpBaseName[nSize - 1] = '\0';
return strlen(lpBaseName);
}
lpBaseNameW = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * nSize);
buflenW = GetModuleBaseNameW(hProcess, hModule, lpBaseNameW, nSize);
TRACE("%ld, %s\n", buflenW, debugstr_w(lpBaseNameW));
if (buflenW)
{
ret = WideCharToMultiByte(CP_ACP, 0, lpBaseNameW, buflenW,
lpBaseName, nSize, NULL, NULL);
if (ret < nSize) lpBaseName[ret] = 0;
}
HeapFree(GetProcessHeap(), 0, lpBaseNameW);
return ret;
}
/***********************************************************************
......@@ -308,30 +318,21 @@ DWORD WINAPI GetModuleBaseNameA(HANDLE hProcess, HMODULE hModule,
DWORD WINAPI GetModuleBaseNameW(HANDLE hProcess, HMODULE hModule,
LPWSTR lpBaseName, DWORD nSize)
{
char* ptr;
DWORD len;
TRACE("(hProcess=%p, hModule=%p, %p, %ld)\n",
hProcess, hModule, lpBaseName, nSize);
if (!lpBaseName || !nSize) return 0;
ptr = HeapAlloc(GetProcessHeap(), 0, nSize / 2);
if (!ptr) return 0;
WCHAR tmp[MAX_PATH];
WCHAR* ptr;
len = GetModuleBaseNameA(hProcess, hModule, ptr, nSize / 2);
if (len == 0)
{
lpBaseName[0] = '\0';
}
else
{
if (!MultiByteToWideChar( CP_ACP, 0, ptr, -1, lpBaseName, nSize / 2 ))
lpBaseName[nSize / 2 - 1] = 0;
if(!lpBaseName || !nSize) {
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
HeapFree(GetProcessHeap(), 0, ptr);
return len;
if (!GetModuleFileNameExW(hProcess, hModule, tmp,
sizeof(tmp)/sizeof(WCHAR)))
return 0;
TRACE("%s\n", debugstr_w(tmp));
if ((ptr = strrchrW(tmp, '\\')) != NULL) ptr++; else ptr = tmp;
strncpyW(lpBaseName, ptr, nSize);
return min(strlenW(ptr), nSize);
}
/***********************************************************************
......@@ -387,6 +388,7 @@ DWORD WINAPI GetModuleFileNameExW(HANDLE hProcess, HMODULE hModule,
{
DWORD len = GetModuleFileNameW( hModule, lpFileName, nSize );
if (nSize) lpFileName[nSize - 1] = '\0';
TRACE("return (cur) %s (%lu)\n", debugstr_w(lpFileName), len);
return len;
}
......
Makefile
module.ok
testlist.c
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../../..
SRCDIR = @srcdir@
VPATH = @srcdir@
TESTDLL = psapi.dll
IMPORTS = psapi kernel32
CTESTS = \
module.c
@MAKE_TEST_RULES@
### Dependencies:
/*
* Copyright (C) 2004 Stefan Leichter
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdarg.h>
#include "wine/test.h"
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "wingdi.h"
#include "psapi.h"
/* Function ptrs */
static HMODULE dll;
static DWORD (WINAPI *pGetModuleBaseNameA)(HANDLE, HANDLE, LPSTR, DWORD);
static void test_module_base_name(void)
{ DWORD retval;
char buffer[MAX_PATH];
HMODULE self, modself;
DWORD exact;
if (!pGetModuleBaseNameA) return;
self = OpenProcess( PROCESS_QUERY_INFORMATION|PROCESS_VM_READ,
FALSE, GetCurrentProcessId());
if (!self) {
ok(0, "OpenProcess() failed\n");
return;
}
modself = GetModuleHandle(NULL);
if (!modself) {
ok(0, "GetModuleHandle() failed\n");
return;
}
exact = pGetModuleBaseNameA( self, modself, buffer, MAX_PATH);
if (!exact) {
ok(0, "GetModuleBaseNameA failed unexpected with error 0x%08lx\n",
GetLastError());
return;
}
SetLastError(ERROR_SUCCESS);
retval = pGetModuleBaseNameA( NULL, NULL, NULL, 0);
ok(!retval, "function result wrong, got %ld expected 0\n", retval);
ok(ERROR_INVALID_PARAMETER == GetLastError(),
"last error wrong, got 0x%08lx expected ERROR_INVALID_PARAMETER\n",
GetLastError());
SetLastError(ERROR_SUCCESS);
retval = pGetModuleBaseNameA( NULL, NULL, NULL, MAX_PATH);
ok(!retval, "function result wrong, got %ld expected 0\n", retval);
ok(ERROR_INVALID_PARAMETER == GetLastError(),
"last error wrong, got 0x%08lx expected ERROR_INVALID_PARAMETER\n",
GetLastError());
SetLastError(ERROR_SUCCESS);
retval = pGetModuleBaseNameA( NULL, NULL, buffer, 0);
ok(!retval, "function result wrong, got %ld expected 0\n", retval);
ok(ERROR_INVALID_PARAMETER == GetLastError(),
"last error wrong, got 0x%08lx expected ERROR_INVALID_PARAMETER\n",
GetLastError());
memset(buffer, 0, sizeof(buffer));
SetLastError(ERROR_SUCCESS);
retval = pGetModuleBaseNameA( NULL, NULL, buffer, 1);
ok(!retval, "function result wrong, got %ld expected 0\n", retval);
ok(ERROR_INVALID_HANDLE == GetLastError(),
"last error wrong, got 0x%08lx expected ERROR_INVALID_HANDLE\n",
GetLastError());
memset(buffer, 0, sizeof(buffer));
SetLastError(ERROR_SUCCESS);
/* GetModuleFileNameEx may need to be fixed first ? */
retval = pGetModuleBaseNameA( self, NULL, buffer, 1);
todo_wine ok(retval == 1, "function result wrong, got %ld expected 1\n", retval);
todo_wine ok(ERROR_SUCCESS == GetLastError(),
"last error wrong, got 0x%08lx expected ERROR_SUCCESS\n",
GetLastError());
todo_wine ok(1 == strlen(buffer),
"buffer content length wrong, got %d(%s) expected 1\n",
strlen(buffer), buffer);
memset(buffer, 0, sizeof(buffer));
SetLastError(ERROR_SUCCESS);
retval = pGetModuleBaseNameA( self, modself, buffer, 1);
ok(retval == 1, "function result wrong, got %ld expected 1\n", retval);
ok(ERROR_SUCCESS == GetLastError(),
"last error wrong, got 0x%08lx expected ERROR_SUCCESS\n",
GetLastError());
ok(1 == strlen(buffer),
"buffer content length wrong, got %d(%s) expected 1\n",
strlen(buffer), buffer);
SetLastError(ERROR_SUCCESS);
memset(buffer, 0, sizeof(buffer));
retval = pGetModuleBaseNameA( self, NULL, buffer, exact);
/* GetModuleFileNameEx may need to be fixed first ? */
todo_wine ok(retval == exact,
"function result wrong, got %ld expected %ld\n", retval, exact);
todo_wine ok(ERROR_SUCCESS == GetLastError(),
"last error wrong, got 0x%08lx expected ERROR_SUCCESS\n",
GetLastError());
todo_wine ok(exact == strlen(buffer),
"buffer content length wrong, got %d(%s) expected %ld\n",
strlen(buffer), buffer, exact);
SetLastError(ERROR_SUCCESS);
memset(buffer, 0, sizeof(buffer));
retval = pGetModuleBaseNameA( self, modself, buffer, exact);
ok(retval == exact,
"function result wrong, got %ld expected %ld\n", retval, exact);
ok(ERROR_SUCCESS == GetLastError(),
"last error wrong, got 0x%08lx expected ERROR_SUCCESS\n",
GetLastError());
ok(exact == strlen(buffer),
"buffer content length wrong, got %d(%s) expected %ld\n",
strlen(buffer), buffer, exact);
}
START_TEST(module)
{
dll = LoadLibrary("psapi.dll");
ok(dll != 0, "LoadLibraryA failed\n");
if (!dll) return;
pGetModuleBaseNameA = (void*) GetProcAddress(dll, "GetModuleBaseNameA");
test_module_base_name();
FreeLibrary(dll);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment