[Plib-cvs] plib/src/ssg ssgLoadFLT.cxx,1.38,1.39
Brought to you by:
sjbaker
From: M?rten Str?m. <str...@us...> - 2003-04-17 13:10:16
|
Update of /cvsroot/plib/plib/src/ssg In directory sc8-pr-cvs1:/tmp/cvs-serv29482 Modified Files: ssgLoadFLT.cxx Log Message: Windows fixes from Paolo Leoncini Index: ssgLoadFLT.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadFLT.cxx,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- ssgLoadFLT.cxx 1 Feb 2003 11:46:11 -0000 1.38 +++ ssgLoadFLT.cxx 17 Apr 2003 13:10:12 -0000 1.39 @@ -2715,7 +2715,27 @@ static struct snode *FltCache; -#define win32_perror(s) perror(s) /* no idea if this is appropriate.. */ +#ifdef UL_WIN32 + +static void win32_perror(const char *s) +{ + LPVOID lpMsgBuf; + FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + GetLastError(), + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR) &lpMsgBuf, + 0, + NULL + ); + fprintf(stderr, "%s: %s\n", s, lpMsgBuf); + LocalFree( lpMsgBuf ); +} + +#endif static ssgEntity *LoadFLT(const char *file) { @@ -2755,7 +2775,7 @@ #ifdef USE_WIN32_MMAP - fd = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, + fd = CreateFile(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); if (fd == INVALID_HANDLE_VALUE) { win32_perror(path); |