Don't print NULL strings (crashes on Solaris).

Small code maintainability tweak in ShellExecuteExA.
Two typo fixes in winmm.
This commit is contained in:
Francois Gouget 2001-10-14 16:15:05 +00:00 committed by Alexandre Julliard
parent bc7d0272b3
commit b60c4ce0f0
8 changed files with 25 additions and 22 deletions

View File

@ -1503,7 +1503,7 @@ DWORD _ILSimpleGetText (LPCITEMIDLIST pidl, LPSTR szOut, UINT uOutSize)
ERR("-- no text\n");
}
TRACE("-- (%p=%s 0x%08lx)\n",szOut,(char*)szOut,dwReturn);
TRACE("-- (%p=%s 0x%08lx)\n",szOut,debugstr_a(szOut),dwReturn);
return dwReturn;
}

View File

@ -37,7 +37,7 @@ DWORD WINAPI ParseFieldA(
LPSTR dst,
DWORD len)
{
WARN("('%s',0x%08lx,%p,%ld) semi-stub.\n",src,nField,dst,len);
WARN("(%s,0x%08lx,%p,%ld) semi-stub.\n",debugstr_a(src),nField,dst,len);
if (!src || !src[0] || !dst || !len)
return 0;
@ -973,9 +973,10 @@ BOOL WINAPI ShellExecuteExA (LPSHELLEXECUTEINFOA sei)
PROCESS_INFORMATION info;
WARN("mask=0x%08lx hwnd=0x%04x verb=%s file=%s parm=%s dir=%s show=0x%08x class=%s incomplete\n",
sei->fMask, sei->hwnd, sei->lpVerb, sei->lpFile,
sei->lpParameters, sei->lpDirectory, sei->nShow,
(sei->fMask & SEE_MASK_CLASSNAME) ? sei->lpClass : "not used");
sei->fMask, sei->hwnd, debugstr_a(sei->lpVerb),
debugstr_a(sei->lpFile), debugstr_a(sei->lpParameters),
debugstr_a(sei->lpDirectory), sei->nShow,
(sei->fMask & SEE_MASK_CLASSNAME) ? debugstr_a(sei->lpClass) : "not used");
ZeroMemory(szApplicationName,MAX_PATH);
if (sei->lpFile)
@ -996,8 +997,9 @@ BOOL WINAPI ShellExecuteExA (LPSHELLEXECUTEINFOA sei)
/* launch a document by fileclass like 'Wordpad.Document.1' */
if (sei->fMask & SEE_MASK_CLASSNAME)
{
/* FIXME: szCommandline should not be of a fixed size. Plus MAX_PATH is way too short! */
/* the commandline contains 'c:\Path\wordpad.exe "%1"' */
HCR_GetExecuteCommand(sei->lpClass, (sei->lpVerb) ? sei->lpVerb : "open", szCommandline, 256);
HCR_GetExecuteCommand(sei->lpClass, (sei->lpVerb) ? sei->lpVerb : "open", szCommandline, sizeof(szCommandline));
/* fixme: get the extension of lpFile, check if it fits to the lpClass */
TRACE("SEE_MASK_CLASSNAME->'%s'\n", szCommandline);
}

View File

@ -149,8 +149,8 @@ void COMM_Init(void)
else {
COM[x].handle = 0;
strcpy(COM[x].devicename, temp);
TRACE("%s = %s\n", option, COM[x].devicename);
}
TRACE("%s = %s\n", option, COM[x].devicename);
}
strcpy(option, "LPTx");
@ -176,8 +176,8 @@ void COMM_Init(void)
else {
LPT[x].handle = 0;
strcpy(LPT[x].devicename, temp);
TRACE("%s = %s\n", option, LPT[x].devicename);
}
TRACE("%s = %s\n", option, LPT[x].devicename);
}
}

View File

