Changeset 3461 for trunk/src


Ignore:
Timestamp:
Apr 29, 2000, 8:26:59 PM (25 years ago)
Author:
sandervl
Message:

init changes, export for installation program, create additional directories & registry keys, added lvl2 debug log feature, override for windows dir re-added

Location:
trunk/src/kernel32
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/KERNEL32.DEF

    r3375 r3461  
    1 ; $Id: KERNEL32.DEF,v 1.79 2000-04-14 22:35:26 sandervl Exp $
     1; $Id: KERNEL32.DEF,v 1.80 2000-04-29 18:26:56 sandervl Exp $
    22
    33;Created by BLAST for IBM's compiler
     
    10841084    _GetCPUFeatures       @2004
    10851085    CPUFeatures          @2005
     1086    InitSystemAndRegistry__Fv @2006
    10861087
    10871088;registry apis imported by advapi32
  • trunk/src/kernel32/cpu.cpp

    r2984 r3461  
    1 /* $Id: cpu.cpp,v 1.7 2000-03-03 11:15:57 sandervl Exp $ */
     1/* $Id: cpu.cpp,v 1.8 2000-04-29 18:26:57 sandervl Exp $ */
    22/*
    33 * Odin win32 CPU apis
     
    2727DEFAULT_DEBUG_CHANNEL(CPU)
    2828
    29 static BYTE PF[64] = {0,};
    30 static nrCPUs = 1;
     29static BYTE PF[64]          = {0,};
     30static nrCPUs               = 1;
     31static SYSTEM_INFO cachedsi = {0};
    3132
    3233//******************************************************************************
     
    6061VOID WINAPI GetSystemInfo(LPSYSTEM_INFO si)     /* [out] system information */
    6162{
     63 HKEY   xhkey=0,hkey;
     64 HKEY   fpukey=0, xhfpukey;
     65 char   buf[20];
     66 DWORD  features, signature;
    6267 static int cache = 0;
    63  static SYSTEM_INFO cachedsi;
    64  HKEY   xhkey=0,hkey;
    65  HKEY   fpukey=0, xhfpukey;
    66  char buf[20];
    67  DWORD features, signature;
    6868
    6969        if(!si) {
  • trunk/src/kernel32/dbglocal.cpp

    r3206 r3461  
    1 /* $Id: dbglocal.cpp,v 1.5 2000-03-23 19:23:44 sandervl Exp $ */
     1/* $Id: dbglocal.cpp,v 1.6 2000-04-29 18:26:57 sandervl Exp $ */
    22
    33/*
     
    1616#ifdef DEBUG
    1717
    18 USHORT DbgEnabled[DBG_MAXFILES];
     18USHORT DbgEnabled[DBG_MAXFILES] = {0};
     19USHORT DbgEnabledLvl2[DBG_MAXFILES] = {0};
     20
    1921char  *DbgFileNames[DBG_MAXFILES] =
    2022{
     
    122124{
    123125 char *envvar = getenv(DBG_ENVNAME);
     126 char *envvar2= getenv(DBG_ENVNAME_LVL2);
    124127 char *dbgvar;
    125128 int   i;
     
    129132    }
    130133
    131     if(!envvar)
    132         return;
    133 
    134     dbgvar = strstr(envvar, "dll");
    135     if(dbgvar) {
    136         if(*(dbgvar-1) == '-') {
    137             for(i=0;i<DBG_MAXFILES;i++) {
    138                 DbgEnabled[i] = 0;
    139             }
     134    if(envvar) {
     135        dbgvar = strstr(envvar, "dll");
     136        if(dbgvar) {
     137                if(*(dbgvar-1) == '-') {
     138                    for(i=0;i<DBG_MAXFILES;i++) {
     139                        DbgEnabled[i] = 0;
     140                    }
     141                }
     142        }
     143        for(i=0;i<DBG_MAXFILES;i++) {
     144                dbgvar = strstr(envvar, DbgFileNames[i]);
     145                if(dbgvar) {
     146                    if(*(dbgvar-1) == '-') {
     147                            DbgEnabled[i] = 0;
     148                    }
     149                    else   
     150                    if(*(dbgvar-1) == '+') {
     151                        DbgEnabled[i] = 1;
     152                    }
     153                }
    140154        }
    141155    }
    142     for(i=0;i<DBG_MAXFILES;i++) {
    143         dbgvar = strstr(envvar, DbgFileNames[i]);
    144         if(dbgvar) {
    145             if(*(dbgvar-1) == '-') {
    146                     DbgEnabled[i] = 0;
    147             }
    148             else   
    149             if(*(dbgvar-1) == '+') {
    150                 DbgEnabled[i] = 1;
    151             }
     156    if(envvar2) {
     157        dbgvar = strstr(envvar2, "dll");
     158        if(dbgvar) {
     159                if(*(dbgvar-1) == '+') {
     160                    for(i=0;i<DBG_MAXFILES;i++) {
     161                        DbgEnabledLvl2[i] = 1;
     162                    }
     163                }
     164        }
     165        for(i=0;i<DBG_MAXFILES;i++) {
     166                dbgvar = strstr(envvar2, DbgFileNames[i]);
     167                if(dbgvar) {
     168                    if(*(dbgvar-1) == '-') {
     169                            DbgEnabledLvl2[i] = 0;
     170                    }
     171                    else   
     172                    if(*(dbgvar-1) == '+') {
     173                        DbgEnabledLvl2[i] = 1;
     174                    }
     175                }
    152176        }
    153177    }
  • trunk/src/kernel32/dbglocal.h

    r3206 r3461  
    1 /* $Id: dbglocal.h,v 1.5 2000-03-23 19:23:45 sandervl Exp $ */
     1/* $Id: dbglocal.h,v 1.6 2000-04-29 18:26:58 sandervl Exp $ */
    22
    33/*
     
    1818
    1919#define DBG_ENVNAME        "dbg_kernel32"
     20#define DBG_ENVNAME_LVL2   "dbg_kernel32_lvl2"
    2021
    2122#define DBG_kernel32       0
     
    119120
    120121extern USHORT DbgEnabled[DBG_MAXFILES];
     122extern USHORT DbgEnabledLvl2[DBG_MAXFILES];
    121123
    122124#ifdef dprintf
     
    125127
    126128#define dprintf(a)      if(DbgEnabled[DBG_LOCALLOG] == 1) WriteLog a
     129
     130#ifdef dprintf2
     131#undef dprintf2
     132#endif
     133
     134#define dprintf2(a)     if(DbgEnabledLvl2[DBG_LOCALLOG] == 1) WriteLog a
    127135
    128136#else
  • trunk/src/kernel32/directory.cpp

    r3375 r3461  
    1 /* $Id: directory.cpp,v 1.19 2000-04-14 22:35:26 sandervl Exp $ */
     1/* $Id: directory.cpp,v 1.20 2000-04-29 18:26:58 sandervl Exp $ */
    22
    33/*
     
    6363void InitDirectories()
    6464{
    65         GetWindowsDirectoryA((LPSTR)&DIR_Windows, sizeof(DIR_Windows));
    66         GetSystemDirectoryA((LPSTR)&DIR_System, sizeof(DIR_System));
    67 }
    68 
     65 char *endofwinpath, *tmp;
     66 int   len;
     67
     68   strcpy(DIR_System, kernel32Path);
     69   len = strlen(DIR_System);
     70   if(DIR_System[len-1] == '\\') {
     71        DIR_System[len-1] = 0;
     72   }
     73   len = ODIN_PROFILE_GetOdinIniString(ODINDIRECTORIES,"WINDOWS","",DIR_Windows,sizeof(DIR_Windows));
     74   if (len > 2) {
     75        if(DIR_Windows[len-1] == '\\') {
     76                DIR_Windows[len-1] = 0;
     77        }
     78   }
     79   else {
     80        strcpy(DIR_Windows, DIR_System);
     81        endofwinpath = tmp = strchr(DIR_Windows, '\\');
     82        while(tmp) {
     83                tmp = strchr(endofwinpath+1, '\\');
     84                if(tmp)
     85                        endofwinpath = tmp;
     86        }
     87        if(endofwinpath) {
     88                *endofwinpath = 0; //remove \SYSTEM32
     89        }
     90        else DebugInt3();
     91   }
     92}
    6993/*****************************************************************************
    7094 * Name      : GetCurrentDirectoryA
     
    231255                                       UINT,uSize)
    232256{
    233   char buf[255];
    234   int  len;
    235 
    236         lstrcpynA(buf, kernel32Path, sizeof(buf)-1);
    237         len = lstrlenA(buf);;
    238         if(buf[len-1] == '\\') {
    239                 buf[len-1] = 0;
    240                 len--;
    241         }
     257 int   len;
     258 char *dir;
     259
     260        dir = InternalGetSystemDirectoryA();
     261        len = lstrlenA(dir);
    242262        if(lpBuffer)
    243                 lstrcpynA(lpBuffer, buf, uSize);
     263                lstrcpynA(lpBuffer, dir, uSize);
    244264        return len;
    245265}
     
    265285
    266286  if(lpBuffer)
    267         asciibuffer = (char *)malloc(uSize+1);
     287        asciibuffer = (char *)alloca(uSize+1);
     288
     289  if(lpBuffer && asciibuffer == NULL) {
     290        DebugInt3();
     291  }
    268292
    269293  rc = GetSystemDirectoryA(asciibuffer, uSize);
     
    271295        AsciiToUnicode(asciibuffer, lpBuffer);
    272296
    273   if(asciibuffer)
    274         free(asciibuffer);
    275297  return(rc);
    276298}
     
    292314                                        UINT,uSize)
    293315{
    294   static int fWindirExists = FALSE;
    295   CHAR  buf[255];
    296   int   len;
    297  
    298         //SvL: Use path of kernel32.dll instead of calling Open32 api (which returns \OS2\SYSTEM)
    299         lstrcpynA(buf, kernel32Path, sizeof(buf)-1);
    300         strcat(buf, "WIN");
    301         if(!fWindirExists) {
    302                 O32_CreateDirectory(buf, NULL);
    303                 fWindirExists = TRUE;
    304         }
    305 
    306         len = lstrlenA(buf);;
    307         if(buf[len-1] == '\\') {
    308                 buf[len-1] = 0;
    309                 len--;
    310         }
     316 char *dir;
     317 int   len;
     318
     319        dir = InternalGetWindowsDirectoryA();
     320        len = lstrlenA(dir);
    311321        if(lpBuffer)
    312                 lstrcpynA(lpBuffer, buf, uSize);
     322                lstrcpynA(lpBuffer, dir, uSize);
    313323        return len;
    314324}
     
    334344
    335345  if(lpBuffer)
    336         asciibuffer = (char *)malloc(uSize+1);
     346        asciibuffer = (char *)alloca(uSize+1);
     347
     348  if(lpBuffer && asciibuffer == NULL) {
     349        DebugInt3();
     350  }
    337351
    338352  rc = GetWindowsDirectoryA(asciibuffer, uSize);
     
    340354        AsciiToUnicode(asciibuffer, lpBuffer);
    341355
    342   if(asciibuffer)
    343         free(asciibuffer);
    344356  return(rc);
    345357}
  • trunk/src/kernel32/initsystem.cpp

    r3074 r3461  
    1 /* $Id: initsystem.cpp,v 1.8 2000-03-10 16:11:59 sandervl Exp $ */
     1/* $Id: initsystem.cpp,v 1.9 2000-04-29 18:26:58 sandervl Exp $ */
    22/*
    33 * Odin system initialization (registry & directories)
    44 *
     5 * Called from the WarpIn install program to create the desktop directories and
     6 * to setup the registry
     7 *
     8 * InitSystemAndRegistry creates:
     9 *      - WINDOWSDIR\SYSTEM
     10 *      - WINDOWSDIR\AppData
     11 *      - WINDOWSDIR\Cache
     12 *      - WINDOWSDIR\Cookies
     13 *      - WINDOWSDIR\Desktop
     14 *      - WINDOWSDIR\Favorites
     15 *      - WINDOWSDIR\Fonts
     16 *      - WINDOWSDIR\History
     17 *      - WINDOWSDIR\NetHood
     18 *      - WINDOWSDIR\My Documents
     19 *      - WINDOWSDIR\PrintHood
     20 *      - WINDOWSDIR\Recent
     21 *      - WINDOWSDIR\SendTo
     22 *      - WINDOWSDIR\Start Menu
     23 *      - WINDOWSDIR\Start Menu\Programs
     24 *      - WINDOWSDIR\Start Menu\Programs\Startup
     25 *      - WINDOWSDIR\ShellNew
     26 *      - and a minimal system registry
    527 *
    628 * NOTE: Most of this has to be moved into the Odin install program!!!!!
     
    2042#include "debugtools.h"
    2143#include "cpuhlp.h"
    22 #include "initsystem.h"
     44#include <odininst.h>
    2345#include "directory.h"
    2446#include <versionos2.h>
     
    4163#define INITREG_ERROR           "InitRegistry: Unable to register system information"
    4264
    43 BOOL InitRegistry();
    44 
    45 //******************************************************************************
    46 //******************************************************************************
    47 BOOL InitSystemEnvironment(ULONG nrCPUs)
    48 {
    49    InitSystemInfo(nrCPUs);
    50    return InitRegistry();
    51 }
     65//******************************************************************************
     66//******************************************************************************
    5267//******************************************************************************
    5368//[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Windows]
     
    6075BYTE ShutdownTime[] = {0x44,0x5e,0xf2,0xbb,0x84,0x41,0xbf,0x01};
    6176//******************************************************************************
    62 BOOL InitRegistry()
     77BOOL InitSystemAndRegistry()
    6378{
    6479 HKEY hkey, hkey1;
     
    127142//   if(RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &hkey) != ERROR_SUCCESS)
    128143//   {
     144        //SYSTEM dir
     145        strcpy(shellpath, InternalGetWindowsDirectoryA());
     146        strcat(shellpath, "\\SYSTEM");
     147        CreateDirectoryA(shellpath, NULL);
     148
     149        //AppData
     150        strcpy(shellpath, InternalGetWindowsDirectoryA());
     151        strcat(shellpath, "\\Application Data");
     152        CreateDirectoryA(shellpath, NULL);
     153        RegSetValueExA(hkey,"AppData",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     154        //Cache
     155        strcpy(shellpath, InternalGetWindowsDirectoryA());
     156        strcat(shellpath, "\\Temporary Internet Files");
     157        CreateDirectoryA(shellpath, NULL);
     158        RegSetValueExA(hkey,"Cache",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     159        //Cookies
     160        strcpy(shellpath, InternalGetWindowsDirectoryA());
     161        strcat(shellpath, "\\Cookies");
     162        CreateDirectoryA(shellpath, NULL);
     163        RegSetValueExA(hkey,"Cookies",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     164        //Desktop
     165        strcpy(shellpath, InternalGetWindowsDirectoryA());
     166        strcat(shellpath, "\\Desktop");
     167        CreateDirectoryA(shellpath, NULL);
     168        RegSetValueExA(hkey,"Desktop",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     169        //Favorites
    129170        strcpy(shellpath, InternalGetWindowsDirectoryA());
    130171        strcat(shellpath, "\\Favorites");
    131172        CreateDirectoryA(shellpath, NULL);
    132173        RegSetValueExA(hkey,"Favorites",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    133         strcpy(shellpath, InternalGetWindowsDirectoryA());
    134         strcat(shellpath, "\\Programs\\Startup");
     174        //Fonts
     175        strcpy(shellpath, InternalGetWindowsDirectoryA());
     176        strcat(shellpath, "\\Fonts");
     177        CreateDirectoryA(shellpath, NULL);
     178        RegSetValueExA(hkey,"Fonts",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     179        //History
     180        strcpy(shellpath, InternalGetWindowsDirectoryA());
     181        strcat(shellpath, "\\History");
     182        CreateDirectoryA(shellpath, NULL);
     183        RegSetValueExA(hkey,"History",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     184        //NetHood
     185        strcpy(shellpath, InternalGetWindowsDirectoryA());
     186        strcat(shellpath, "\\NetHood");
     187        CreateDirectoryA(shellpath, NULL);
     188        RegSetValueExA(hkey,"NetHood",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     189        //Personal
     190        strcpy(shellpath, InternalGetWindowsDirectoryA());
     191        strcat(shellpath, "\\My Documents");
     192        CreateDirectoryA(shellpath, NULL);
     193        RegSetValueExA(hkey,"Personal",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     194        //PrintHood
     195        strcpy(shellpath, InternalGetWindowsDirectoryA());
     196        strcat(shellpath, "\\PrintHood");
     197        CreateDirectoryA(shellpath, NULL);
     198        RegSetValueExA(hkey,"PrintHood",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     199        //Recent
     200        strcpy(shellpath, InternalGetWindowsDirectoryA());
     201        strcat(shellpath, "\\Recent");
     202        CreateDirectoryA(shellpath, NULL);
     203        RegSetValueExA(hkey,"Recent",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     204        //SendTo
     205        strcpy(shellpath, InternalGetWindowsDirectoryA());
     206        strcat(shellpath, "\\SendTo");
     207        CreateDirectoryA(shellpath, NULL);
     208        RegSetValueExA(hkey,"SendTo",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     209        //Start Menu
     210        strcpy(shellpath, InternalGetWindowsDirectoryA());
     211        strcat(shellpath, "\\Start Menu");
     212        CreateDirectoryA(shellpath, NULL);
     213        RegSetValueExA(hkey,"Start Menu",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     214        //Programs
     215        strcpy(shellpath, InternalGetWindowsDirectoryA());
     216        strcat(shellpath, "\\Start Menu\\Programs");
     217        CreateDirectoryA(shellpath, NULL);
     218        RegSetValueExA(hkey,"Programs",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     219        //Startup
     220        strcat(shellpath, "\\Startup");
    135221        CreateDirectoryA(shellpath, NULL);
    136222        RegSetValueExA(hkey,"Startup",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    137         strcpy(shellpath, InternalGetWindowsDirectoryA());
    138         strcat(shellpath, "\\Desktop");
    139         CreateDirectoryA(shellpath, NULL);
    140         RegSetValueExA(hkey,"Desktop",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    141         strcpy(shellpath, InternalGetWindowsDirectoryA());
    142         strcat(shellpath, "\\Start Menu\\Programs");
    143         CreateDirectoryA(shellpath, NULL);
    144         RegSetValueExA(hkey,"Programs",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    145         strcpy(shellpath, InternalGetWindowsDirectoryA());
    146         strcat(shellpath, "\\Fonts");
    147         CreateDirectoryA(shellpath, NULL);
    148         RegSetValueExA(hkey,"Fonts",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    149         strcpy(shellpath, InternalGetWindowsDirectoryA());
    150         strcat(shellpath, "\\SendTo");
    151         CreateDirectoryA(shellpath, NULL);
    152         RegSetValueExA(hkey,"SendTo",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    153         strcpy(shellpath, InternalGetWindowsDirectoryA());
    154         strcat(shellpath, "\\Start Menu");
    155         CreateDirectoryA(shellpath, NULL);
    156         RegSetValueExA(hkey,"Start Menu",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     223        //ShellNew
    157224        strcpy(shellpath, InternalGetWindowsDirectoryA());
    158225        strcat(shellpath, "\\ShellNew");
    159226        CreateDirectoryA(shellpath, NULL);
    160227        RegSetValueExA(hkey,"Templates",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    161         strcpy(shellpath, InternalGetWindowsDirectoryA());
    162         strcat(shellpath, "\\Recent");
    163         CreateDirectoryA(shellpath, NULL);
    164         RegSetValueExA(hkey,"Recent",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    165         strcpy(shellpath, InternalGetWindowsDirectoryA());
    166         strcat(shellpath, "\\NetHood");
    167         CreateDirectoryA(shellpath, NULL);
    168         RegSetValueExA(hkey,"NetHood",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    169         strcpy(shellpath, InternalGetWindowsDirectoryA());
    170         strcat(shellpath, "\\My Documents");
    171         CreateDirectoryA(shellpath, NULL);
    172         RegSetValueExA(hkey,"Personal",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    173228//   }
    174229   RegCloseKey(hkey);
  • trunk/src/kernel32/initterm.cpp

    r3375 r3461  
    1 /* $Id: initterm.cpp,v 1.40 2000-04-14 22:35:27 sandervl Exp $ */
     1/* $Id: initterm.cpp,v 1.41 2000-04-29 18:26:59 sandervl Exp $ */
    22
    33/*
     
    4848#include <windllbase.h>
    4949#include "winexepe2lx.h"
    50 #include "initsystem.h"
    5150#include <exitlist.h>
    5251#include "oslibdos.h"
     52#include <cpuhlp.h>
     53
    5354#define DBG_LOCALLOG    DBG_initterm
    5455#include "dbglocal.h"
     
    170171                ulSysinfo = 1;
    171172
    172             InitSystemEnvironment(ulSysinfo);
     173            InitSystemInfo(ulSysinfo);
    173174            break;
    174175        }
  • trunk/src/kernel32/unicode.cpp

    r2803 r3461  
    1 /* $Id: unicode.cpp,v 1.22 2000-02-16 14:25:45 sandervl Exp $ */
     1/* $Id: unicode.cpp,v 1.23 2000-04-29 18:26:59 sandervl Exp $ */
    22
    33/*
     
    7777 */
    7878INT WINAPI MultiByteToWideChar(UINT page, DWORD flags,
    79                      LPCSTR src, INT srclen,
    80                                  LPWSTR dst, INT dstlen)
     79                               LPCSTR src, INT srclen,
     80                               LPWSTR dst, INT dstlen)
    8181{
    8282    int ret;
    8383
     84    dprintf2(("MultiByteToWideChar: %d %x (%s %d) (%x %d)", page, flags, src, srclen, dst, dstlen));
    8485    if (srclen == -1)
    85     srclen = lstrlenA(src)+1;
     86        srclen = lstrlenA(src)+1;
    8687    if (!dstlen || !dst)
    87     return srclen;
     88        return srclen;
    8889
    8990    ret = srclen;
    9091    while (srclen && dstlen) {
    91     *dst = (WCHAR)(unsigned char)*src;
    92     dst++;    src++;
    93     dstlen--; srclen--;
     92        *dst = (WCHAR)(unsigned char)*src;
     93        dst++;    src++;
     94        dstlen--; srclen--;
    9495    }
    9596    if (!dstlen && srclen) {
    96     SetLastError(ERROR_INSUFFICIENT_BUFFER);
    97     return 0;
     97        SetLastError(ERROR_INSUFFICIENT_BUFFER);
     98        return 0;
    9899    }
    99100    return ret;
     
    141142    int dont_copy= (dstlen==0);
    142143
     144    dprintf2(("WideCharToMultiByte: %d %x (%x %d) (%x %d)", page, flags, src, srclen, dst, dstlen));
     145
    143146    if ((!src) || ((!dst) && (!dont_copy)) )
    144     {   SetLastError(ERROR_INVALID_PARAMETER);
    145     return 0;
     147    {   
     148        SetLastError(ERROR_INVALID_PARAMETER);
     149        return 0;
    146150    }
    147151
     
    161165    while(srclen && (dont_copy || dstlen))
    162166    {
    163     if(!dont_copy){
    164         if(*src<256)
    165         *dst = *src;
    166         else
    167         {
    168         /* ??? The WC_DEFAULTCHAR flag only gets used in
    169         * combination with the WC_COMPOSITECHECK flag or at
    170          * least this is what it seems from using the function
    171          * on NT4.0 in combination with reading the documentation.
    172          */
    173         *dst = defchar ? *defchar : '?';
    174         if(used)*used=1;
    175         }
    176         dstlen--;
    177         dst++;
    178     }
    179     count++;
    180     srclen--;
    181     if((!*src) && care_for_eos) {
    182         eos = 1;
    183         break;
    184     }
    185     src++;
     167        if(!dont_copy){
     168                if(*src<256)
     169                        *dst = *src;
     170                else
     171                {
     172                /* ??? The WC_DEFAULTCHAR flag only gets used in
     173                * combination with the WC_COMPOSITECHECK flag or at
     174                 * least this is what it seems from using the function
     175                 * on NT4.0 in combination with reading the documentation.
     176                 */
     177                        *dst = defchar ? *defchar : '?';
     178                        if(used)*used=1;
     179                }
     180                dstlen--;
     181                dst++;
     182        }
     183        count++;
     184        srclen--;
     185        if((!*src) && care_for_eos) {
     186                eos = 1;
     187                break;
     188        }
     189        src++;
    186190    }
    187191    if (dont_copy)
    188     return count;
     192        return count;
    189193
    190194    if (!eos && srclen > 0) {
    191     SetLastError(ERROR_INSUFFICIENT_BUFFER);
    192     return 0;
     195        SetLastError(ERROR_INSUFFICIENT_BUFFER);
     196        return 0;
    193197    }
    194198    return count;
Note: See TracChangeset for help on using the changeset viewer.