Replaced a few internal functions by exported ones.

This commit is contained in:
Alexandre Julliard 2000-11-13 04:16:05 +00:00
parent ccc538beac
commit 8c540c657e
10 changed files with 60 additions and 41 deletions

View File

@ -6,7 +6,7 @@
#include <assert.h>
#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;
}

View File

@ -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 );
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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 );
}
}

View File

@ -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;

View File

@ -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 );