Ignore:
Timestamp:
Feb 11, 2002, 2:46:36 PM (24 years ago)
Author:
sandervl
Message:

DF: fixes for translating ascii strings between os/2 & windows (in case of different code pages)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/oslibdos.cpp

    r7777 r7865  
    1 /* $Id: oslibdos.cpp,v 1.94 2002-01-18 16:23:35 sandervl Exp $ */
     1/* $Id: oslibdos.cpp,v 1.95 2002-02-11 13:46:36 sandervl Exp $ */
    22/*
    33 * Wrappers for OS/2 Dos* API
     
    4343static PROC_DosOpenL         DosOpenLProc = 0;
    4444static BOOL f64BitIO = FALSE;
     45
     46BOOL WINAPI CharToOemA( LPCSTR s, LPSTR d );
     47BOOL WINAPI OemToCharA( LPCSTR s, LPSTR d );
     48
    4549//******************************************************************************
    4650//******************************************************************************
     
    116120 APIRET yyrc;
    117121 USHORT sel = RestoreOS2FS();
     122 char OemFileName[260];
     123 CharToOemA(pszFileName, OemFileName);
    118124
    119125    if(DosOpenLProc) {
    120         yyrc = DosOpenLProc(pszFileName, phf, pulAction, cbFile, ulAttribute, fsOpenFlags,
     126        yyrc = DosOpenLProc(OemFileName, phf, pulAction, cbFile, ulAttribute, fsOpenFlags,
    121127                            fsOpenMode, peaop2);
    122128    }
    123     else yyrc = DosOpen(pszFileName, phf, pulAction, cbFile.ulLo, ulAttribute, fsOpenFlags,
     129    else yyrc = DosOpen(OemFileName, phf, pulAction, cbFile.ulLo, ulAttribute, fsOpenFlags,
    124130                        fsOpenMode, peaop2);
    125131    SetFS(sel);
     
    581587 ULONG  ulAction;
    582588 DWORD  os2flags = OPEN_FLAGS_NOINHERIT;
     589 char lOemFileName[260];       
     590
     591 CharToOemA(lpszFileName, lOemFileName);
    583592
    584593
     
    599608
    600609tryopen:
    601   rc = DosOpen(lpszFileName,                     /* File path name */
     610  rc = DosOpen(lOemFileName,                     /* File path name */
    602611               &hFile,                   /* File handle */
    603612               &ulAction,                      /* Action taken */
     
    648657{
    649658 APIRET rc;
    650 
    651   rc = DosCopy((PSZ)lpszOldFile, (PSZ)lpszNewFile, fFailIfExist ? 0: DCPY_EXISTING);
     659 char lOemOldFile[260], lOemNewFile[260];
     660
     661  CharToOemA(lpszOldFile, lOemOldFile);
     662  CharToOemA(lpszNewFile, lOemNewFile);
     663
     664  rc = DosCopy((PSZ)lOemOldFile, (PSZ)lOemNewFile, fFailIfExist ? 0: DCPY_EXISTING);
    652665  SetLastError(error2WinError(rc));
    653666  return (rc == NO_ERROR);
     
    658671{
    659672 APIRET rc;
    660 
    661   rc = DosMove((PSZ)lpszOldFile, (PSZ)lpszNewFile);
     673 char lOemOldFile[260], lOemNewFile[260];
     674
     675  CharToOemA(lpszOldFile, lOemOldFile);
     676  CharToOemA(lpszNewFile, lOemNewFile);
     677
     678  rc = DosMove((PSZ)lOemOldFile, (PSZ)lOemNewFile);
    662679  SetLastError(error2WinError(rc));
    663680  return (rc == NO_ERROR);
     
    668685{
    669686 APIRET rc;
    670 
    671   rc = DosDeleteDir((PSZ)lpszDir);
     687 char lOemDir[260];
     688
     689  CharToOemA(lpszDir, lOemDir);
     690
     691  rc = DosDeleteDir((PSZ)lOemDir);
    672692  SetLastError(error2WinError(rc));
    673693  return (rc == NO_ERROR);
     
    678698{
    679699 APIRET rc;
    680 
    681   rc = DosCreateDir((PSZ)lpszDir, NULL);
     700 char lOemDir[260];
     701
     702  CharToOemA(lpszDir, lOemDir);
     703
     704  rc = DosCreateDir((PSZ)lOemDir, NULL);
    682705  SetLastError(error2WinError(rc));
    683706  return (rc == NO_ERROR);
     
    785808{
    786809 APIRET rc;
    787 
    788   rc = DosDelete(lpszFileName);
     810 char lOemFileName[260];       
     811
     812 CharToOemA(lpszFileName, lOemFileName);
     813
     814  rc = DosDelete(lOemFileName);
    789815  if(rc) {
    790816      SetLastError(error2WinError(rc));
     
    10811107         *      This problem exist on WS4eB SMP FP1 and Warp4 FP14/Kernel 14059 at least.
    10821108         */
    1083         rc = DosOpen((PSZ)lpszFile,
     1109        rc = DosOpen((PSZ)lOemFile,
    10841110                      &hFile,
    10851111                      &actionTaken,
     
    21962222  {
    21972223    name++;
    2198     strcpy(pFind->cFileName,name);
     2224//    strcpy(pFind->cFileName,name);
     2225    OemToCharA( name, pFind->cFileName );
    21992226  }
    22002227  else
     
    22032230  long2ShortName(pFind->cFileName,pFind->cAlternateFileName);
    22042231}
     2232
    22052233
    22062234VOID translateFindResults(FILEFINDBUF3 *pResult,LPWIN32_FIND_DATAA pFind)
     
    22152243  pFind->nFileSizeHigh = 0; //CB: fixme
    22162244  pFind->nFileSizeLow = pResult->cbFile;
    2217   strcpy(pFind->cFileName,pResult->achName);
     2245//  strcpy(pFind->cFileName,pResult->achName);
     2246  OemToCharA( pResult->achName, pFind->cFileName );
    22182247  long2ShortName(pFind->cFileName,pFind->cAlternateFileName);
    22192248}
     
    22312260
    22322261  ULONG oldmode = SetErrorMode(SEM_FAILCRITICALERRORS_W);
    2233   APIRET rc = DosFindFirst((PSZ)lpFileName,&hDir,attrs,&result,sizeof(result),&searchCount,FIL_STANDARD);
     2262  char    lOemFileName[260];       
     2263
     2264  CharToOemA(lpFileName, lOemFileName);
     2265
     2266  APIRET rc = DosFindFirst((PSZ)lOemFileName,&hDir,attrs,&result,sizeof(result),&searchCount,FIL_STANDARD);
    22342267
    22352268  //check root: skip "." and ".." (HPFS, not on FAT)
     
    22812314
    22822315  ULONG oldmode = SetErrorMode(SEM_FAILCRITICALERRORS_W);
    2283   APIRET rc = DosFindFirst((PSZ)lpFileName,&hDir,attrs,result,searchCount*sizeof(FILEFINDBUF3),&searchCount,FIL_STANDARD);
     2316  char  lOemFileName[260];       
     2317
     2318  CharToOemA(lpFileName, lOemFileName);
     2319  APIRET rc = DosFindFirst((PSZ)lOemFileName,&hDir,attrs,result,searchCount*sizeof(FILEFINDBUF3),&searchCount,FIL_STANDARD);
    22842320  SetErrorMode(oldmode);
    22852321  if (rc)
Note: See TracChangeset for help on using the changeset viewer.