Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

566 lines
20 KiB

  1. //
  2. // LOGFILE.C
  3. //
  4. #include "sigverif.h"
  5. // We need to remember the previous logging state when we do toggling.
  6. BOOL g_bPrevLoggingEnabled = FALSE;
  7. BOOL LogFile_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
  8. {
  9. TCHAR szBuffer[MAX_PATH];
  10. if (g_App.hIcon) {
  11. SetWindowLongPtr(hwnd, GCLP_HICON, (LONG_PTR) g_App.hIcon);
  12. }
  13. g_App.hLogging = hwnd;
  14. g_bPrevLoggingEnabled = g_App.bLoggingEnabled;
  15. if (*g_App.szLogDir) {
  16. SetCurrentDirectory(g_App.szLogDir);
  17. } else {
  18. GetWindowsDirectory(szBuffer, MAX_PATH);
  19. SetCurrentDirectory(szBuffer);
  20. }
  21. SetDlgItemText(hwnd, IDC_LOGNAME, g_App.szLogFile);
  22. CheckDlgButton(hwnd, IDC_ENABLELOG, g_App.bLoggingEnabled ? BST_CHECKED : BST_UNCHECKED);
  23. EnableWindow(GetDlgItem(hwnd, IDC_VIEWLOG), g_App.bLoggingEnabled && EXIST(g_App.szLogFile));
  24. CheckRadioButton(hwnd, IDC_OVERWRITE, IDC_APPEND, g_App.bOverwrite ? IDC_OVERWRITE : IDC_APPEND);
  25. EnableWindow(GetDlgItem(hwnd, IDC_APPEND), g_App.bLoggingEnabled);
  26. EnableWindow(GetDlgItem(hwnd, IDC_OVERWRITE), g_App.bLoggingEnabled);
  27. EnableWindow(GetDlgItem(hwnd, IDC_LOGNAME), g_App.bLoggingEnabled);
  28. SetForegroundWindow(g_App.hDlg);
  29. SetForegroundWindow(hwnd);
  30. return TRUE;
  31. }
  32. void LogFile_UpdateDialog(HWND hwnd)
  33. {
  34. TCHAR szBuffer[MAX_PATH];
  35. if (GetDlgItemText(hwnd, IDC_LOGNAME, szBuffer, MAX_PATH)) {
  36. EnableWindow(GetDlgItem(hwnd, IDC_VIEWLOG), g_App.bLoggingEnabled && EXIST(szBuffer));
  37. } else EnableWindow(GetDlgItem(hwnd, IDC_VIEWLOG), FALSE);
  38. EnableWindow(GetDlgItem(hwnd, IDC_APPEND), g_App.bLoggingEnabled);
  39. EnableWindow(GetDlgItem(hwnd, IDC_OVERWRITE), g_App.bLoggingEnabled);
  40. EnableWindow(GetDlgItem(hwnd, IDC_LOGNAME), g_App.bLoggingEnabled);
  41. }
  42. void LogFile_OnViewLog(HWND hwnd)
  43. {
  44. TCHAR szDirName[MAX_PATH];
  45. TCHAR szFileName[MAX_PATH];
  46. if (*g_App.szLogDir) {
  47. lstrcpy(szDirName, g_App.szLogDir);
  48. } else {
  49. GetWindowsDirectory(szDirName, MAX_PATH);
  50. }
  51. if (!GetDlgItemText(hwnd, IDC_LOGNAME, szFileName, MAX_PATH)) {
  52. MyErrorBoxId(IDS_BADLOGNAME);
  53. return;
  54. }
  55. ShellExecute(hwnd, NULL, szFileName, NULL, szDirName, SW_SHOW);
  56. }
  57. BOOL LogFile_VerifyLogFile(HWND hwnd, LPTSTR lpFileName, BOOL bNoisy)
  58. {
  59. TCHAR szFileName[MAX_PATH];
  60. HANDLE hFile;
  61. BOOL bRet;
  62. HWND hTemp;
  63. ZeroMemory(szFileName, sizeof(szFileName));
  64. bRet = GetDlgItemText(hwnd, IDC_LOGNAME, szFileName, MAX_PATH);
  65. if (bRet) {
  66. hFile = CreateFile( szFileName,
  67. GENERIC_READ | GENERIC_WRITE,
  68. FILE_SHARE_READ,
  69. NULL,
  70. OPEN_EXISTING,
  71. FILE_ATTRIBUTE_NORMAL,
  72. NULL);
  73. if (hFile != INVALID_HANDLE_VALUE) {
  74. CloseHandle(hFile);
  75. } else {
  76. hFile = CreateFile( szFileName,
  77. GENERIC_READ | GENERIC_WRITE,
  78. FILE_SHARE_READ,
  79. NULL,
  80. CREATE_NEW,
  81. FILE_ATTRIBUTE_NORMAL,
  82. NULL);
  83. if (hFile != INVALID_HANDLE_VALUE) {
  84. CloseHandle(hFile);
  85. DeleteFile(szFileName);
  86. } else {
  87. //
  88. // If we couldn't open an existing file and we couldn't create a new one, then we fail.
  89. //
  90. bRet = FALSE;
  91. }
  92. }
  93. }
  94. if (!bRet && bNoisy) {
  95. //
  96. // Since we don't want to lose focus, we are going to temporarily change g_App.hDlg. JasKey, I apologize.
  97. //
  98. hTemp = g_App.hDlg;
  99. g_App.hDlg = hwnd;
  100. MyErrorBoxId(IDS_BADLOGNAME);
  101. g_App.hDlg = hTemp;
  102. }
  103. //
  104. // If everything worked and the user wants the file name, copy it into lpFileName
  105. //
  106. if (bRet && lpFileName && *szFileName) {
  107. lstrcpy(lpFileName, szFileName);
  108. }
  109. return bRet;
  110. }
  111. BOOL LogFile_OnOK(HWND hwnd)
  112. {
  113. HKEY hKey;
  114. LONG lRes;
  115. DWORD dwDisp, dwType, dwFlags, cbData;
  116. TCHAR szFileName[MAX_PATH];
  117. ZeroMemory(szFileName, sizeof(szFileName));
  118. if (LogFile_VerifyLogFile(hwnd, szFileName, FALSE)) {
  119. // The file is OK to append or overwrite.
  120. lstrcpy(g_App.szLogFile, szFileName);
  121. } else return FALSE;
  122. g_App.bOverwrite = IsDlgButtonChecked(hwnd, IDC_OVERWRITE);
  123. // Look in the registry for any settings from the last SigVerif session
  124. lRes = RegCreateKeyEx( SIGVERIF_HKEY,
  125. SIGVERIF_KEY,
  126. 0,
  127. NULL,
  128. 0,
  129. KEY_ALL_ACCESS,
  130. NULL,
  131. &hKey,
  132. &dwDisp);
  133. if (lRes == ERROR_SUCCESS) {
  134. cbData = sizeof(DWORD);
  135. dwFlags = 0;
  136. if (g_App.bLoggingEnabled)
  137. dwFlags = 0x1;
  138. if (g_App.bOverwrite)
  139. dwFlags |= 0x2;
  140. dwType = REG_DWORD;
  141. lRes = RegSetValueEx( hKey,
  142. SIGVERIF_FLAGS,
  143. 0,
  144. dwType,
  145. (LPBYTE) &dwFlags,
  146. cbData);
  147. dwType = REG_SZ;
  148. cbData = MAX_PATH;
  149. lRes = RegSetValueEx( hKey,
  150. SIGVERIF_LOGNAME,
  151. 0,
  152. dwType,
  153. (LPBYTE) g_App.szLogFile,
  154. cbData);
  155. RegCloseKey(hKey);
  156. }
  157. return TRUE;
  158. }
  159. void LogFile_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
  160. {
  161. switch (id) {
  162. case IDC_VIEWLOG:
  163. LogFile_OnViewLog(hwnd);
  164. break;
  165. case IDC_ENABLELOG:
  166. g_App.bLoggingEnabled = !g_App.bLoggingEnabled;
  167. // Fall through to update...
  168. default: LogFile_UpdateDialog(hwnd);
  169. }
  170. }
  171. //
  172. // This function handles any notification messages for the Search page.
  173. //
  174. LRESULT LogFile_NotifyHandler(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  175. {
  176. NMHDR *lpnmhdr = (NMHDR *) lParam;
  177. LRESULT lResult;
  178. BOOL bRet;
  179. switch (lpnmhdr->code) {
  180. case PSN_APPLY: if (LogFile_OnOK(hwnd))
  181. lResult = PSNRET_NOERROR;
  182. else lResult = PSNRET_INVALID_NOCHANGEPAGE;
  183. SetWindowLongPtr(hwnd,
  184. DWLP_MSGRESULT,
  185. (LONG_PTR) lResult);
  186. return lResult;
  187. case PSN_KILLACTIVE: bRet = !LogFile_VerifyLogFile(hwnd, NULL, TRUE);
  188. if (bRet) {
  189. SetForegroundWindow(g_App.hLogging);
  190. SetFocus(GetDlgItem(g_App.hLogging, IDC_LOGNAME));
  191. }
  192. SetWindowLongPtr(hwnd,
  193. DWLP_MSGRESULT,
  194. (LONG_PTR) bRet);
  195. return bRet;
  196. }
  197. return 0;
  198. }
  199. INT_PTR CALLBACK LogFile_DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  200. {
  201. BOOL fProcessed = TRUE;
  202. switch (uMsg) {
  203. HANDLE_MSG(hwnd, WM_INITDIALOG, LogFile_OnInitDialog);
  204. HANDLE_MSG(hwnd, WM_COMMAND, LogFile_OnCommand);
  205. case WM_NOTIFY:
  206. return LogFile_NotifyHandler(hwnd, uMsg, wParam, lParam);
  207. case WM_HELP:
  208. SigVerif_Help(hwnd, uMsg, wParam, lParam, FALSE);
  209. break;
  210. case WM_CONTEXTMENU:
  211. SigVerif_Help(hwnd, uMsg, wParam, lParam, TRUE);
  212. break;
  213. default: fProcessed = FALSE;
  214. }
  215. return fProcessed;
  216. }
  217. void PrintUnscannedFileListItems(HANDLE hFile)
  218. {
  219. LPFILENODE lpFileNode;
  220. TCHAR szDirectory[MAX_PATH];
  221. TCHAR szBuffer[MAX_PATH * 2];
  222. TCHAR szBuffer2[MAX_PATH];
  223. DWORD dwBytesWritten;
  224. *szDirectory = 0;
  225. for (lpFileNode = g_App.lpFileList;lpFileNode;lpFileNode = lpFileNode->next) {
  226. // Make sure we only log files that have actually been scanned.
  227. if (!lpFileNode->bScanned) {
  228. if (lstrcmp(szDirectory, lpFileNode->lpDirName)) {
  229. SetCurrentDirectory(lpFileNode->lpDirName);
  230. lstrcpy(szDirectory, lpFileNode->lpDirName);
  231. MyLoadString(szBuffer2, IDS_DIR);
  232. wsprintf(szBuffer, szBuffer2, szDirectory);
  233. WriteFile(hFile, szBuffer, lstrlen(szBuffer) * sizeof(TCHAR), &dwBytesWritten, NULL);
  234. }
  235. MyLoadString(szBuffer2, IDS_STRING_LINEFEED);
  236. wsprintf(szBuffer, szBuffer2, lpFileNode->lpFileName);
  237. WriteFile(hFile, szBuffer, lstrlen(szBuffer) * sizeof(TCHAR), &dwBytesWritten, NULL);
  238. }
  239. }
  240. MyLoadString(szBuffer, IDS_LINEFEED);
  241. WriteFile(hFile, szBuffer, lstrlen(szBuffer) * sizeof(TCHAR), &dwBytesWritten, NULL);
  242. }
  243. void PrintFileListItems(HANDLE hFile)
  244. {
  245. LPFILENODE lpFileNode;
  246. TCHAR szDirectory[MAX_PATH];
  247. TCHAR szBuffer[MAX_PATH * 2];
  248. TCHAR szBuffer2[MAX_PATH];
  249. TCHAR szBuffer3[MAX_PATH];
  250. DWORD dwBytesWritten;
  251. LPTSTR lpString;
  252. int iRet;
  253. *szDirectory = 0;
  254. for (lpFileNode = g_App.lpFileList;lpFileNode;lpFileNode = lpFileNode->next) {
  255. // Make sure we only log files that have actually been scanned.
  256. if (lpFileNode->bScanned) {
  257. if (lstrcmp(szDirectory, lpFileNode->lpDirName)) {
  258. SetCurrentDirectory(lpFileNode->lpDirName);
  259. lstrcpy(szDirectory, lpFileNode->lpDirName);
  260. MyLoadString(szBuffer2, IDS_DIR);
  261. wsprintf(szBuffer, szBuffer2, szDirectory);
  262. WriteFile(hFile, szBuffer, lstrlen(szBuffer) * sizeof(TCHAR), &dwBytesWritten, NULL);
  263. }
  264. MyLoadString(szBuffer2, IDS_STRING);
  265. wsprintf(szBuffer, szBuffer2, lpFileNode->lpFileName);
  266. WriteFile(hFile, szBuffer, lstrlen(szBuffer) * sizeof(TCHAR), &dwBytesWritten, NULL);
  267. MyLoadString(szBuffer, IDS_SPACES);
  268. WriteFile(hFile, szBuffer, lstrlen(szBuffer) * sizeof(TCHAR), &dwBytesWritten, NULL);
  269. // Get the date format, so we are localizable...
  270. MyLoadString(szBuffer2, IDS_UNKNOWN);
  271. iRet = GetDateFormat( LOCALE_SYSTEM_DEFAULT,
  272. DATE_SHORTDATE,
  273. &lpFileNode->LastModified,
  274. NULL,
  275. NULL,
  276. 0);
  277. if (iRet) {
  278. lpString = MALLOC((iRet + 1) * sizeof(TCHAR));
  279. if (lpString) {
  280. iRet = GetDateFormat( LOCALE_SYSTEM_DEFAULT,
  281. DATE_SHORTDATE,
  282. &lpFileNode->LastModified,
  283. NULL,
  284. lpString,
  285. iRet);
  286. if (iRet) {
  287. lstrcpy(szBuffer2, lpString);
  288. }
  289. FREE(lpString);
  290. }
  291. }
  292. MyLoadString(szBuffer3, IDS_STRING2);
  293. wsprintf(szBuffer, szBuffer3, szBuffer2);
  294. WriteFile(hFile, szBuffer, lstrlen(szBuffer) * sizeof(TCHAR), &dwBytesWritten, NULL);
  295. MyLoadString(szBuffer, IDS_SPACES);
  296. WriteFile(hFile, szBuffer, lstrlen(szBuffer) * sizeof(TCHAR), &dwBytesWritten, NULL);
  297. if (lpFileNode->lpVersion && *lpFileNode->lpVersion)
  298. lstrcpy(szBuffer3, lpFileNode->lpVersion);
  299. else MyLoadString(szBuffer3, IDS_NOVERSION);
  300. MyLoadString(szBuffer2, IDS_STRING);
  301. wsprintf(szBuffer, szBuffer2, szBuffer3);
  302. WriteFile(hFile, szBuffer, lstrlen(szBuffer) * sizeof(TCHAR), &dwBytesWritten, NULL);
  303. MyLoadString(szBuffer2, IDS_STRING);
  304. MyLoadString(szBuffer3, lpFileNode->bSigned ? IDS_SIGNED : IDS_NOTSIGNED);
  305. wsprintf(szBuffer, szBuffer2, szBuffer3);
  306. WriteFile(hFile, szBuffer, lstrlen(szBuffer) * sizeof(TCHAR), &dwBytesWritten, NULL);
  307. if (lpFileNode->lpCatalog)
  308. lstrcpy(szBuffer3, lpFileNode->lpCatalog);
  309. else MyLoadString(szBuffer3, IDS_NA);
  310. MyLoadString(szBuffer2, IDS_STRING);
  311. wsprintf(szBuffer, szBuffer2, szBuffer3);
  312. WriteFile(hFile, szBuffer, lstrlen(szBuffer) * sizeof(TCHAR), &dwBytesWritten, NULL);
  313. if (lpFileNode->lpSignedBy) {
  314. WriteFile(hFile, lpFileNode->lpSignedBy, lstrlen(lpFileNode->lpSignedBy) * sizeof(TCHAR), &dwBytesWritten, NULL);
  315. }
  316. MyLoadString(szBuffer, IDS_LINEFEED);
  317. WriteFile(hFile, szBuffer, lstrlen(szBuffer) * sizeof(TCHAR), &dwBytesWritten, NULL);
  318. }
  319. }
  320. }
  321. void PrintFileList(void)
  322. {
  323. HANDLE hFile;
  324. DWORD dwBytesWritten;
  325. TCHAR szBuffer[MAX_PATH*2];
  326. TCHAR szBuffer2[MAX_PATH];
  327. TCHAR szBuffer3[MAX_PATH];
  328. LPTSTR lpString = NULL;
  329. OSVERSIONINFO osinfo;
  330. SYSTEM_INFO sysinfo;
  331. int iRet;
  332. // Bail if logging is disabled or there's no file list
  333. if (!g_App.bLoggingEnabled || !g_App.lpFileList)
  334. return;
  335. if (*g_App.szLogDir) {
  336. SetCurrentDirectory(g_App.szLogDir);
  337. } else {
  338. // Get the Windows directory and make it the current directory.
  339. GetWindowsDirectory(szBuffer, MAX_PATH);
  340. SetCurrentDirectory(szBuffer);
  341. }
  342. hFile = CreateFile( g_App.szLogFile,
  343. GENERIC_READ | GENERIC_WRITE,
  344. FILE_SHARE_READ,
  345. NULL,
  346. OPEN_ALWAYS,
  347. FILE_ATTRIBUTE_NORMAL,
  348. NULL);
  349. if (hFile == INVALID_HANDLE_VALUE) {
  350. MyErrorBoxId(IDS_CANTOPENLOGFILE);
  351. return;
  352. }
  353. // If the overwrite flag is set, truncate the file.
  354. if (g_App.bOverwrite) {
  355. SetFilePointer(hFile, 0, NULL, FILE_BEGIN);
  356. SetEndOfFile(hFile);
  357. } else SetFilePointer(hFile, 0, NULL, FILE_END);
  358. #ifdef UNICODE
  359. // If we are using UNICODE, then write the 0xFF and 0xFE bytes at the beginning of the file.
  360. if (g_App.bOverwrite || (GetFileSize(hFile, NULL) == 0)) {
  361. szBuffer[0] = 0xFEFF;
  362. WriteFile(hFile, szBuffer, sizeof(TCHAR), &dwBytesWritten, NULL);
  363. }
  364. #endif
  365. // Write the header to the logfile.
  366. MyLoadString(szBuffer, IDS_LOGHEADER1);
  367. WriteFile(hFile, szBuffer, lstrlen(szBuffer) * sizeof(TCHAR), &dwBytesWritten, NULL);
  368. // Get the date format, so we are localizable...
  369. MyLoadString(szBuffer2, IDS_UNKNOWN);
  370. iRet = GetDateFormat(LOCALE_SYSTEM_DEFAULT,DATE_SHORTDATE,NULL,NULL,NULL,0);
  371. if (iRet) {
  372. lpString = MALLOC((iRet + 1) * sizeof(TCHAR));
  373. if (lpString) {
  374. iRet = GetDateFormat(LOCALE_SYSTEM_DEFAULT,DATE_SHORTDATE,NULL,NULL,lpString,iRet);
  375. if (iRet) {
  376. lstrcpy(szBuffer2, lpString);
  377. }
  378. FREE(lpString);
  379. }
  380. }
  381. // Get the time format, so we are localizable...
  382. iRet = GetTimeFormat(LOCALE_SYSTEM_DEFAULT,TIME_NOSECONDS,NULL,NULL,NULL,0);
  383. if (iRet) {
  384. lpString = MALLOC((iRet + 1) * sizeof(TCHAR));
  385. if (lpString) {
  386. iRet = GetTimeFormat(LOCALE_SYSTEM_DEFAULT,TIME_NOSECONDS,NULL,NULL,lpString,iRet);
  387. }
  388. }
  389. MyLoadString(szBuffer3, IDS_LOGHEADER2);
  390. if (lpString) {
  391. wsprintf(szBuffer, szBuffer3, szBuffer2, lpString);
  392. FREE(lpString);
  393. } else {
  394. wsprintf(szBuffer, szBuffer3, szBuffer2, szBuffer2);
  395. }
  396. WriteFile(hFile, szBuffer, lstrlen(szBuffer) * sizeof(TCHAR), &dwBytesWritten, NULL);
  397. // Get the OS Platform string for the log file.
  398. MyLoadString(szBuffer, IDS_OSPLATFORM);
  399. WriteFile(hFile, szBuffer, lstrlen(szBuffer) * sizeof(TCHAR), &dwBytesWritten, NULL);
  400. ZeroMemory(&osinfo, sizeof(OSVERSIONINFO));
  401. osinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  402. GetVersionEx(&osinfo);
  403. switch (osinfo.dwPlatformId) {
  404. case VER_PLATFORM_WIN32_NT: MyLoadString(szBuffer, IDS_WINNT); break;
  405. case VER_PLATFORM_WIN32_WINDOWS: MyLoadString(szBuffer, IDS_WIN9X); break;
  406. case VER_PLATFORM_WIN32s: MyLoadString(szBuffer, IDS_WIN3X); break;
  407. default: MyLoadString(szBuffer, IDS_UNKNOWN);
  408. }
  409. WriteFile(hFile, szBuffer, lstrlen(szBuffer) * sizeof(TCHAR), &dwBytesWritten, NULL);
  410. // If this is NT, then get the processor architecture and log it
  411. if (osinfo.dwPlatformId == VER_PLATFORM_WIN32_NT) {
  412. ZeroMemory(&sysinfo, sizeof(SYSTEM_INFO));
  413. GetSystemInfo(&sysinfo);
  414. // Initialize szBuffer to zeroes in case of an unknown architecture
  415. ZeroMemory(szBuffer, sizeof(szBuffer));
  416. switch (sysinfo.wProcessorArchitecture) {
  417. case PROCESSOR_ARCHITECTURE_INTEL: MyLoadString(szBuffer, IDS_X86); break;
  418. case PROCESSOR_ARCHITECTURE_MIPS: MyLoadString(szBuffer, IDS_MIPS); break;
  419. case PROCESSOR_ARCHITECTURE_ALPHA: MyLoadString(szBuffer, IDS_ALPHA); break;
  420. case PROCESSOR_ARCHITECTURE_PPC: MyLoadString(szBuffer, IDS_PPC); break;
  421. }
  422. if (*szBuffer) {
  423. // Now write the processor type to the file
  424. WriteFile(hFile, szBuffer, lstrlen(szBuffer) * sizeof(TCHAR), &dwBytesWritten, NULL);
  425. }
  426. }
  427. // Get the OS Version, Build, and CSD information and log it.
  428. MyLoadString(szBuffer2, IDS_OSVERSION);
  429. wsprintf(szBuffer, szBuffer2, osinfo.dwMajorVersion, osinfo.dwMinorVersion, (osinfo.dwBuildNumber & 0xFFFF), osinfo.szCSDVersion);
  430. WriteFile(hFile, szBuffer, lstrlen(szBuffer) * sizeof(TCHAR), &dwBytesWritten, NULL);
  431. // Print out the total/signed/unsigned results right before the file list
  432. MyLoadString(szBuffer2, IDS_TOTALS);
  433. wsprintf(szBuffer, szBuffer2, g_App.dwFiles, g_App.dwSigned, g_App.dwUnsigned,
  434. g_App.dwFiles - g_App.dwSigned - g_App.dwUnsigned);
  435. WriteFile(hFile, szBuffer, lstrlen(szBuffer) * sizeof(TCHAR), &dwBytesWritten, NULL);
  436. // If we are doing a user-defined search, then log the parameters.
  437. if (g_App.bUserScan) {
  438. // Write the user-specified directory
  439. MyLoadString(szBuffer2, IDS_LOGHEADER3);
  440. wsprintf(szBuffer, szBuffer2, g_App.szScanPattern);
  441. WriteFile(hFile, szBuffer, lstrlen(szBuffer) * sizeof(TCHAR), &dwBytesWritten, NULL);
  442. // Write the user-specified search pattern
  443. MyLoadString(szBuffer2, IDS_LOGHEADER4);
  444. wsprintf(szBuffer, szBuffer2, g_App.szScanPath);
  445. WriteFile(hFile, szBuffer, lstrlen(szBuffer) * sizeof(TCHAR), &dwBytesWritten, NULL);
  446. }
  447. // Write the column headers to the log file
  448. MyLoadString(szBuffer, IDS_LOGHEADER5);
  449. WriteFile(hFile, szBuffer, lstrlen(szBuffer) * sizeof(TCHAR), &dwBytesWritten, NULL);
  450. MyLoadString(szBuffer, IDS_LOGHEADER6);
  451. WriteFile(hFile, szBuffer, lstrlen(szBuffer) * sizeof(TCHAR), &dwBytesWritten, NULL);
  452. PrintFileListItems(hFile);
  453. // Write the unscanned file headers to the log file
  454. if (g_App.dwFiles > (g_App.dwSigned + g_App.dwUnsigned)) {
  455. MyLoadString(szBuffer, IDS_LOGHEADER7);
  456. WriteFile(hFile, szBuffer, lstrlen(szBuffer) * sizeof(TCHAR), &dwBytesWritten, NULL);
  457. MyLoadString(szBuffer, IDS_LOGHEADER8);
  458. WriteFile(hFile, szBuffer, lstrlen(szBuffer) * sizeof(TCHAR), &dwBytesWritten, NULL);
  459. PrintUnscannedFileListItems(hFile);
  460. }
  461. CloseHandle(hFile);
  462. }