Author: tfaber
Date: Sat Feb 2 11:31:30 2013
New Revision: 58265
URL:
http://svn.reactos.org/svn/reactos?rev=58265&view=rev
Log:
[EXPLORER_NEW]
- Do not use printf for startup debug messages
- Fix some (alas, not all) TCHAR misuse
Modified:
trunk/reactos/base/shell/explorer-new/explorer.c
trunk/reactos/base/shell/explorer-new/precomp.h
trunk/reactos/base/shell/explorer-new/startup.c
trunk/reactos/base/shell/explorer-new/trayntfy.c
Modified: trunk/reactos/base/shell/explorer-new/explorer.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer-new/ex…
==============================================================================
--- trunk/reactos/base/shell/explorer-new/explorer.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer-new/explorer.c [iso-8859-1] Sat Feb 2 11:31:30
2013
@@ -332,7 +332,7 @@
(LPVOID *)&lpszLocalBuf,
&cbLen) != 0)
{
- wcsncpy(szBuffer, lpszLocalBuf, cbBufLen);
+ _tcsncpy(szBuffer, lpszLocalBuf, cbBufLen /
sizeof(*szBuffer));
bRet = TRUE;
break;
Modified: trunk/reactos/base/shell/explorer-new/precomp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer-new/pr…
==============================================================================
--- trunk/reactos/base/shell/explorer-new/precomp.h [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer-new/precomp.h [iso-8859-1] Sat Feb 2 11:31:30 2013
@@ -79,12 +79,12 @@
}
#define ASSERT(cond) \
- if (!(cond)) { \
+ do if (!(cond)) { \
Win32DbgPrint(__FILE__, __LINE__, "ASSERTION %s FAILED!\n", #cond); \
- }
+ } while (0)
#define DbgPrint(fmt, ...) \
- Win32DbgPrint(__FILE__, __LINE__, fmt, ##__VA_ARGS__);
+ Win32DbgPrint(__FILE__, __LINE__, fmt, ##__VA_ARGS__)
extern HINSTANCE hExplorerInstance;
extern HMODULE hUser32;
Modified: trunk/reactos/base/shell/explorer-new/startup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer-new/st…
==============================================================================
--- trunk/reactos/base/shell/explorer-new/startup.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer-new/startup.c [iso-8859-1] Sat Feb 2 11:31:30 2013
@@ -75,12 +75,12 @@
if (!CreateProcessW(NULL, szCmdLineExp, NULL, NULL, FALSE, 0, NULL, dir, &si,
&info))
{
- printf("Failed to run command (%ld)\n", GetLastError());
+ DbgPrint("Failed to run command (%lu)\n", GetLastError());
return INVALID_RUNCMD_RETURN;
}
- printf("Successfully ran command\n");
+ DbgPrint("Successfully ran command\n");
if (wait)
{ /* wait for the process to exit */
@@ -114,9 +114,9 @@
WCHAR *szValue = NULL;
if (hkRoot == HKEY_LOCAL_MACHINE)
- wprintf(L"processing %s entries under HKLM\n", szKeyName);
+ DbgPrint("processing %ls entries under HKLM\n", szKeyName);
else
- wprintf(L"processing %s entries under HKCU\n", szKeyName);
+ DbgPrint("processing %ls entries under HKCU\n", szKeyName);
res = RegOpenKeyExW(hkRoot,
L"Software\\Microsoft\\Windows\\CurrentVersion",
@@ -125,8 +125,7 @@
&hkWin);
if (res != ERROR_SUCCESS)
{
- printf("RegOpenKey failed on Software\\Microsoft\\Windows\\CurrentVersion
(%ld)\n",
- res);
+ DbgPrint("RegOpenKey failed on Software\\Microsoft\\Windows\\CurrentVersion
(%ld)\n", res);
goto end;
}
@@ -140,12 +139,12 @@
{
if (res == ERROR_FILE_NOT_FOUND)
{
- printf("Key doesn't exist - nothing to be done\n");
+ DbgPrint("Key doesn't exist - nothing to be done\n");
res = ERROR_SUCCESS;
}
else
- printf("RegOpenKey failed on run key (%ld)\n", res);
+ DbgPrint("RegOpenKeyEx failed on run key (%ld)\n", res);
goto end;
}
@@ -164,14 +163,14 @@
NULL);
if (res != ERROR_SUCCESS)
{
- printf("Couldn't query key info (%ld)\n", res);
+ DbgPrint("Couldn't query key info (%ld)\n", res);
goto end;
}
if (i == 0)
{
- printf("No commands to execute.\n");
+ DbgPrint("No commands to execute.\n");
res = ERROR_SUCCESS;
goto end;
@@ -182,7 +181,7 @@
cbMaxCmdLine);
if (szCmdLine == NULL)
{
- printf("Couldn't allocate memory for the commands to be
executed\n");
+ DbgPrint("Couldn't allocate memory for the commands to be
executed\n");
res = ERROR_NOT_ENOUGH_MEMORY;
goto end;
@@ -194,7 +193,7 @@
cchMaxValue * sizeof(*szValue));
if (szValue == NULL)
{
- printf("Couldn't allocate memory for the value names\n");
+ DbgPrint("Couldn't allocate memory for the value names\n");
res = ERROR_NOT_ENOUGH_MEMORY;
goto end;
@@ -217,7 +216,7 @@
&cbDataLength);
if (res != ERROR_SUCCESS)
{
- printf("Couldn't read in value %ld - %ld\n", i, res);
+ DbgPrint("Couldn't read in value %lu - %ld\n", i, res);
continue;
}
@@ -227,12 +226,12 @@
if (bDelete && (res = RegDeleteValueW(hkRun, szValue)) != ERROR_SUCCESS)
{
- printf("Couldn't delete value - %ld, %ld. Running command
anyways.\n", i, res);
+ DbgPrint("Couldn't delete value - %lu, %ld. Running command
anyways.\n", i, res);
}
if (type != REG_SZ)
{
- printf("Incorrect type of value #%ld (%ld)\n", i, type);
+ DbgPrint("Incorrect type of value #%lu (%lu)\n", i, type);
continue;
}
@@ -240,10 +239,10 @@
res = runCmd(szCmdLine, NULL, bSynchronous, FALSE);
if (res == INVALID_RUNCMD_RETURN)
{
- printf("Error running cmd #%ld (%ld)\n", i, GetLastError());
- }
-
- printf("Done processing cmd #%ld\n", i);
+ DbgPrint("Error running cmd #%lu (%lu)\n", i, GetLastError());
+ }
+
+ DbgPrint("Done processing cmd #%lu\n", i);
}
res = ERROR_SUCCESS;
@@ -257,7 +256,7 @@
if (hkWin != NULL)
RegCloseKey(hkWin);
- printf("done\n");
+ DbgPrint("done\n");
return res == ERROR_SUCCESS ? TRUE : FALSE;
}
@@ -269,24 +268,22 @@
/* TODO: ProcessRunKeys already checks SM_CLEANBOOT -- items prefixed with * should
probably run even in safe mode */
BOOL bNormalBoot = GetSystemMetrics(SM_CLEANBOOT) == 0; /* Perform the operations
that are performed every boot */
/* First, set the current directory to SystemRoot */
- TCHAR gen_path[MAX_PATH];
+ WCHAR gen_path[MAX_PATH];
DWORD res;
HKEY hSessionKey, hKey;
HRESULT hr;
- res = GetWindowsDirectory(gen_path, sizeof(gen_path));
-
+ res = GetWindowsDirectoryW(gen_path, sizeof(gen_path) / sizeof(gen_path[0]));
if (res == 0)
{
- printf("Couldn't get the windows directory - error %ld\n",
- GetLastError());
+ DbgPrint("Couldn't get the windows directory - error %lu\n",
GetLastError());
return 100;
}
- if (!SetCurrentDirectory(gen_path))
- {
- wprintf(L"Cannot set the dir to %s (%ld)\n", gen_path,
GetLastError());
+ if (!SetCurrentDirectoryW(gen_path))
+ {
+ DbgPrint("Cannot set the dir to %ls (%lu)\n", gen_path,
GetLastError());
return 100;
}
@@ -297,7 +294,7 @@
LONG Error;
DWORD dwDisp;
- Error = RegCreateKeyEx(hSessionKey, L"StartupHasBeenRun", 0, NULL,
REG_OPTION_VOLATILE, KEY_WRITE, NULL, &hKey, &dwDisp);
+ Error = RegCreateKeyExW(hSessionKey, L"StartupHasBeenRun", 0, NULL,
REG_OPTION_VOLATILE, KEY_WRITE, NULL, &hKey, &dwDisp);
RegCloseKey(hSessionKey);
if (Error == ERROR_SUCCESS)
{
@@ -333,7 +330,7 @@
if (res && bNormalBoot && (SHRestricted(REST_NOCURRENTUSERRUNONCE) ==
0))
res = ProcessRunKeys(HKEY_CURRENT_USER, L"RunOnce", TRUE, FALSE);
- printf("Operation done\n");
+ DbgPrint("Operation done\n");
return res ? 0 : 101;
}
Modified: trunk/reactos/base/shell/explorer-new/trayntfy.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer-new/tr…
==============================================================================
--- trunk/reactos/base/shell/explorer-new/trayntfy.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer-new/trayntfy.c [iso-8859-1] Sat Feb 2 11:31:30
2013
@@ -758,7 +758,7 @@
TMT_FONT,
&clockFont);
- hFont = CreateFontIndirect(&clockFont);
+ hFont = CreateFontIndirectW(&clockFont);
TrayClockWnd_SetFont(This,
hFont,