X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fnt.c;h=af74f8410ed21f7b1551dd1948fd6365ddc8d297;hb=8ca450f99e6270c9f6023acb88da0c89c2374d4a;hp=2615d67c0bf18a2c1e187c8eadc3652abc0a2935;hpb=21db8709c0c2dcedbd278c7fe571290d5ce80a71;p=chise%2Fxemacs-chise.git diff --git a/src/nt.c b/src/nt.c index 2615d67..af74f84 100644 --- a/src/nt.c +++ b/src/nt.c @@ -506,7 +506,7 @@ request_sigio (void) } #endif /* 0 */ -#define REG_ROOT "SOFTWARE\\GNU\\XEmacs" +#define REG_ROOT "SOFTWARE\\XEmacs\\XEmacs" LPBYTE nt_get_resource (char *key, LPDWORD lpdwtype) @@ -1474,6 +1474,7 @@ mswindows_stat (const char * path, struct stat * buf) int permission; int len; int rootdir = FALSE; + int errm; if (path == NULL || buf == NULL) { @@ -1496,13 +1497,16 @@ mswindows_stat (const char * path, struct stat * buf) rootdir = (path >= name + len - 1 && (IS_DIRECTORY_SEP (*path) || *path == 0)); name = strcpy ((char *)alloca (len + 2), name); - + errm = SetErrorMode (SEM_FAILCRITICALERRORS + | SEM_NOOPENFILEERRORBOX); if (rootdir) { if (!IS_DIRECTORY_SEP (name[len-1])) strcat (name, "\\"); + if (GetDriveType (name) < 2) { + SetErrorMode (errm); errno = ENOENT; return -1; } @@ -1532,14 +1536,15 @@ mswindows_stat (const char * path, struct stat * buf) } else { - fh = FindFirstFile (name, &wfd); - if (fh == INVALID_HANDLE_VALUE) - { - errno = ENOENT; - return -1; + fh = FindFirstFile (name, &wfd); + if (fh == INVALID_HANDLE_VALUE) + { + SetErrorMode (errm); + errno = ENOENT; + return -1; + } + FindClose (fh); } - FindClose (fh); - } } if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) @@ -1585,6 +1590,7 @@ mswindows_stat (const char * path, struct stat * buf) } else { + SetErrorMode (errm); errno = EACCES; return -1; } @@ -1597,6 +1603,8 @@ mswindows_stat (const char * path, struct stat * buf) fake_inode = 0; } + SetErrorMode (errm); + #if 0 /* Not sure if there is any point in this. */ if (!NILP (Vwin32_generate_fake_inodes))