- PCHify notepad and add missing header from regedit.
[reactos.git] / reactos / subsys / system / notepad / main.c
index c0f1ed2..bbe8115 100644 (file)
  *
  */
 
-#define UNICODE
-#define _UNICODE
-
-#define _CRT_SECURE_NO_DEPRECATE
-
-#include <windows.h>
-#include <stdio.h>
-#include <tchar.h>
-
-#include "main.h"
-#include "dialog.h"
-#include "notepad_res.h"
+#include <notepad.h>
 
 NOTEPAD_GLOBALS Globals;
 static ATOM aFINDMSGSTRING;
@@ -450,10 +439,10 @@ static void HandleCommandLine(LPWSTR cmdline)
             cmdline[lstrlen(cmdline) - 1] = 0;
         }
 
-        if (FileExists(cmdline))
+        file_name = cmdline;
+        if (FileExists(file_name))
         {
             file_exists = TRUE;
-            file_name = cmdline;
         }
         else if (!HasFileExtension(cmdline))
         {
@@ -469,13 +458,12 @@ static void HandleCommandLine(LPWSTR cmdline)
                 lstrcpyn(buf, cmdline, MAX_PATH - lstrlen(txtW) - 1);
                 lstrcat(buf, txtW);
                 file_name = buf;
-                file_exists = FileExists(buf);
+                file_exists = FileExists(file_name);
             }
         }
 
         if (file_exists)
         {
-            file_name = cmdline;
             DoOpenFile(file_name);
             InvalidateRect(Globals.hMainWnd, NULL, FALSE);
             if (opt_print)