diff --git a/dlls/avifil32/avifile.c b/dlls/avifil32/avifile.c index 41265e8d303..a7d838d5817 100644 --- a/dlls/avifil32/avifile.c +++ b/dlls/avifil32/avifile.c @@ -6,7 +6,7 @@ #include #include "winbase.h" -#include "wine/winestring.h" +#include "winnls.h" #include "mmsystem.h" #include "winerror.h" #include "debugtools.h" @@ -372,7 +372,8 @@ HRESULT WINAPI AVIFileCreateStreamA(PAVIFILE iface,PAVISTREAM *ppavi,AVISTREAMIN /* Only the szName at the end is different */ memcpy(&psiw,psi,sizeof(*psi)-sizeof(psi->szName)); - lstrcpynAtoW(psiw.szName,psi->szName,sizeof(psi->szName)); + MultiByteToWideChar( CP_ACP, 0, psi->szName, -1, + psiw.szName, sizeof(psiw.szName) / sizeof(WCHAR) ); return IAVIFile_CreateStream(iface,ppavi,&psiw); } @@ -402,7 +403,9 @@ HRESULT WINAPI AVIFileInfoA(PAVIFILE iface,LPAVIFILEINFOA afi,LONG size) { return AVIERR_BADSIZE; hres = IAVIFile_Info(iface,&afiw,sizeof(afiw)); memcpy(afi,&afiw,sizeof(*afi)-sizeof(afi->szFileType)); - lstrcpynWtoA(afi->szFileType,afiw.szFileType,sizeof(afi->szFileType)); + WideCharToMultiByte( CP_ACP, 0, afiw.szFileType, -1, + afi->szFileType, sizeof(afi->szFileType), NULL, NULL ); + afi->szFileType[sizeof(afi->szFileType)-1] = 0; return hres; } @@ -426,7 +429,9 @@ HRESULT WINAPI AVIStreamInfoA(PAVISTREAM iface,AVISTREAMINFOA *asi,LONG return AVIERR_BADSIZE; hres = IAVIFile_Info(iface,&asiw,sizeof(asiw)); memcpy(asi,&asiw,sizeof(asiw)-sizeof(asiw.szName)); - lstrcpynWtoA(asi->szName,asiw.szName,sizeof(asi->szName)); + WideCharToMultiByte( CP_ACP, 0, asiw.szName, -1, + asi->szName, sizeof(asi->szName), NULL, NULL ); + asi->szName[sizeof(asi->szName)-1] = 0; return hres; } diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c index 3ead55c2372..aa35d60cbbd 100644 --- a/dlls/dplayx/dplay.c +++ b/dlls/dplayx/dplay.c @@ -10,8 +10,9 @@ #include "winbase.h" #include "winnt.h" #include "winreg.h" -#include "dplay.h" +#include "wine/unicode.h" #include "heap.h" +#include "dplay.h" #include "debugtools.h" #include "dpinit.h" @@ -21,7 +22,7 @@ #include "dplaysp.h" #include "dplay_global.h" -DEFAULT_DEBUG_CHANNEL(dplay) +DEFAULT_DEBUG_CHANNEL(dplay); /* FIXME: Should this be externed? */ extern HRESULT DPL_CreateCompoundAddress @@ -1224,30 +1225,30 @@ static BOOL DP_CopyDPNAMEStruct( LPDPNAME lpDst, LPDPNAME lpSrc, BOOL bAnsi ) { if( lpSrc->psn.lpszShortNameA ) { - lpDst->psn.lpszShortNameA = - HEAP_strdupA( GetProcessHeap(), HEAP_ZERO_MEMORY, - lpSrc->psn.lpszShortNameA ); + lpDst->psn.lpszShortNameA = HeapAlloc( GetProcessHeap(), 0, + strlen(lpSrc->psn.lpszShortNameA)+1 ); + strcpy( lpDst->psn.lpszShortNameA, lpSrc->psn.lpszShortNameA ); } if( lpSrc->pln.lpszLongNameA ) { - lpDst->pln.lpszLongNameA = - HEAP_strdupA( GetProcessHeap(), HEAP_ZERO_MEMORY, - lpSrc->pln.lpszLongNameA ); + lpDst->pln.lpszLongNameA = HeapAlloc( GetProcessHeap(), 0, + strlen(lpSrc->pln.lpszLongNameA)+1 ); + strcpy( lpDst->pln.lpszLongNameA, lpSrc->pln.lpszLongNameA ); } } else { if( lpSrc->psn.lpszShortNameA ) { - lpDst->psn.lpszShortName = - HEAP_strdupW( GetProcessHeap(), HEAP_ZERO_MEMORY, - lpSrc->psn.lpszShortName ); + lpDst->psn.lpszShortName = HeapAlloc( GetProcessHeap(), 0, + (strlenW(lpSrc->psn.lpszShortName)+1)*sizeof(WCHAR) ); + strcpyW( lpDst->psn.lpszShortName, lpSrc->psn.lpszShortName ); } if( lpSrc->pln.lpszLongNameA ) { - lpDst->pln.lpszLongName = - HEAP_strdupW( GetProcessHeap(), HEAP_ZERO_MEMORY, - lpSrc->pln.lpszLongName ); + lpDst->pln.lpszLongName = HeapAlloc( GetProcessHeap(), 0, + (strlenW(lpSrc->pln.lpszLongName)+1)*sizeof(WCHAR) ); + strcpyW( lpDst->pln.lpszLongName, lpSrc->pln.lpszLongName ); } } diff --git a/dlls/imagehlp/access.c b/dlls/imagehlp/access.c index 30d23f3cb74..c6a53754c4c 100644 --- a/dlls/imagehlp/access.c +++ b/dlls/imagehlp/access.c @@ -8,7 +8,6 @@ #include "winnt.h" #include "winerror.h" #include "windef.h" -#include "heap.h" #include "debugtools.h" #include "imagehlp.h" @@ -240,8 +239,8 @@ BOOL WINAPI MapAndLoad( pNtHeader = ImageNtHeader((PVOID) hModule); - pLoadedImage->ModuleName = - HEAP_strdupA(IMAGEHLP_hHeap, 0, pszDllPath); /* FIXME: Correct? */ + pLoadedImage->ModuleName = HeapAlloc(IMAGEHLP_hHeap, 0, strlen(pszDllPath)+1); /* FIXME: Correct? */ + strcpy( pLoadedImage->ModuleName, pszDllPath ); pLoadedImage->hFile = hFile; pLoadedImage->MappedAddress = (PUCHAR) hModule; pLoadedImage->FileHeader = pNtHeader; diff --git a/dlls/msacm/internal.c b/dlls/msacm/internal.c index 293513cf217..4f6924c1b18 100644 --- a/dlls/msacm/internal.c +++ b/dlls/msacm/internal.c @@ -14,14 +14,13 @@ #include "wingdi.h" #include "winuser.h" #include "winerror.h" -#include "heap.h" #include "mmsystem.h" #include "msacm.h" #include "msacmdrv.h" #include "wineacm.h" #include "debugtools.h" -DEFAULT_DEBUG_CHANNEL(msacm) +DEFAULT_DEBUG_CHANNEL(msacm); /**********************************************************************/ @@ -42,8 +41,18 @@ PWINE_ACMDRIVERID MSACM_RegisterDriver(LPSTR pszDriverAlias, LPSTR pszFileName, padid = (PWINE_ACMDRIVERID) HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVERID)); padid->obj.dwType = WINE_ACMOBJ_DRIVERID; padid->obj.pACMDriverID = padid; - padid->pszDriverAlias = pszDriverAlias ? HEAP_strdupA(MSACM_hHeap, 0, pszDriverAlias) : NULL; - padid->pszFileName = pszFileName ? HEAP_strdupA(MSACM_hHeap, 0, pszFileName) : NULL; + padid->pszDriverAlias = NULL; + if (pszDriverAlias) + { + padid->pszDriverAlias = HeapAlloc( MSACM_hHeap, 0, strlen(pszDriverAlias)+1 ); + strcpy( padid->pszDriverAlias, pszDriverAlias ); + } + padid->pszFileName = NULL; + if (pszFileName) + { + padid->pszFileName = HeapAlloc( MSACM_hHeap, 0, strlen(pszFileName)+1 ); + strcpy( padid->pszFileName, pszFileName ); + } padid->hInstModule = hinstModule; padid->bEnabled = TRUE; padid->pACMDriverList = NULL; diff --git a/dlls/setupapi/infparse.c b/dlls/setupapi/infparse.c index f703cd14ea1..4bde7e17136 100644 --- a/dlls/setupapi/infparse.c +++ b/dlls/setupapi/infparse.c @@ -33,7 +33,9 @@ RETERR16 IP_OpenInf(LPCSTR lpInfFileName, HINF16 *lphInf) InfList = HeapReAlloc(GetProcessHeap(), 0, InfList, InfNumEntries+1); InfList[InfNumEntries].hInf = IP_curr_handle++; InfList[InfNumEntries].hInfFile = hFile; - InfList[InfNumEntries].lpInfFileName = HEAP_strdupA(GetProcessHeap(), 0, lpInfFileName); + InfList[InfNumEntries].lpInfFileName = HeapAlloc( GetProcessHeap(), 0, + strlen(lpInfFileName)+1); + strcpy( InfList[InfNumEntries].lpInfFileName, lpInfFileName ); *lphInf = InfList[InfNumEntries].hInf; InfNumEntries++; TRACE("ret handle %d.\n", *lphInf); @@ -110,6 +112,6 @@ RETERR16 WINAPI IpClose16(HINF16 hInf) RETERR16 WINAPI IpGetProfileString16(HINF16 hInf, LPCSTR section, LPCSTR entry, LPSTR buffer, WORD buflen) { TRACE("'%s': section '%s' entry '%s'\n", IP_GetFileName(hInf), section, entry); - GetPrivateProfileString16(section, entry, "", buffer, buflen, IP_GetFileName(hInf)); + GetPrivateProfileStringA(section, entry, "", buffer, buflen, IP_GetFileName(hInf)); return 0; } diff --git a/dlls/winmm/mciseq/mcimidi.c b/dlls/winmm/mciseq/mcimidi.c index db897344491..633e6f2f711 100644 --- a/dlls/winmm/mciseq/mcimidi.c +++ b/dlls/winmm/mciseq/mcimidi.c @@ -21,7 +21,6 @@ #include "wingdi.h" #include "winuser.h" #include "mmddk.h" -#include "heap.h" #include "debugtools.h" DEFAULT_DEBUG_CHANNEL(mcimidi); @@ -49,9 +48,9 @@ typedef struct tagWINE_MCIMIDI { WORD wNotifyDeviceID; /* MCI device ID with a pending notification */ HANDLE hCallback; /* Callback handle for pending notification */ HMMIO hFile; /* mmio file handle open as Element */ - LPCSTR lpstrElementName; /* Name of file */ - LPCSTR lpstrCopyright; - LPCSTR lpstrName; + LPSTR lpstrElementName; /* Name of file */ + LPSTR lpstrCopyright; + LPSTR lpstrName; WORD dwStatus; /* one from MCI_MODE_xxxx */ DWORD dwMciTimeFormat; /* One of the supported MCI_FORMAT_xxxx */ WORD wFormat; /* Format of MIDI hFile (0, 1 or 2) */ @@ -396,14 +395,16 @@ static DWORD MIDI_mciReadMTrk(WINE_MCIMIDI* wmm, MCI_MIDITRACK* mmt) if (wmm->lpstrCopyright) { WARN("Two copyright notices (%s|%s)\n", wmm->lpstrCopyright, buf); } else { - wmm->lpstrCopyright = HEAP_strdupA(GetProcessHeap(), 0, buf); + wmm->lpstrCopyright = HeapAlloc( GetProcessHeap(), 0, strlen(buf)+1 ); + strcpy( wmm->lpstrCopyright, buf ); } break; case 0x03: if (wmm->lpstrCopyright) { WARN("Two names (%s|%s)\n", wmm->lpstrName, buf); } else { - wmm->lpstrName = HEAP_strdupA(GetProcessHeap(), 0, buf); + wmm->lpstrName = HeapAlloc( GetProcessHeap(), 0, strlen(buf)+1 ); + strcpy( wmm->lpstrName, buf ); } break; } @@ -733,7 +734,8 @@ static DWORD MIDI_mciOpen(UINT wDevID, DWORD dwFlags, LPMCI_OPEN_PARMSA lpParms) TRACE("hFile=%u\n", wmm->hFile); /* FIXME: should I get a strdup() of it instead? */ - wmm->lpstrElementName = HEAP_strdupA(GetProcessHeap(), 0, lpParms->lpstrElementName); + wmm->lpstrElementName = HeapAlloc( GetProcessHeap(), 0, strlen(lpParms->lpstrElementName)+1 ); + strcpy( wmm->lpstrElementName, lpParms->lpstrElementName ); wmm->lpstrCopyright = NULL; wmm->lpstrName = NULL; diff --git a/dlls/winspool/info.c b/dlls/winspool/info.c index c5d3df4dbc2..ebb110b4905 100644 --- a/dlls/winspool/info.c +++ b/dlls/winspool/info.c @@ -498,8 +498,9 @@ BOOL WINAPI OpenPrinterW(LPWSTR lpPrinterName,HANDLE *phPrinter, } /* Get the name of the printer */ - lpOpenedPrinter->lpsPrinterName = - HEAP_strdupW( GetProcessHeap(), 0, lpPrinterName ); + lpOpenedPrinter->lpsPrinterName = HeapAlloc( GetProcessHeap(), 0, + (strlenW(lpPrinterName)+1)*sizeof(WCHAR) ); + strcpyW( lpOpenedPrinter->lpsPrinterName, lpPrinterName ); /* Get the unique handle of the printer*/ *phPrinter = lpOpenedPrinter->hPrinter; diff --git a/graphics/x11drv/dib.c b/graphics/x11drv/dib.c index b1812bc1f9b..0dee54399a5 100644 --- a/graphics/x11drv/dib.c +++ b/graphics/x11drv/dib.c @@ -3603,7 +3603,7 @@ void X11DRV_DIB_DeleteDIBSection(BITMAPOBJ *bmp) if (dib->selector) { - WORD count = (GET_SEL_LIMIT( dib->selector ) >> 16) + 1; + WORD count = (GetSelectorLimit16( dib->selector ) >> 16) + 1; SELECTOR_FreeBlock( dib->selector, count ); } } diff --git a/memory/global.c b/memory/global.c index 18b1401d390..3d9dce24074 100644 --- a/memory/global.c +++ b/memory/global.c @@ -136,7 +136,7 @@ HGLOBAL16 GLOBAL_CreateBlock( WORD flags, const void *ptr, DWORD size, /* Fill the arena block */ pArena->base = (DWORD)ptr; - pArena->size = GET_SEL_LIMIT(sel) + 1; + pArena->size = GetSelectorLimit16(sel) + 1; pArena->handle = (flags & GMEM_MOVEABLE) ? sel - 1 : sel; pArena->hOwner = hOwner; pArena->lockCount = 0; @@ -360,7 +360,7 @@ HGLOBAL16 WINAPI GlobalReAlloc16( if (pNewArena != pArena) memcpy( pNewArena, pArena, sizeof(GLOBALARENA) ); pNewArena->base = (DWORD)ptr; - pNewArena->size = GET_SEL_LIMIT(sel) + 1; + pNewArena->size = GetSelectorLimit16(sel) + 1; pNewArena->selCount = selcount; pNewArena->handle = (pNewArena->flags & GA_MOVEABLE) ? sel - 1 : sel; diff --git a/scheduler/thread.c b/scheduler/thread.c index 4b0f128a719..f0024c7ef0f 100644 --- a/scheduler/thread.c +++ b/scheduler/thread.c @@ -112,8 +112,8 @@ static void CALLBACK THREAD_FreeTEB( TEB *teb ) /* Free the associated memory */ if (teb->socket != -1) close( teb->socket ); - if (teb->stack_sel) SELECTOR_FreeBlock( teb->stack_sel, 1 ); - SELECTOR_FreeBlock( teb->teb_sel, 1 ); + if (teb->stack_sel) FreeSelector16( teb->stack_sel ); + FreeSelector16( teb->teb_sel ); if (teb->buffer) munmap( (void *)teb->buffer, (char *)(teb->buffer_info+1) - (char *)teb->buffer ); if (teb->debug_info) HeapFree( GetProcessHeap(), 0, teb->debug_info );