Ignore:
Timestamp:
Sep 18, 2003, 4:21:07 PM (22 years ago)
Author:
sandervl
Message:

KOM: DBCS fixes

File:
1 edited

Legend:

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

    r7883 r10251  
    1 /* $Id: atom.cpp,v 1.12 2002-02-12 11:43:31 sandervl Exp $ */
     1/* $Id: atom.cpp,v 1.13 2003-09-18 14:21:07 sandervl Exp $ */
    22
    33/*
     
    2121#include <misc.h>
    2222
    23 #define DBG_LOCALLOG    DBG_atom
     23#define DBG_LOCALLOG    DBG_atom
    2424#include "dbglocal.h"
    2525
     
    5454{
    5555    if(privateAtomTable == NULL) {
    56         privateAtomTable = WinCreateAtomTable(0, 37); 
     56        privateAtomTable = WinCreateAtomTable(0, 37);
    5757    }
    5858    return privateAtomTable;
     
    6363{
    6464    if(systemAtomTable == NULL) {
    65         systemAtomTable = WinQuerySystemAtomTable(); 
     65        systemAtomTable = WinQuerySystemAtomTable();
    6666    }
    6767    return systemAtomTable;
     
    8181//******************************************************************************
    8282ATOM WIN32API FindAtomA( LPCSTR atomName)
    83 { 
     83{
    8484    HATOMTBL atomTable = getPrivateAtomTable();
    8585    ATOM     atom = 0;
    86  
     86
    8787    if(HIWORD(atomName)) {
    8888         dprintf(("FindAtomA %s", atomName));
     
    9191
    9292    if(atomTable != NULL) {
    93         atom = LookupAtom(atomTable, HIWORD(atomName) ? 
     93        atom = LookupAtom(atomTable, HIWORD(atomName) ?
    9494                          (PSZ) atomName : (PSZ) (LOWORD(atomName) | 0xFFFF0000),
    9595                          LOOKUP_FIND | LOOKUP_NOCASE);
     
    130130    if(atomTable != NULL)
    131131    {
    132         atom = LookupAtom(atomTable, HIWORD(atomName) ? 
     132        atom = LookupAtom(atomTable, HIWORD(atomName) ?
    133133                          (PSZ) atomName : (PSZ) (LOWORD(atomName) | 0xFFFF0000),
    134134                          LOOKUP_ADD | LOOKUP_NOCASE);
     
    136136
    137137    if(HIWORD(atomName)) {
    138         dprintf(("KERNEL32: AddAtomA %s returned %x", atomName, atom));
     138        dprintf(("KERNEL32: AddAtomA %s returned %x", atomName, atom));
    139139    }
    140140    else dprintf(("KERNEL32: AddAtomA %x returned %x", atomName, atom));
     
    191191
    192192    dprintf(("KERNEL32: GetAtomNameW %x %x %d", atom, lpszBuffer, cchBuffer));
    193     astring = (char *)alloca(cchBuffer);
     193    astring = (char *)alloca(cchBuffer * sizeof( WCHAR ));
    194194    if(astring == NULL) {
    195         dprintf(("GlobalGetAtomNameW: alloca failed!!"));
    196         DebugInt3();
    197         return 0;
    198     }
    199     rc = GetAtomNameA(atom, astring, cchBuffer);
     195    dprintf(("GlobalGetAtomNameW: alloca failed!!"));
     196    DebugInt3();
     197    return 0;
     198    }
     199    rc = GetAtomNameA(atom, astring, cchBuffer * sizeof( WCHAR ));
    200200    if(rc) {
    201          lstrcpyAtoW(lpszBuffer, astring);
     201         lstrcpynAtoW(lpszBuffer, astring, cchBuffer);
    202202    }
    203203    else lpszBuffer[0] = 0; //necessary?
    204     return rc;
     204    return lstrlenW( lpszBuffer );
    205205}
    206206//******************************************************************************
     
    236236    if(atomTable != NULL)
    237237    {
    238         atom = LookupAtom(atomTable, HIWORD(atomName) ? 
     238        atom = LookupAtom(atomTable, HIWORD(atomName) ?
    239239                          (PSZ) atomName : (PSZ) (LOWORD(atomName) | 0xFFFF0000),
    240240                          LOOKUP_ADD | LOOKUP_NOCASE);
     
    242242
    243243    if(HIWORD(atomName)) {
    244         dprintf(("KERNEL32: GlobalAddAtomA %s returned %x", atomName, atom));
     244        dprintf(("KERNEL32: GlobalAddAtomA %s returned %x", atomName, atom));
    245245    }
    246246    else dprintf(("KERNEL32: GlobalAddAtomA %x returned %x", atomName, atom));
     
    283283    else dprintf(("KERNEL32: GlobalFindAtomA %x", atomName));
    284284
    285     atom = LookupAtom(atomTable, HIWORD(atomName) ? 
     285    atom = LookupAtom(atomTable, HIWORD(atomName) ?
    286286                      (PSZ) atomName : (PSZ) (LOWORD(atomName) | 0xFFFF0000),
    287287                      LOOKUP_FIND | LOOKUP_NOCASE);
     
    340340
    341341    dprintf(("KERNEL32: GlobalGetAtomNameW %x %x %d", atom, lpszBuffer, cchBuffer));
    342     astring = (char *)alloca(cchBuffer);
     342    astring = (char *)alloca(cchBuffer * sizeof( WCHAR ));
    343343    if(astring == NULL) {
    344         dprintf(("GlobalGetAtomNameW: alloca failed!!"));
    345         DebugInt3();
    346         return 0;
    347     }
    348     rc = GlobalGetAtomNameA(atom, astring, cchBuffer);
     344    dprintf(("GlobalGetAtomNameW: alloca failed!!"));
     345    DebugInt3();
     346    return 0;
     347    }
     348    rc = GlobalGetAtomNameA(atom, astring, cchBuffer * sizeof( WCHAR ));
    349349    if(rc) {
    350          lstrcpyAtoW(lpszBuffer, astring);
     350         lstrcpynAtoW(lpszBuffer, astring, cchBuffer);
    351351    }
    352352    else lpszBuffer[0] = 0; //necessary?
    353     return rc;
    354 }
    355 //******************************************************************************
    356 //******************************************************************************
     353    return lstrlenW( lpszBuffer );
     354}
     355//******************************************************************************
     356//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.