Diff for /np2/win9x/win32sub.cpp between versions 1.2 and 1.4

version 1.2, 2007/01/10 14:43:36 version 1.4, 2007/10/26 14:38:34
Line 19  void __msgbox(const char *title, const c Line 19  void __msgbox(const char *title, const c
   
   
 // WinAPIだと Win95でバグあるの  // WinAPIだと Win95でバグあるの
 int loadstring2(HINSTANCE hInstance, UINT uID,  int loadstringresource(HINSTANCE hInstance, UINT uID,
                                                                                 LPTSTR lpBuffer, int nBufferMax) {                                                                                  LPTSTR lpBuffer, int nBufferMax) {
   
         HMODULE hModule;          HMODULE hModule;
Line 40  int loadstring2(HINSTANCE hInstance, UIN Line 40  int loadstring2(HINSTANCE hInstance, UIN
         if (hGlobal == NULL) {          if (hGlobal == NULL) {
                 return(0);                  return(0);
         }          }
         pRes = (UINT16 *)LockResource(hRsrc);          pRes = (UINT16 *)LockResource(hGlobal);
         dwPos = 0;          dwPos = 0;
         uID = uID & 15;          uID = uID & 15;
         while((uID) && (dwPos < dwResSize)) {          while((uID) && (dwPos < dwResSize)) {
Line 74  int loadstring2(HINSTANCE hInstance, UIN Line 74  int loadstring2(HINSTANCE hInstance, UIN
                 lpBuffer = NULL;                  lpBuffer = NULL;
                 nBufferMax = 0;                  nBufferMax = 0;
         }          }
         nLength = WideCharToMultiByte(CP_ACP, 0, pRes + dwPos, nLength,          nLength = WideCharToMultiByte(CP_ACP, 0, (WCHAR *)(pRes + dwPos), nLength,
                                                                                         lpBuffer, nBufferMax, NULL, NULL);                                                                                          lpBuffer, nBufferMax, NULL, NULL);
         if (lpBuffer) {          if (lpBuffer) {
                 lpBuffer[nLength] = '\0';                  lpBuffer[nLength] = '\0';
Line 83  int loadstring2(HINSTANCE hInstance, UIN Line 83  int loadstring2(HINSTANCE hInstance, UIN
         return(nLength);          return(nLength);
 }  }
   
   // WinAPIだと Win95でバグあるの
   TCHAR *lockstringresource(HINSTANCE hInstance, LPCTSTR pszString) {
   
           TCHAR   *pszRet;
           int             nSize;
   
           pszRet = NULL;
           if (HIWORD(pszString)) {
                   nSize = (lstrlen(pszString) + 1) * sizeof(TCHAR);
                   pszRet = (TCHAR *)_MALLOC(nSize, "");
                   if (pszRet) {
                           CopyMemory(pszRet, pszString, nSize);
                   }
           }
           else if (LOWORD(pszString)) {
                   nSize = loadstringresource(hInstance, (UINT)pszString, NULL, 0);
                   if (nSize) {
                           pszRet = (TCHAR *)_MALLOC((nSize + 1) * sizeof(TCHAR), "");
                           if (pszRet) {
                                   loadstringresource(hInstance, (UINT)pszString,
                                                                                                                   pszRet, nSize + 1);
                           }
                   }
           }
           return(pszRet);
   }
   
   void unlockstringresource(TCHAR *pszString) {
   
           if (pszString) {
                   _MFREE(pszString);
           }
   }
   

Removed from v.1.2  
changed lines
  Added in v.1.4


RetroPC.NET-CVS <cvs@retropc.net>