Kevin Koltzau <kevin@plop.org> Handle notepad log feature.
Modified: trunk/reactos/subsys/system/notepad/dialog.c

Modified: trunk/reactos/subsys/system/notepad/dialog.c
--- trunk/reactos/subsys/system/notepad/dialog.c	2005-09-23 05:54:46 UTC (rev 17995)
+++ trunk/reactos/subsys/system/notepad/dialog.c	2005-09-23 05:58:27 UTC (rev 17996)
@@ -271,11 +271,13 @@
 
 void DoOpenFile(LPCWSTR szFileName)
 {
+    static const WCHAR dotlog[] = { '.','L','O','G',0 };
     HANDLE hFile;
     LPSTR pTemp;
     LPWSTR pTemp2 = NULL;
     DWORD size;
     DWORD dwNumRead;
+    WCHAR log[5];
     LPWSTR p;
     LPBYTE p2;
     int iCodePage;
@@ -375,6 +377,18 @@
     SendMessage(Globals.hEdit, EM_SETMODIFY, FALSE, 0);
     SendMessage(Globals.hEdit, EM_EMPTYUNDOBUFFER, 0, 0);
     SetFocus(Globals.hEdit);
+    
+    /*  If the file starts with .LOG, add a time/date at the end and set cursor after
+     *  See http://support.microsoft.com/?kbid=260563
+     */
+    if (GetWindowTextW(Globals.hEdit, log, sizeof(log)/sizeof(log[0])) && !lstrcmp(log, dotlog))
+    {
+	static const WCHAR lfW[] = { '\r','\n',0 };
+	SendMessage(Globals.hEdit, EM_SETSEL, GetWindowTextLength(Globals.hEdit), -1);
+	SendMessage(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM)lfW);
+	DIALOG_EditTimeDate();
+	SendMessage(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM)lfW);
+    }
 
     SetFileName(szFileName);
     UpdateWindowCaption();