*
*/
-#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;
{
lstrcpy(Globals.szFileName, szFileName);
Globals.szFileTitle[0] = 0;
- GetFileTitle(szFileName, Globals.szFileTitle, sizeof(Globals.szFileTitle));
+ GetFileTitle(szFileName, Globals.szFileTitle, wcslen(Globals.szFileTitle));
}
/***********************************************************************
if (*cmdline)
{
/* file name is passed in the command line */
- LPCWSTR file_name;
- BOOL file_exists;
+ LPCWSTR file_name = NULL;
+ BOOL file_exists = FALSE;
WCHAR buf[MAX_PATH];
if (cmdline[0] == '"')
cmdline[lstrlen(cmdline) - 1] = 0;
}
- if (FileExists(cmdline))
+ file_name = cmdline;
+ if (FileExists(file_name))
{
file_exists = TRUE;
- file_name = cmdline;
}
- else
+ else if (!HasFileExtension(cmdline))
{
static const WCHAR txtW[] = { '.','t','x','t',0 };
if (!lstrcmp(txtW, cmdline + lstrlen(cmdline) - lstrlen(txtW)))
{
file_exists = FALSE;
- file_name = cmdline;
}
else
{
lstrcpyn(buf, cmdline, MAX_PATH - lstrlen(txtW) - 1);
lstrcat(buf, txtW);
file_name = buf;
- file_exists = FileExists(buf);
+ file_exists = FileExists(file_name);
}
}