Current News
Archived News
Search News
Discussion Forum


Old Forum
Install Programs More Downloads...
Troubleshooting
Source Code
Format Specs.
Misc. Information
Non-SF Stuff
Links




ShadowFlare [Thu, 7 Sep 2006 00:23:30 +0000 (00:23 +0000)]
grpapi/grpapi.cpp

index abe808a..84420e6 100644 (file)
@@ -147,7 +147,7 @@ HANDLE GRPAPI WINAPI LoadGrp(LPCSTR lpFileName)
                        SFileCloseFile(hFile);\r
                        return (HANDLE)-1;\r
                }\r
-               GrpFile = (char *)VirtualAlloc(0,fsz,MEM_COMMIT,PAGE_READWRITE);\r
+               GrpFile = (char *)malloc(fsz);\r
                if (GrpFile) {\r
                        SFileSetFilePointer(hFile,0,0,FILE_BEGIN);\r
                        SFileReadFile(hFile,GrpFile,fsz,0,0);\r
@@ -163,7 +163,7 @@ HANDLE GRPAPI WINAPI LoadGrp(LPCSTR lpFileName)
                        CloseHandle(hFile);\r
                        return (HANDLE)-1;\r
                }\r
-               GrpFile = (char *)VirtualAlloc(0,fsz,MEM_COMMIT,PAGE_READWRITE);\r
+               GrpFile = (char *)malloc(fsz);\r
                if (GrpFile) {\r
                        SetFilePointer(hFile,0,0,FILE_BEGIN);\r
                        ReadFile(hFile,GrpFile,fsz,&tsz,0);\r
@@ -177,7 +177,7 @@ HANDLE GRPAPI WINAPI LoadGrp(LPCSTR lpFileName)
 BOOL GRPAPI WINAPI DestroyGrp(HANDLE hGrp)\r
 {\r
        if (!hGrp || hGrp==INVALID_HANDLE_VALUE) return FALSE;\r
-       VirtualFree(hGrp,0,MEM_RELEASE);\r
+       free(hGrp);\r
        return TRUE;\r
 }\r
 \r
@@ -377,12 +377,18 @@ BOOL GRPAPI WINAPI GetGrpInfo(HANDLE hGrp, GRPHEADER *GrpInfo)
 \r
 void GRPAPI WINAPI SetFunctionGetPixel(GETPIXELPROC lpGetPixelProc)\r
 {\r
-       MyGetPixel = lpGetPixelProc;\r
+       if (!lpGetPixelProc)\r
+               MyGetPixel = GetPixel;\r
+       else\r
+               MyGetPixel = lpGetPixelProc;\r
 }\r
 \r
 void GRPAPI WINAPI SetFunctionSetPixel(SETPIXELPROC lpSetPixelProc)\r
 {\r
-       MySetPixel = lpSetPixelProc;\r
+       if (!lpSetPixelProc)\r
+               MySetPixel = (SETPIXELPROC)SetPixelV;\r
+       else\r
+               MySetPixel = lpSetPixelProc;\r
 }\r
 \r
 void __inline SetPix(HDC hDC, int X, int Y, COLORREF clrColor, DWORD *dwPalette, DWORD dwFlags, DWORD dwAlpha)\r