@ -329,7 +329,7 @@ LPWINE_DRIVER DRIVER_TryOpenDriver32(LPCSTR fn, LPARAM lParam2)
LPSTR ptr;
LPCSTR cause = 0;
TRACE("('%s', %08lX);\n", fn, lParam2);
TRACE("(%s, %08lX);\n", debugstr_a(fn), lParam2);
if ((ptr = strchr(fn, ' ')) != NULL) {
*ptr++ = '\0';
@ -349,14 +349,14 @@ LPWINE_DRIVER DRIVER_TryOpenDriver32(LPCSTR fn, LPARAM lParam2)
lpDrv->d.d32.hModule = hModule;
lpDrv->d.d32.dwDriverID = 0;
if (!DRIVER_AddToList(lpDrv, (LPARAM)ptr, lParam2)) {cause = "load faile"; goto exit;}
if (!DRIVER_AddToList(lpDrv, (LPARAM)ptr, lParam2)) {cause = "load failed"; goto exit;}
TRACE("=> %p\n", lpDrv);
return lpDrv;
exit:
FreeLibrary(hModule);
HeapFree(GetProcessHeap(), 0, lpDrv);
TRACE("Unable to load 32 bit module \"%s\": %s\n", fn, cause);
TRACE("Unable to load 32 bit module %s: %s\n", debugstr_a(fn), cause);
return NULL;
}
@ -370,7 +370,7 @@ static LPWINE_DRIVER DRIVER_TryOpenDriver16(LPCSTR fn, LPCSTR sn, LPARAM lParam2
LPWINE_DRIVER lpDrv = NULL;
LPCSTR cause = 0;
TRACE("('%s', %08lX);\n", sn, lParam2);
TRACE("(%s, %08lX);\n", debugstr_a(sn), lParam2);
lpDrv = HeapAlloc(GetProcessHeap(), 0, sizeof(WINE_DRIVER));
if (lpDrv == NULL) {cause = "OOM"; goto exit;}
@ -384,13 +384,13 @@ static LPWINE_DRIVER DRIVER_TryOpenDriver16(LPCSTR fn, LPCSTR sn, LPARAM lParam2
if (lpDrv->d.d16.hDriver16 == 0) {cause = "Not a 16 bit driver"; goto exit;}
lpDrv->dwFlags = WINE_GDF_16BIT;
if (!DRIVER_AddToList(lpDrv, 0, lParam2)) {cause = "load faile"; goto exit;}
if (!DRIVER_AddToList(lpDrv, 0, lParam2)) {cause = "load failed"; goto exit;}
TRACE("=> %p\n", lpDrv);
return lpDrv;
exit:
HeapFree(GetProcessHeap(), 0, lpDrv);
TRACE("Unable to load 32 bit module \"%s\": %s\n", fn, cause);
TRACE("Unable to load 32 bit module %s: %s\n", debugstr_a(fn), cause);
return NULL;
}
@ -421,7 +421,7 @@ HDRVR WINAPI OpenDriverA(LPCSTR lpDriverName, LPCSTR lpSectionName, LPARAM lPara
goto the_end;
if (!(lpDrv = DRIVER_TryOpenDriver16(lpDriverName, lpSectionName, lParam2)))
TRACE("Failed to open driver %s from system.ini file, section %s\n", lpDriverName, lpSectionName);
TRACE("Failed to open driver %s from system.ini file, section %s\n", debugstr_a(lpDriverName), debugstr_a(lpSectionName));
the_end:
if (lpDrv) TRACE("=> %08lx\n", (DWORD)lpDrv);
return (DWORD)lpDrv;

View File

@ -2395,14 +2395,14 @@ BOOL WINAPI AddPrinterDriverA(LPSTR pName, DWORD level, LPBYTE pDriverInfo)
DRIVER_INFO_3A di3;
HKEY hkeyDrivers, hkeyName;
TRACE("(%s,%ld,%p)\n",pName,level,pDriverInfo);
TRACE("(%s,%ld,%p)\n",debugstr_a(pName),level,pDriverInfo);
if(level != 2 && level != 3) {
SetLastError(ERROR_INVALID_LEVEL);
return FALSE;
}
if(pName != NULL) {
FIXME("pName= `%s' - unsupported\n", pName);
FIXME("pName= %s - unsupported\n", debugstr_a(pName));
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
@ -2440,7 +2440,7 @@ BOOL WINAPI AddPrinterDriverA(LPSTR pName, DWORD level, LPBYTE pDriverInfo)
if(RegOpenKeyA(hkeyDrivers, di3.pName, &hkeyName) == ERROR_SUCCESS) {
RegCloseKey(hkeyName);
RegCloseKey(hkeyDrivers);
WARN("Trying to create existing printer driver `%s'\n", di3.pName);
WARN("Trying to create existing printer driver %s\n", debugstr_a(di3.pName));
SetLastError(ERROR_PRINTER_DRIVER_ALREADY_INSTALLED);
return FALSE;
}

View File

@ -1045,7 +1045,7 @@ BOOL WINAPI CreateProcessA( LPCSTR lpApplicationName, LPSTR lpCommandLine,
/* Process the AppName and/or CmdLine to get module name and path */
TRACE("app '%s' cmdline '%s'\n", lpApplicationName, lpCommandLine );
TRACE("app %s cmdline %s\n", debugstr_a(lpApplicationName), debugstr_a(lpCommandLine) );
if (!(tidy_cmdline = get_file_name( lpApplicationName, lpCommandLine, name, sizeof(name) )))
return FALSE;

View File

@ -1737,7 +1737,8 @@ BOOL WINAPI CreateScalableFontResourceA( DWORD fHidden,
* lpszCurrentPath can be NULL
*/
FIXME("(%ld,%s,%s,%s): stub\n",
fHidden, lpszResourceFile, lpszFontFile, lpszCurrentPath );
fHidden, debugstr_a(lpszResourceFile), debugstr_a(lpszFontFile),
debugstr_a(lpszCurrentPath) );
return FALSE; /* create failed */
}

View File

@ -260,7 +260,7 @@ HDRVR16 WINAPI OpenDriver16(LPCSTR lpDriverName, LPCSTR lpSectionName, LPARAM lP
LPWINE_DRIVER lpDrv = NULL;
char drvName[128];
TRACE("('%s', '%s', %08lX);\n", lpDriverName, lpSectionName, lParam2);
TRACE("(%s, %s, %08lX);\n", debugstr_a(lpDriverName), debugstr_a(lpSectionName), lParam2);
if (!lpDriverName || !*lpDriverName) return 0;
@ -277,7 +277,7 @@ HDRVR16 WINAPI OpenDriver16(LPCSTR lpDriverName, LPCSTR lpSectionName, LPARAM lP
lpDrv = DRIVER_TryOpenDriver16(drvName, lParam2);
}
if (!lpDrv) {
TRACE("Failed to open driver %s from system.ini file, section %s\n", lpDriverName, lpSectionName);
TRACE("Failed to open driver %s from system.ini file, section %s\n", debugstr_a(lpDriverName), debugstr_a(lpSectionName));
return 0;
}
the_end: