Moved SystemHeap allocations to the process heap.

This commit is contained in:
Alexandre Julliard 2000-02-16 22:47:24 +00:00
parent 6fdb5ddc0c
commit 90476d6b4a
38 changed files with 738 additions and 786 deletions

View File

@ -733,7 +733,7 @@ LsaQueryInformationPolicy(
{ {
case PolicyAuditEventsInformation: /* 2 */ case PolicyAuditEventsInformation: /* 2 */
{ {
PPOLICY_AUDIT_EVENTS_INFO p = HeapAlloc(SystemHeap, HEAP_ZERO_MEMORY, sizeof(POLICY_AUDIT_EVENTS_INFO)); PPOLICY_AUDIT_EVENTS_INFO p = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(POLICY_AUDIT_EVENTS_INFO));
p->AuditingMode = FALSE; /* no auditing */ p->AuditingMode = FALSE; /* no auditing */
*Buffer = p; *Buffer = p;
} }
@ -747,7 +747,7 @@ LsaQueryInformationPolicy(
}; };
SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY}; SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY};
struct di * xdi = HeapAlloc(SystemHeap, HEAP_ZERO_MEMORY, sizeof(xdi)); struct di * xdi = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(xdi));
RtlInitUnicodeString(&(xdi->ppdi.Name), HEAP_strdupAtoW(GetProcessHeap(),0,"DOMAIN")); RtlInitUnicodeString(&(xdi->ppdi.Name), HEAP_strdupAtoW(GetProcessHeap(),0,"DOMAIN"));
xdi->ppdi.Sid = &(xdi->sid); xdi->ppdi.Sid = &(xdi->sid);
xdi->sid.Revision = SID_REVISION; xdi->sid.Revision = SID_REVISION;
@ -816,7 +816,7 @@ NTSTATUS WINAPI
LsaFreeMemory(IN PVOID Buffer) LsaFreeMemory(IN PVOID Buffer)
{ {
TRACE("(%p)\n",Buffer); TRACE("(%p)\n",Buffer);
return HeapFree(SystemHeap, 0, Buffer); return HeapFree(GetProcessHeap(), 0, Buffer);
} }
/****************************************************************************** /******************************************************************************
* LsaClose [ADVAPI32.243] * LsaClose [ADVAPI32.243]

View File

@ -177,7 +177,7 @@ HFILE WINAPI LZInit( HFILE hfSrc )
} }
for (i = 0; i < MAX_LZSTATES; i++) if (!lzstates[i]) break; for (i = 0; i < MAX_LZSTATES; i++) if (!lzstates[i]) break;
if (i == MAX_LZSTATES) return LZERROR_GLOBALLOC; if (i == MAX_LZSTATES) return LZERROR_GLOBALLOC;
lzstates[i] = lzs = HeapAlloc( SystemHeap, 0, sizeof(struct lzstate) ); lzstates[i] = lzs = HeapAlloc( GetProcessHeap(), 0, sizeof(struct lzstate) );
memset(lzs,'\0',sizeof(*lzs)); memset(lzs,'\0',sizeof(*lzs));
lzs->realfd = hfSrc; lzs->realfd = hfSrc;
@ -637,7 +637,7 @@ void WINAPI LZClose( HFILE fd )
if (lzs->get) HeapFree( GetProcessHeap(), 0, lzs->get ); if (lzs->get) HeapFree( GetProcessHeap(), 0, lzs->get );
CloseHandle(lzs->realfd); CloseHandle(lzs->realfd);
lzstates[fd - 0x400] = NULL; lzstates[fd - 0x400] = NULL;
HeapFree( SystemHeap, 0, lzs ); HeapFree( GetProcessHeap(), 0, lzs );
} }
} }

View File

@ -18,7 +18,7 @@ DEFAULT_DEBUG_CHANNEL(mpr)
*/ */
LPVOID WINAPI MPR_Alloc( DWORD dwSize ) LPVOID WINAPI MPR_Alloc( DWORD dwSize )
{ {
return HeapAlloc( SystemHeap, HEAP_ZERO_MEMORY, dwSize ); return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize );
} }
/***************************************************************** /*****************************************************************
@ -27,9 +27,9 @@ LPVOID WINAPI MPR_Alloc( DWORD dwSize )
LPVOID WINAPI MPR_ReAlloc( LPVOID lpSrc, DWORD dwSize ) LPVOID WINAPI MPR_ReAlloc( LPVOID lpSrc, DWORD dwSize )
{ {
if ( lpSrc ) if ( lpSrc )
return HeapReAlloc( SystemHeap, HEAP_ZERO_MEMORY, lpSrc, dwSize ); return HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, lpSrc, dwSize );
else else
return HeapAlloc( SystemHeap, HEAP_ZERO_MEMORY, dwSize ); return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize );
} }
/***************************************************************** /*****************************************************************
@ -38,7 +38,7 @@ LPVOID WINAPI MPR_ReAlloc( LPVOID lpSrc, DWORD dwSize )
BOOL WINAPI MPR_Free( LPVOID lpMem ) BOOL WINAPI MPR_Free( LPVOID lpMem )
{ {
if ( lpMem ) if ( lpMem )
return HeapFree( SystemHeap, 0, lpMem ); return HeapFree( GetProcessHeap(), 0, lpMem );
else else
return FALSE; return FALSE;
} }

View File

@ -80,7 +80,7 @@ ASPI_OpenDevice16(SRB_ExecSCSICmd16 *prb)
} }
/* device is now open */ /* device is now open */
curr = HeapAlloc( SystemHeap, 0, sizeof(ASPI_DEVICE_INFO) ); curr = HeapAlloc( GetProcessHeap(), 0, sizeof(ASPI_DEVICE_INFO) );
curr->fd = fd; curr->fd = fd;
curr->hostId = prb->SRB_HaId; curr->hostId = prb->SRB_HaId;
curr->target = prb->SRB_Target; curr->target = prb->SRB_Target;

View File

@ -2211,7 +2211,7 @@ static BOOL MMDRV_InitPerType(LPWINE_MM_DRIVER lpDrv, UINT num,
lpDrv->name, llTypes[type].name); lpDrv->name, llTypes[type].name);
/* realloc translation table */ /* realloc translation table */
llTypes[type].lpMlds = (LPWINE_MLD) llTypes[type].lpMlds = (LPWINE_MLD)
HeapReAlloc(SystemHeap, 0, (llTypes[type].lpMlds) ? llTypes[type].lpMlds - 1 : NULL, HeapReAlloc(GetProcessHeap(), 0, (llTypes[type].lpMlds) ? llTypes[type].lpMlds - 1 : NULL,
sizeof(WINE_MLD) * (llTypes[type].wMaxId + 1)) + 1; sizeof(WINE_MLD) * (llTypes[type].wMaxId + 1)) + 1;
/* re-build the translation table */ /* re-build the translation table */
if (llTypes[type].nMapper != -1) { if (llTypes[type].nMapper != -1) {

View File

@ -341,7 +341,7 @@ static UINT MCI_SetCommandTable(LPWINE_MM_IDATA iData, HANDLE hMem,
count++; count++;
} while (eid != MCI_END_COMMAND_LIST); } while (eid != MCI_END_COMMAND_LIST);
S_MciCmdTable[uTbl].aVerbs = HeapAlloc(SystemHeap, 0, count * sizeof(LPCSTR)); S_MciCmdTable[uTbl].aVerbs = HeapAlloc(GetProcessHeap(), 0, count * sizeof(LPCSTR));
S_MciCmdTable[uTbl].nVerbs = count; S_MciCmdTable[uTbl].nVerbs = count;
lmem = S_MciCmdTable[uTbl].lpTable; lmem = S_MciCmdTable[uTbl].lpTable;
@ -373,7 +373,7 @@ static BOOL MCI_DeleteCommandTable(UINT uTbl)
FreeResource16(S_MciCmdTable[uTbl].hMem); FreeResource16(S_MciCmdTable[uTbl].hMem);
S_MciCmdTable[uTbl].hMem = 0; S_MciCmdTable[uTbl].hMem = 0;
if (S_MciCmdTable[uTbl].aVerbs) { if (S_MciCmdTable[uTbl].aVerbs) {
HeapFree(SystemHeap, 0, S_MciCmdTable[uTbl].aVerbs); HeapFree(GetProcessHeap(), 0, S_MciCmdTable[uTbl].aVerbs);
S_MciCmdTable[uTbl].aVerbs = 0; S_MciCmdTable[uTbl].aVerbs = 0;
} }
return TRUE; return TRUE;
@ -1121,7 +1121,7 @@ static MCI_MapType MCI_MapMsg16To32A(WORD uDevType, WORD wMsg, DWORD* lParam)
break; break;
case MCI_BREAK: case MCI_BREAK:
{ {
LPMCI_BREAK_PARMS mbp32 = HeapAlloc(SystemHeap, 0, sizeof(MCI_BREAK_PARMS)); LPMCI_BREAK_PARMS mbp32 = HeapAlloc(GetProcessHeap(), 0, sizeof(MCI_BREAK_PARMS));
LPMCI_BREAK_PARMS16 mbp16 = PTR_SEG_TO_LIN(*lParam); LPMCI_BREAK_PARMS16 mbp16 = PTR_SEG_TO_LIN(*lParam);
if (mbp32) { if (mbp32) {
@ -1136,7 +1136,7 @@ static MCI_MapType MCI_MapMsg16To32A(WORD uDevType, WORD wMsg, DWORD* lParam)
return MCI_MAP_OKMEM; return MCI_MAP_OKMEM;
case MCI_ESCAPE: case MCI_ESCAPE:
{ {
LPMCI_VD_ESCAPE_PARMSA mvep32a = HeapAlloc(SystemHeap, 0, sizeof(MCI_VD_ESCAPE_PARMSA)); LPMCI_VD_ESCAPE_PARMSA mvep32a = HeapAlloc(GetProcessHeap(), 0, sizeof(MCI_VD_ESCAPE_PARMSA));
LPMCI_VD_ESCAPE_PARMS16 mvep16 = PTR_SEG_TO_LIN(*lParam); LPMCI_VD_ESCAPE_PARMS16 mvep16 = PTR_SEG_TO_LIN(*lParam);
if (mvep32a) { if (mvep32a) {
@ -1150,7 +1150,7 @@ static MCI_MapType MCI_MapMsg16To32A(WORD uDevType, WORD wMsg, DWORD* lParam)
return MCI_MAP_OKMEM; return MCI_MAP_OKMEM;
case MCI_INFO: case MCI_INFO:
{ {
LPMCI_INFO_PARMSA mip32a = HeapAlloc(SystemHeap, 0, sizeof(MCI_INFO_PARMSA)); LPMCI_INFO_PARMSA mip32a = HeapAlloc(GetProcessHeap(), 0, sizeof(MCI_INFO_PARMSA));
LPMCI_INFO_PARMS16 mip16 = PTR_SEG_TO_LIN(*lParam); LPMCI_INFO_PARMS16 mip16 = PTR_SEG_TO_LIN(*lParam);
/* FIXME this is wrong if device is of type /* FIXME this is wrong if device is of type
@ -1169,7 +1169,7 @@ static MCI_MapType MCI_MapMsg16To32A(WORD uDevType, WORD wMsg, DWORD* lParam)
case MCI_OPEN: case MCI_OPEN:
case MCI_OPEN_DRIVER: case MCI_OPEN_DRIVER:
{ {
LPMCI_OPEN_PARMSA mop32a = HeapAlloc(SystemHeap, 0, sizeof(LPMCI_OPEN_PARMS16) + sizeof(MCI_OPEN_PARMSA) + 2 * sizeof(DWORD)); LPMCI_OPEN_PARMSA mop32a = HeapAlloc(GetProcessHeap(), 0, sizeof(LPMCI_OPEN_PARMS16) + sizeof(MCI_OPEN_PARMSA) + 2 * sizeof(DWORD));
LPMCI_OPEN_PARMS16 mop16 = PTR_SEG_TO_LIN(*lParam); LPMCI_OPEN_PARMS16 mop16 = PTR_SEG_TO_LIN(*lParam);
if (mop32a) { if (mop32a) {
@ -1197,7 +1197,7 @@ static MCI_MapType MCI_MapMsg16To32A(WORD uDevType, WORD wMsg, DWORD* lParam)
return MCI_MAP_OKMEM; return MCI_MAP_OKMEM;
case MCI_SYSINFO: case MCI_SYSINFO:
{ {
LPMCI_SYSINFO_PARMSA msip32a = HeapAlloc(SystemHeap, 0, sizeof(MCI_SYSINFO_PARMSA)); LPMCI_SYSINFO_PARMSA msip32a = HeapAlloc(GetProcessHeap(), 0, sizeof(MCI_SYSINFO_PARMSA));
LPMCI_SYSINFO_PARMS16 msip16 = PTR_SEG_TO_LIN(*lParam); LPMCI_SYSINFO_PARMS16 msip16 = PTR_SEG_TO_LIN(*lParam);
if (msip32a) { if (msip32a) {
@ -1282,7 +1282,7 @@ static MCI_MapType MCI_UnMapMsg16To32A(WORD uDevType, WORD wMsg, DWORD lParam)
case MCI_ESCAPE: case MCI_ESCAPE:
case MCI_INFO: case MCI_INFO:
case MCI_SYSINFO: case MCI_SYSINFO:
HeapFree(SystemHeap, 0, (LPVOID)lParam); HeapFree(GetProcessHeap(), 0, (LPVOID)lParam);
return MCI_MAP_OK; return MCI_MAP_OK;
case MCI_OPEN: case MCI_OPEN:
case MCI_OPEN_DRIVER: case MCI_OPEN_DRIVER:
@ -1291,7 +1291,7 @@ static MCI_MapType MCI_UnMapMsg16To32A(WORD uDevType, WORD wMsg, DWORD lParam)
LPMCI_OPEN_PARMS16 mop16 = *(LPMCI_OPEN_PARMS16*)((char*)mop32a - sizeof(LPMCI_OPEN_PARMS16)); LPMCI_OPEN_PARMS16 mop16 = *(LPMCI_OPEN_PARMS16*)((char*)mop32a - sizeof(LPMCI_OPEN_PARMS16));
mop16->wDeviceID = mop32a->wDeviceID; mop16->wDeviceID = mop32a->wDeviceID;
if (!HeapFree(SystemHeap, 0, (LPVOID)(lParam - sizeof(LPMCI_OPEN_PARMS16)))) if (!HeapFree(GetProcessHeap(), 0, (LPVOID)(lParam - sizeof(LPMCI_OPEN_PARMS16))))
FIXME("bad free line=%d\n", __LINE__); FIXME("bad free line=%d\n", __LINE__);
} }
return MCI_MAP_OK; return MCI_MAP_OK;
@ -2476,7 +2476,7 @@ BOOL MULTIMEDIA_MciInit(void)
LPSTR ptr1, ptr2; LPSTR ptr1, ptr2;
MCI_InstalledCount = 0; MCI_InstalledCount = 0;
ptr1 = MCI_lpInstallNames = HeapAlloc(SystemHeap, 0, 2048); ptr1 = MCI_lpInstallNames = HeapAlloc(GetProcessHeap(), 0, 2048);
if (!MCI_lpInstallNames) if (!MCI_lpInstallNames)
return FALSE; return FALSE;

View File

@ -179,7 +179,7 @@ static BOOL OSS_MidiInit(void)
return TRUE; return TRUE;
} }
tmplpCaps = HeapAlloc(SystemHeap, 0, sizeof(MIDIOUTCAPSA)); tmplpCaps = HeapAlloc(GetProcessHeap(), 0, sizeof(MIDIOUTCAPSA));
if (!tmplpCaps) if (!tmplpCaps)
break; break;
/* We also have the information sinfo.synth_subtype, not used here /* We also have the information sinfo.synth_subtype, not used here
@ -258,7 +258,7 @@ static BOOL OSS_MidiInit(void)
return TRUE; return TRUE;
} }
tmplpOutCaps = HeapAlloc(SystemHeap, 0, sizeof(MIDIOUTCAPSA)); tmplpOutCaps = HeapAlloc(GetProcessHeap(), 0, sizeof(MIDIOUTCAPSA));
if (!tmplpOutCaps) if (!tmplpOutCaps)
break; break;
/* This whole part is somewhat obscure to me. I'll keep trying to dig /* This whole part is somewhat obscure to me. I'll keep trying to dig
@ -284,7 +284,7 @@ static BOOL OSS_MidiInit(void)
midiOutDevices[numsynthdevs + i] = tmplpOutCaps; midiOutDevices[numsynthdevs + i] = tmplpOutCaps;
tmplpInCaps = HeapAlloc(SystemHeap, 0, sizeof(MIDIOUTCAPSA)); tmplpInCaps = HeapAlloc(GetProcessHeap(), 0, sizeof(MIDIOUTCAPSA));
if (!tmplpInCaps) if (!tmplpInCaps)
break; break;
/* This whole part is somewhat obscure to me. I'll keep trying to dig /* This whole part is somewhat obscure to me. I'll keep trying to dig

View File

@ -117,7 +117,7 @@ ASPI_OpenDevice(SRB_ExecSCSICmd *prb)
} }
/* device is now open */ /* device is now open */
curr = HeapAlloc( SystemHeap, 0, sizeof(ASPI_DEVICE_INFO) ); curr = HeapAlloc( GetProcessHeap(), 0, sizeof(ASPI_DEVICE_INFO) );
curr->fd = fd; curr->fd = fd;
curr->hostId = prb->SRB_HaId; curr->hostId = prb->SRB_HaId;
curr->target = prb->SRB_Target; curr->target = prb->SRB_Target;

View File

@ -321,7 +321,7 @@ static int DOSFS_MatchLong( const char *mask, const char *name,
*/ */
static DOS_DIR *DOSFS_OpenDir( LPCSTR path ) static DOS_DIR *DOSFS_OpenDir( LPCSTR path )
{ {
DOS_DIR *dir = HeapAlloc( SystemHeap, 0, sizeof(*dir) ); DOS_DIR *dir = HeapAlloc( GetProcessHeap(), 0, sizeof(*dir) );
if (!dir) if (!dir)
{ {
SetLastError( ERROR_NOT_ENOUGH_MEMORY ); SetLastError( ERROR_NOT_ENOUGH_MEMORY );
@ -357,7 +357,7 @@ static DOS_DIR *DOSFS_OpenDir( LPCSTR path )
if (!(dir->dir = opendir( path ))) if (!(dir->dir = opendir( path )))
{ {
HeapFree( SystemHeap, 0, dir ); HeapFree( GetProcessHeap(), 0, dir );
return NULL; return NULL;
} }
return dir; return dir;
@ -373,7 +373,7 @@ static void DOSFS_CloseDir( DOS_DIR *dir )
if (dir->fd != -1) close( dir->fd ); if (dir->fd != -1) close( dir->fd );
#endif /* VFAT_IOCTL_READDIR_BOTH */ #endif /* VFAT_IOCTL_READDIR_BOTH */
if (dir->dir) closedir( dir->dir ); if (dir->dir) closedir( dir->dir );
HeapFree( SystemHeap, 0, dir ); HeapFree( GetProcessHeap(), 0, dir );
} }
@ -1384,7 +1384,7 @@ HANDLE16 WINAPI FindFirstFile16( LPCSTR path, WIN32_FIND_DATAA *data )
if (!(handle = GlobalAlloc16( GMEM_MOVEABLE, sizeof(FIND_FIRST_INFO) ))) if (!(handle = GlobalAlloc16( GMEM_MOVEABLE, sizeof(FIND_FIRST_INFO) )))
return INVALID_HANDLE_VALUE16; return INVALID_HANDLE_VALUE16;
info = (FIND_FIRST_INFO *)GlobalLock16( handle ); info = (FIND_FIRST_INFO *)GlobalLock16( handle );
info->path = HEAP_strdupA( SystemHeap, 0, full_name.long_name ); info->path = HEAP_strdupA( GetProcessHeap(), 0, full_name.long_name );
info->long_mask = strrchr( info->path, '/' ); info->long_mask = strrchr( info->path, '/' );
*(info->long_mask++) = '\0'; *(info->long_mask++) = '\0';
info->short_mask = NULL; info->short_mask = NULL;
@ -1462,7 +1462,7 @@ BOOL16 WINAPI FindNextFile16( HANDLE16 handle, WIN32_FIND_DATAA *data )
if (!DOSFS_FindNextEx( info, data )) if (!DOSFS_FindNextEx( info, data ))
{ {
DOSFS_CloseDir( info->dir ); info->dir = NULL; DOSFS_CloseDir( info->dir ); info->dir = NULL;
HeapFree( SystemHeap, 0, info->path ); HeapFree( GetProcessHeap(), 0, info->path );
info->path = info->long_mask = NULL; info->path = info->long_mask = NULL;
SetLastError( ERROR_NO_MORE_FILES ); SetLastError( ERROR_NO_MORE_FILES );
return FALSE; return FALSE;
@ -1513,7 +1513,7 @@ BOOL16 WINAPI FindClose16( HANDLE16 handle )
return FALSE; return FALSE;
} }
if (info->dir) DOSFS_CloseDir( info->dir ); if (info->dir) DOSFS_CloseDir( info->dir );
if (info->path) HeapFree( SystemHeap, 0, info->path ); if (info->path) HeapFree( GetProcessHeap(), 0, info->path );
GlobalUnlock16( handle ); GlobalUnlock16( handle );
GlobalFree16( handle ); GlobalFree16( handle );
return TRUE; return TRUE;

View File

@ -174,9 +174,9 @@ int DRIVE_Init(void)
continue; continue;
} }
drive->root = HEAP_strdupA( SystemHeap, 0, path ); drive->root = HEAP_strdupA( GetProcessHeap(), 0, path );
drive->dos_cwd = HEAP_strdupA( SystemHeap, 0, "" ); drive->dos_cwd = HEAP_strdupA( GetProcessHeap(), 0, "" );
drive->unix_cwd = HEAP_strdupA( SystemHeap, 0, "" ); drive->unix_cwd = HEAP_strdupA( GetProcessHeap(), 0, "" );
drive->type = DRIVE_GetDriveType( name ); drive->type = DRIVE_GetDriveType( name );
drive->device = NULL; drive->device = NULL;
drive->flags = 0; drive->flags = 0;
@ -207,7 +207,7 @@ int DRIVE_Init(void)
buffer, sizeof(buffer) ); buffer, sizeof(buffer) );
if (buffer[0]) if (buffer[0])
{ {
drive->device = HEAP_strdupA( SystemHeap, 0, buffer ); drive->device = HEAP_strdupA( GetProcessHeap(), 0, buffer );
drive->read_volinfo = drive->read_volinfo =
(BOOL)PROFILE_GetWineIniInt( name, "ReadVolInfo", 1); (BOOL)PROFILE_GetWineIniInt( name, "ReadVolInfo", 1);
} }
@ -232,9 +232,9 @@ int DRIVE_Init(void)
{ {
MESSAGE("Warning: no valid DOS drive found, check your configuration file.\n" ); MESSAGE("Warning: no valid DOS drive found, check your configuration file.\n" );
/* Create a C drive pointing to Unix root dir */ /* Create a C drive pointing to Unix root dir */
DOSDrives[2].root = HEAP_strdupA( SystemHeap, 0, "/" ); DOSDrives[2].root = HEAP_strdupA( GetProcessHeap(), 0, "/" );
DOSDrives[2].dos_cwd = HEAP_strdupA( SystemHeap, 0, "" ); DOSDrives[2].dos_cwd = HEAP_strdupA( GetProcessHeap(), 0, "" );
DOSDrives[2].unix_cwd = HEAP_strdupA( SystemHeap, 0, "" ); DOSDrives[2].unix_cwd = HEAP_strdupA( GetProcessHeap(), 0, "" );
strcpy( DOSDrives[2].label_conf, "Drive C " ); strcpy( DOSDrives[2].label_conf, "Drive C " );
DOSDrives[2].serial_conf = 12345678; DOSDrives[2].serial_conf = 12345678;
DOSDrives[2].type = TYPE_HD; DOSDrives[2].type = TYPE_HD;
@ -641,11 +641,11 @@ int DRIVE_Chdir( int drive, const char *path )
TRACE("(%c:): unix_cwd=%s dos_cwd=%s\n", TRACE("(%c:): unix_cwd=%s dos_cwd=%s\n",
'A' + drive, unix_cwd, full_name.short_name + 3 ); 'A' + drive, unix_cwd, full_name.short_name + 3 );
HeapFree( SystemHeap, 0, DOSDrives[drive].dos_cwd ); HeapFree( GetProcessHeap(), 0, DOSDrives[drive].dos_cwd );
HeapFree( SystemHeap, 0, DOSDrives[drive].unix_cwd ); HeapFree( GetProcessHeap(), 0, DOSDrives[drive].unix_cwd );
DOSDrives[drive].dos_cwd = HEAP_strdupA( SystemHeap, 0, DOSDrives[drive].dos_cwd = HEAP_strdupA( GetProcessHeap(), 0,
full_name.short_name + 3 ); full_name.short_name + 3 );
DOSDrives[drive].unix_cwd = HEAP_strdupA( SystemHeap, 0, unix_cwd ); DOSDrives[drive].unix_cwd = HEAP_strdupA( GetProcessHeap(), 0, unix_cwd );
if (pTask && (pTask->curdrive & 0x80) && if (pTask && (pTask->curdrive & 0x80) &&
((pTask->curdrive & ~0x80) == drive)) ((pTask->curdrive & ~0x80) == drive))
@ -719,9 +719,9 @@ int DRIVE_SetLogicalMapping ( int existing_drive, int new_drive )
return 0; return 0;
} }
new->root = HEAP_strdupA( SystemHeap, 0, old->root ); new->root = HEAP_strdupA( GetProcessHeap(), 0, old->root );
new->dos_cwd = HEAP_strdupA( SystemHeap, 0, old->dos_cwd ); new->dos_cwd = HEAP_strdupA( GetProcessHeap(), 0, old->dos_cwd );
new->unix_cwd = HEAP_strdupA( SystemHeap, 0, old->unix_cwd ); new->unix_cwd = HEAP_strdupA( GetProcessHeap(), 0, old->unix_cwd );
memcpy ( new->label_conf, old->label_conf, 12 ); memcpy ( new->label_conf, old->label_conf, 12 );
new->serial_conf = old->serial_conf; new->serial_conf = old->serial_conf;
new->type = old->type; new->type = old->type;

View File

@ -983,7 +983,7 @@ HFILE WINAPI OpenFile( LPCSTR name, OFSTRUCT *ofs, UINT mode )
BOOL FILE_InitProcessDosHandles( void ) { BOOL FILE_InitProcessDosHandles( void ) {
HANDLE *ptr; HANDLE *ptr;
if (!(ptr = HeapAlloc( SystemHeap, HEAP_ZERO_MEMORY, if (!(ptr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(*ptr) * DOS_TABLE_SIZE ))) sizeof(*ptr) * DOS_TABLE_SIZE )))
return FALSE; return FALSE;
PROCESS_Current()->dos_handles = ptr; PROCESS_Current()->dos_handles = ptr;
@ -2082,11 +2082,11 @@ static BOOL DOS_AddLock(FILE_OBJECT *file, struct flock *f)
} }
#endif #endif
curr = HeapAlloc( SystemHeap, 0, sizeof(DOS_FILE_LOCK) ); curr = HeapAlloc( GetProcessHeap(), 0, sizeof(DOS_FILE_LOCK) );
curr->processId = GetCurrentProcessId(); curr->processId = GetCurrentProcessId();
curr->base = f->l_start; curr->base = f->l_start;
curr->len = f->l_len; curr->len = f->l_len;
/* curr->unix_name = HEAP_strdupA( SystemHeap, 0, file->unix_name);*/ /* curr->unix_name = HEAP_strdupA( GetProcessHeap(), 0, file->unix_name);*/
curr->next = locks; curr->next = locks;
curr->dos_file = file; curr->dos_file = file;
locks = curr; locks = curr;
@ -2105,8 +2105,8 @@ static void DOS_RemoveFileLocks(FILE_OBJECT *file)
if ((*curr)->dos_file == file) { if ((*curr)->dos_file == file) {
rem = *curr; rem = *curr;
*curr = (*curr)->next; *curr = (*curr)->next;
/* HeapFree( SystemHeap, 0, rem->unix_name );*/ /* HeapFree( GetProcessHeap(), 0, rem->unix_name );*/
HeapFree( SystemHeap, 0, rem ); HeapFree( GetProcessHeap(), 0, rem );
} }
else else
curr = &(*curr)->next; curr = &(*curr)->next;
@ -2128,8 +2128,8 @@ static BOOL DOS_RemoveLock(FILE_OBJECT *file, struct flock *f)
/* this is the same lock */ /* this is the same lock */
rem = *curr; rem = *curr;
*curr = (*curr)->next; *curr = (*curr)->next;
/* HeapFree( SystemHeap, 0, rem->unix_name );*/ /* HeapFree( GetProcessHeap(), 0, rem->unix_name );*/
HeapFree( SystemHeap, 0, rem ); HeapFree( GetProcessHeap(), 0, rem );
return TRUE; return TRUE;
} }
} }

View File

@ -196,16 +196,16 @@ static void PROFILE_Free( PROFILESECTION *section )
for ( ; section; section = next_section) for ( ; section; section = next_section)
{ {
if (section->name) HeapFree( SystemHeap, 0, section->name ); if (section->name) HeapFree( GetProcessHeap(), 0, section->name );
for (key = section->key; key; key = next_key) for (key = section->key; key; key = next_key)
{ {
next_key = key->next; next_key = key->next;
if (key->name) HeapFree( SystemHeap, 0, key->name ); if (key->name) HeapFree( GetProcessHeap(), 0, key->name );
if (key->value) HeapFree( SystemHeap, 0, key->value ); if (key->value) HeapFree( GetProcessHeap(), 0, key->value );
HeapFree( SystemHeap, 0, key ); HeapFree( GetProcessHeap(), 0, key );
} }
next_section = section->next; next_section = section->next;
HeapFree( SystemHeap, 0, section ); HeapFree( GetProcessHeap(), 0, section );
} }
} }
@ -232,7 +232,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
PROFILESECTION **next_section; PROFILESECTION **next_section;
PROFILEKEY *key, *prev_key, **next_key; PROFILEKEY *key, *prev_key, **next_key;
first_section = HEAP_xalloc( SystemHeap, 0, sizeof(*section) ); first_section = HEAP_xalloc( GetProcessHeap(), 0, sizeof(*section) );
first_section->name = NULL; first_section->name = NULL;
first_section->key = NULL; first_section->key = NULL;
first_section->next = NULL; first_section->next = NULL;
@ -256,8 +256,8 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
{ {
*p2 = '\0'; *p2 = '\0';
p++; p++;
section = HEAP_xalloc( SystemHeap, 0, sizeof(*section) ); section = HEAP_xalloc( GetProcessHeap(), 0, sizeof(*section) );
section->name = HEAP_strdupA( SystemHeap, 0, p ); section->name = HEAP_strdupA( GetProcessHeap(), 0, p );
section->key = NULL; section->key = NULL;
section->next = NULL; section->next = NULL;
*next_section = section; *next_section = section;
@ -284,9 +284,9 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
if(*p || !prev_key || *prev_key->name) if(*p || !prev_key || *prev_key->name)
{ {
key = HEAP_xalloc( SystemHeap, 0, sizeof(*key) ); key = HEAP_xalloc( GetProcessHeap(), 0, sizeof(*key) );
key->name = HEAP_strdupA( SystemHeap, 0, p ); key->name = HEAP_strdupA( GetProcessHeap(), 0, p );
key->value = p2 ? HEAP_strdupA( SystemHeap, 0, p2 ) : NULL; key->value = p2 ? HEAP_strdupA( GetProcessHeap(), 0, p2 ) : NULL;
key->next = NULL; key->next = NULL;
*next_key = key; *next_key = key;
next_key = &key->next; next_key = &key->next;
@ -341,9 +341,9 @@ static BOOL PROFILE_DeleteKey( PROFILESECTION **section,
{ {
PROFILEKEY *to_del = *key; PROFILEKEY *to_del = *key;
*key = to_del->next; *key = to_del->next;
if (to_del->name) HeapFree( SystemHeap, 0, to_del->name ); if (to_del->name) HeapFree( GetProcessHeap(), 0, to_del->name );
if (to_del->value) HeapFree( SystemHeap, 0, to_del->value); if (to_del->value) HeapFree( GetProcessHeap(), 0, to_del->value);
HeapFree( SystemHeap, 0, to_del ); HeapFree( GetProcessHeap(), 0, to_del );
return TRUE; return TRUE;
} }
key = &(*key)->next; key = &(*key)->next;
@ -392,8 +392,8 @@ static PROFILEKEY *PROFILE_Find( PROFILESECTION **section,
key = &(*key)->next; key = &(*key)->next;
} }
if (!create) return NULL; if (!create) return NULL;
*key = HEAP_xalloc( SystemHeap, 0, sizeof(PROFILEKEY) ); *key = HEAP_xalloc( GetProcessHeap(), 0, sizeof(PROFILEKEY) );
(*key)->name = HEAP_strdupA( SystemHeap, 0, key_name ); (*key)->name = HEAP_strdupA( GetProcessHeap(), 0, key_name );
(*key)->value = NULL; (*key)->value = NULL;
(*key)->next = NULL; (*key)->next = NULL;
return *key; return *key;
@ -401,11 +401,11 @@ static PROFILEKEY *PROFILE_Find( PROFILESECTION **section,
section = &(*section)->next; section = &(*section)->next;
} }
if (!create) return NULL; if (!create) return NULL;
*section = HEAP_xalloc( SystemHeap, 0, sizeof(PROFILESECTION) ); *section = HEAP_xalloc( GetProcessHeap(), 0, sizeof(PROFILESECTION) );
(*section)->name = HEAP_strdupA( SystemHeap, 0, section_name ); (*section)->name = HEAP_strdupA( GetProcessHeap(), 0, section_name );
(*section)->next = NULL; (*section)->next = NULL;
(*section)->key = HEAP_xalloc( SystemHeap, 0, sizeof(PROFILEKEY) ); (*section)->key = HEAP_xalloc( GetProcessHeap(), 0, sizeof(PROFILEKEY) );
(*section)->key->name = HEAP_strdupA( SystemHeap, 0, key_name ); (*section)->key->name = HEAP_strdupA( GetProcessHeap(), 0, key_name );
(*section)->key->value = NULL; (*section)->key->value = NULL;
(*section)->key->next = NULL; (*section)->key->next = NULL;
return (*section)->key; return (*section)->key;
@ -469,9 +469,9 @@ static void PROFILE_ReleaseFile(void)
{ {
PROFILE_FlushFile(); PROFILE_FlushFile();
PROFILE_Free( CurProfile->section ); PROFILE_Free( CurProfile->section );
if (CurProfile->dos_name) HeapFree( SystemHeap, 0, CurProfile->dos_name ); if (CurProfile->dos_name) HeapFree( GetProcessHeap(), 0, CurProfile->dos_name );
if (CurProfile->unix_name) HeapFree( SystemHeap, 0, CurProfile->unix_name ); if (CurProfile->unix_name) HeapFree( GetProcessHeap(), 0, CurProfile->unix_name );
if (CurProfile->filename) HeapFree( SystemHeap, 0, CurProfile->filename ); if (CurProfile->filename) HeapFree( GetProcessHeap(), 0, CurProfile->filename );
CurProfile->changed = FALSE; CurProfile->changed = FALSE;
CurProfile->section = NULL; CurProfile->section = NULL;
CurProfile->dos_name = NULL; CurProfile->dos_name = NULL;
@ -501,7 +501,7 @@ static BOOL PROFILE_Open( LPCSTR filename )
if(!CurProfile) if(!CurProfile)
for(i=0;i<N_CACHED_PROFILES;i++) for(i=0;i<N_CACHED_PROFILES;i++)
{ {
MRUProfile[i]=HEAP_xalloc( SystemHeap, 0, sizeof(PROFILE) ); MRUProfile[i]=HEAP_xalloc( GetProcessHeap(), 0, sizeof(PROFILE) );
MRUProfile[i]->changed=FALSE; MRUProfile[i]->changed=FALSE;
MRUProfile[i]->section=NULL; MRUProfile[i]->section=NULL;
MRUProfile[i]->dos_name=NULL; MRUProfile[i]->dos_name=NULL;
@ -562,9 +562,9 @@ static BOOL PROFILE_Open( LPCSTR filename )
if(CurProfile->filename) PROFILE_ReleaseFile(); if(CurProfile->filename) PROFILE_ReleaseFile();
/* OK, now that CurProfile is definitely free we assign it our new file */ /* OK, now that CurProfile is definitely free we assign it our new file */
newdos_name = HEAP_strdupA( SystemHeap, 0, full_name.short_name ); newdos_name = HEAP_strdupA( GetProcessHeap(), 0, full_name.short_name );
CurProfile->dos_name = newdos_name; CurProfile->dos_name = newdos_name;
CurProfile->filename = HEAP_strdupA( SystemHeap, 0, filename ); CurProfile->filename = HEAP_strdupA( GetProcessHeap(), 0, filename );
/* Try to open the profile file, first in $HOME/.wine */ /* Try to open the profile file, first in $HOME/.wine */
@ -578,12 +578,12 @@ static BOOL PROFILE_Open( LPCSTR filename )
{ {
TRACE("(%s): found it in %s\n", TRACE("(%s): found it in %s\n",
filename, buffer ); filename, buffer );
CurProfile->unix_name = HEAP_strdupA( SystemHeap, 0, buffer ); CurProfile->unix_name = HEAP_strdupA( GetProcessHeap(), 0, buffer );
} }
if (!file) if (!file)
{ {
CurProfile->unix_name = HEAP_strdupA( SystemHeap, 0, CurProfile->unix_name = HEAP_strdupA( GetProcessHeap(), 0,
full_name.long_name ); full_name.long_name );
if ((file = fopen( full_name.long_name, "r" ))) if ((file = fopen( full_name.long_name, "r" )))
TRACE("(%s): found it in %s\n", TRACE("(%s): found it in %s\n",
@ -748,10 +748,10 @@ static BOOL PROFILE_SetString( LPCSTR section_name, LPCSTR key_name,
return TRUE; /* No change needed */ return TRUE; /* No change needed */
} }
TRACE(" replacing '%s'\n", key->value ); TRACE(" replacing '%s'\n", key->value );
HeapFree( SystemHeap, 0, key->value ); HeapFree( GetProcessHeap(), 0, key->value );
} }
else TRACE(" creating key\n" ); else TRACE(" creating key\n" );
key->value = HEAP_strdupA( SystemHeap, 0, value ); key->value = HEAP_strdupA( GetProcessHeap(), 0, value );
CurProfile->changed = TRUE; CurProfile->changed = TRUE;
} }
return TRUE; return TRUE;
@ -1066,7 +1066,7 @@ UINT WINAPI GetProfileIntA( LPCSTR section, LPCSTR entry, INT def_val )
*/ */
UINT WINAPI GetProfileIntW( LPCWSTR section, LPCWSTR entry, INT def_val ) UINT WINAPI GetProfileIntW( LPCWSTR section, LPCWSTR entry, INT def_val )
{ {
if (!wininiW) wininiW = HEAP_strdupAtoW( SystemHeap, 0, "win.ini" ); if (!wininiW) wininiW = HEAP_strdupAtoW( GetProcessHeap(), 0, "win.ini" );
return GetPrivateProfileIntW( section, entry, def_val, wininiW ); return GetPrivateProfileIntW( section, entry, def_val, wininiW );
} }
@ -1096,7 +1096,7 @@ INT WINAPI GetProfileStringA( LPCSTR section, LPCSTR entry, LPCSTR def_val,
INT WINAPI GetProfileStringW( LPCWSTR section, LPCWSTR entry, INT WINAPI GetProfileStringW( LPCWSTR section, LPCWSTR entry,
LPCWSTR def_val, LPWSTR buffer, UINT len ) LPCWSTR def_val, LPWSTR buffer, UINT len )
{ {
if (!wininiW) wininiW = HEAP_strdupAtoW( SystemHeap, 0, "win.ini" ); if (!wininiW) wininiW = HEAP_strdupAtoW( GetProcessHeap(), 0, "win.ini" );
return GetPrivateProfileStringW( section, entry, def_val, return GetPrivateProfileStringW( section, entry, def_val,
buffer, len, wininiW ); buffer, len, wininiW );
} }
@ -1125,7 +1125,7 @@ BOOL WINAPI WriteProfileStringA( LPCSTR section, LPCSTR entry,
BOOL WINAPI WriteProfileStringW( LPCWSTR section, LPCWSTR entry, BOOL WINAPI WriteProfileStringW( LPCWSTR section, LPCWSTR entry,
LPCWSTR string ) LPCWSTR string )
{ {
if (!wininiW) wininiW = HEAP_strdupAtoW( SystemHeap, 0, "win.ini" ); if (!wininiW) wininiW = HEAP_strdupAtoW( GetProcessHeap(), 0, "win.ini" );
return WritePrivateProfileStringW( section, entry, string, wininiW ); return WritePrivateProfileStringW( section, entry, string, wininiW );
} }
@ -1306,7 +1306,7 @@ INT WINAPI GetProfileSectionA( LPCSTR section, LPSTR buffer, DWORD len )
*/ */
INT WINAPI GetProfileSectionW( LPCWSTR section, LPWSTR buffer, DWORD len ) INT WINAPI GetProfileSectionW( LPCWSTR section, LPWSTR buffer, DWORD len )
{ {
if (!wininiW) wininiW = HEAP_strdupAtoW( SystemHeap, 0, "win.ini" ); if (!wininiW) wininiW = HEAP_strdupAtoW( GetProcessHeap(), 0, "win.ini" );
return GetPrivateProfileSectionW( section, buffer, len, wininiW ); return GetPrivateProfileSectionW( section, buffer, len, wininiW );
} }
@ -1442,7 +1442,7 @@ BOOL WINAPI WriteProfileSectionA( LPCSTR section, LPCSTR keys_n_values)
*/ */
BOOL WINAPI WriteProfileSectionW( LPCWSTR section, LPCWSTR keys_n_values) BOOL WINAPI WriteProfileSectionW( LPCWSTR section, LPCWSTR keys_n_values)
{ {
if (!wininiW) wininiW = HEAP_strdupAtoW( SystemHeap, 0, "win.ini"); if (!wininiW) wininiW = HEAP_strdupAtoW( GetProcessHeap(), 0, "win.ini");
return (WritePrivateProfileSectionW (section,keys_n_values, wininiW)); return (WritePrivateProfileSectionW (section,keys_n_values, wininiW));
} }
@ -1637,7 +1637,7 @@ BOOL WINAPI WritePrivateProfileStructA (LPCSTR section, LPCSTR key,
return WritePrivateProfileStringA( NULL, NULL, NULL, filename ); return WritePrivateProfileStringA( NULL, NULL, NULL, filename );
/* allocate string buffer for hex chars + checksum hex char + '\0' */ /* allocate string buffer for hex chars + checksum hex char + '\0' */
outstring = HeapAlloc( SystemHeap, 0, bufsize*2 + 2 + 1); outstring = HeapAlloc( GetProcessHeap(), 0, bufsize*2 + 2 + 1);
p = outstring; p = outstring;
for (binbuf = (LPBYTE)buf; binbuf < (LPBYTE)buf+bufsize; binbuf++) { for (binbuf = (LPBYTE)buf; binbuf < (LPBYTE)buf+bufsize; binbuf++) {
*p++ = hex[*binbuf >> 4]; *p++ = hex[*binbuf >> 4];
@ -1656,7 +1656,7 @@ BOOL WINAPI WritePrivateProfileStructA (LPCSTR section, LPCSTR key,
LeaveCriticalSection( &PROFILE_CritSect ); LeaveCriticalSection( &PROFILE_CritSect );
HeapFree( SystemHeap, 0, outstring ); HeapFree( GetProcessHeap(), 0, outstring );
return ret; return ret;
} }

View File

@ -26,12 +26,12 @@ static GRAPHICS_DRIVER *genericDriver = NULL;
*/ */
BOOL DRIVER_RegisterDriver( LPCSTR name, const DC_FUNCTIONS *funcs ) BOOL DRIVER_RegisterDriver( LPCSTR name, const DC_FUNCTIONS *funcs )
{ {
GRAPHICS_DRIVER *driver = HeapAlloc( SystemHeap, 0, sizeof(*driver) ); GRAPHICS_DRIVER *driver = HeapAlloc( GetProcessHeap(), 0, sizeof(*driver) );
if (!driver) return FALSE; if (!driver) return FALSE;
driver->funcs = funcs; driver->funcs = funcs;
if (name) if (name)
{ {
driver->name = HEAP_strdupA( SystemHeap, 0, name ); driver->name = HEAP_strdupA( GetProcessHeap(), 0, name );
driver->next = firstDriver; driver->next = firstDriver;
firstDriver = driver; firstDriver = driver;
return TRUE; return TRUE;
@ -40,7 +40,7 @@ BOOL DRIVER_RegisterDriver( LPCSTR name, const DC_FUNCTIONS *funcs )
if (genericDriver) if (genericDriver)
{ {
WARN(" already a generic driver\n" ); WARN(" already a generic driver\n" );
HeapFree( SystemHeap, 0, driver ); HeapFree( GetProcessHeap(), 0, driver );
return FALSE; return FALSE;
} }
driver->name = NULL; driver->name = NULL;
@ -80,8 +80,8 @@ BOOL DRIVER_UnregisterDriver( LPCSTR name )
{ {
GRAPHICS_DRIVER *driver = *ppDriver; GRAPHICS_DRIVER *driver = *ppDriver;
(*ppDriver) = driver->next; (*ppDriver) = driver->next;
HeapFree( SystemHeap, 0, driver->name ); HeapFree( GetProcessHeap(), 0, driver->name );
HeapFree( SystemHeap, 0, driver ); HeapFree( GetProcessHeap(), 0, driver );
return TRUE; return TRUE;
} }
ppDriver = &(*ppDriver)->next; ppDriver = &(*ppDriver)->next;
@ -91,7 +91,7 @@ BOOL DRIVER_UnregisterDriver( LPCSTR name )
else else
{ {
if (!genericDriver) return FALSE; if (!genericDriver) return FALSE;
HeapFree( SystemHeap, 0, genericDriver ); HeapFree( GetProcessHeap(), 0, genericDriver );
genericDriver = NULL; genericDriver = NULL;
return TRUE; return TRUE;
} }

View File

@ -310,7 +310,7 @@ EMFDRV_Polylinegon( DC *dc, const POINT* pt, INT count, DWORD iType )
size = sizeof(EMRPOLYLINE) + sizeof(POINTL) * (count - 1); size = sizeof(EMRPOLYLINE) + sizeof(POINTL) * (count - 1);
emr = HeapAlloc( SystemHeap, 0, size ); emr = HeapAlloc( GetProcessHeap(), 0, size );
emr->emr.iType = iType; emr->emr.iType = iType;
emr->emr.nSize = size; emr->emr.nSize = size;
@ -334,7 +334,7 @@ EMFDRV_Polylinegon( DC *dc, const POINT* pt, INT count, DWORD iType )
ret = EMFDRV_WriteRecord( dc, &emr->emr ); ret = EMFDRV_WriteRecord( dc, &emr->emr );
if(ret) if(ret)
EMFDRV_UpdateBBox( dc, &emr->rclBounds ); EMFDRV_UpdateBBox( dc, &emr->rclBounds );
HeapFree( SystemHeap, 0, emr ); HeapFree( GetProcessHeap(), 0, emr );
return ret; return ret;
} }
@ -392,7 +392,7 @@ EMFDRV_PolyPolylinegon( DC *dc, const POINT* pt, const INT* counts, UINT polys,
size = sizeof(EMRPOLYPOLYLINE) + (polys - 1) * sizeof(DWORD) + size = sizeof(EMRPOLYPOLYLINE) + (polys - 1) * sizeof(DWORD) +
(cptl - 1) * sizeof(POINTL); (cptl - 1) * sizeof(POINTL);
emr = HeapAlloc( SystemHeap, 0, size ); emr = HeapAlloc( GetProcessHeap(), 0, size );
emr->emr.iType = iType; emr->emr.iType = iType;
emr->emr.nSize = size; emr->emr.nSize = size;
@ -404,7 +404,7 @@ EMFDRV_PolyPolylinegon( DC *dc, const POINT* pt, const INT* counts, UINT polys,
ret = EMFDRV_WriteRecord( dc, &emr->emr ); ret = EMFDRV_WriteRecord( dc, &emr->emr );
if(ret) if(ret)
EMFDRV_UpdateBBox( dc, &emr->rclBounds ); EMFDRV_UpdateBBox( dc, &emr->rclBounds );
HeapFree( SystemHeap, 0, emr ); HeapFree( GetProcessHeap(), 0, emr );
return ret; return ret;
} }
@ -461,7 +461,7 @@ BOOL EMFDRV_FillRgn( DC *dc, HRGN hrgn, HBRUSH hbrush )
rgnsize = GetRegionData( hrgn, 0, NULL ); rgnsize = GetRegionData( hrgn, 0, NULL );
size = rgnsize + sizeof(EMRFILLRGN) - 1; size = rgnsize + sizeof(EMRFILLRGN) - 1;
emr = HeapAlloc( SystemHeap, 0, size ); emr = HeapAlloc( GetProcessHeap(), 0, size );
GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData ); GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
@ -477,7 +477,7 @@ BOOL EMFDRV_FillRgn( DC *dc, HRGN hrgn, HBRUSH hbrush )
ret = EMFDRV_WriteRecord( dc, &emr->emr ); ret = EMFDRV_WriteRecord( dc, &emr->emr );
if(ret) if(ret)
EMFDRV_UpdateBBox( dc, &emr->rclBounds ); EMFDRV_UpdateBBox( dc, &emr->rclBounds );
HeapFree( SystemHeap, 0, emr ); HeapFree( GetProcessHeap(), 0, emr );
return ret; return ret;
} }
/********************************************************************* /*********************************************************************
@ -494,7 +494,7 @@ BOOL EMFDRV_FrameRgn( DC *dc, HRGN hrgn, HBRUSH hbrush, INT width, INT height )
rgnsize = GetRegionData( hrgn, 0, NULL ); rgnsize = GetRegionData( hrgn, 0, NULL );
size = rgnsize + sizeof(EMRFRAMERGN) - 1; size = rgnsize + sizeof(EMRFRAMERGN) - 1;
emr = HeapAlloc( SystemHeap, 0, size ); emr = HeapAlloc( GetProcessHeap(), 0, size );
GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData ); GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
@ -512,7 +512,7 @@ BOOL EMFDRV_FrameRgn( DC *dc, HRGN hrgn, HBRUSH hbrush, INT width, INT height )
ret = EMFDRV_WriteRecord( dc, &emr->emr ); ret = EMFDRV_WriteRecord( dc, &emr->emr );
if(ret) if(ret)
EMFDRV_UpdateBBox( dc, &emr->rclBounds ); EMFDRV_UpdateBBox( dc, &emr->rclBounds );
HeapFree( SystemHeap, 0, emr ); HeapFree( GetProcessHeap(), 0, emr );
return ret; return ret;
} }
@ -530,7 +530,7 @@ static BOOL EMFDRV_PaintInvertRgn( DC *dc, HRGN hrgn, DWORD iType )
rgnsize = GetRegionData( hrgn, 0, NULL ); rgnsize = GetRegionData( hrgn, 0, NULL );
size = rgnsize + sizeof(EMRINVERTRGN) - 1; size = rgnsize + sizeof(EMRINVERTRGN) - 1;
emr = HeapAlloc( SystemHeap, 0, size ); emr = HeapAlloc( GetProcessHeap(), 0, size );
GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData ); GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
@ -545,7 +545,7 @@ static BOOL EMFDRV_PaintInvertRgn( DC *dc, HRGN hrgn, DWORD iType )
ret = EMFDRV_WriteRecord( dc, &emr->emr ); ret = EMFDRV_WriteRecord( dc, &emr->emr );
if(ret) if(ret)
EMFDRV_UpdateBBox( dc, &emr->rclBounds ); EMFDRV_UpdateBBox( dc, &emr->rclBounds );
HeapFree( SystemHeap, 0, emr ); HeapFree( GetProcessHeap(), 0, emr );
return ret; return ret;
} }

View File

@ -122,8 +122,8 @@ static BOOL EMFDRV_DeleteDC( DC *dc )
{ {
EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dc->physDev; EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dc->physDev;
if (physDev->emh) HeapFree( SystemHeap, 0, physDev->emh ); if (physDev->emh) HeapFree( GetProcessHeap(), 0, physDev->emh );
HeapFree( SystemHeap, 0, physDev ); HeapFree( GetProcessHeap(), 0, physDev );
dc->physDev = NULL; dc->physDev = NULL;
GDI_FreeObject(dc->hSelf); GDI_FreeObject(dc->hSelf);
return TRUE; return TRUE;
@ -150,7 +150,7 @@ BOOL EMFDRV_WriteRecord( DC *dc, EMR *emr )
return FALSE; return FALSE;
} else { } else {
len = physDev->emh->nBytes; len = physDev->emh->nBytes;
emh = HeapReAlloc( SystemHeap, 0, physDev->emh, len ); emh = HeapReAlloc( GetProcessHeap(), 0, physDev->emh, len );
if (!emh) return FALSE; if (!emh) return FALSE;
physDev->emh = emh; physDev->emh = emh;
memcpy((CHAR *)physDev->emh + physDev->emh->nBytes - emr->nSize, emr, memcpy((CHAR *)physDev->emh + physDev->emh->nBytes - emr->nSize, emr,
@ -252,7 +252,7 @@ HDC WINAPI CreateEnhMetaFileW(
if (!(dc = DC_AllocDC( &EMFDRV_Funcs ))) return 0; if (!(dc = DC_AllocDC( &EMFDRV_Funcs ))) return 0;
dc->header.wMagic = ENHMETAFILE_DC_MAGIC; dc->header.wMagic = ENHMETAFILE_DC_MAGIC;
physDev = (EMFDRV_PDEVICE *)HeapAlloc(SystemHeap,0,sizeof(*physDev)); physDev = (EMFDRV_PDEVICE *)HeapAlloc(GetProcessHeap(),0,sizeof(*physDev));
if (!physDev) { if (!physDev) {
GDI_HEAP_FREE( dc->hSelf ); GDI_HEAP_FREE( dc->hSelf );
return 0; return 0;
@ -267,8 +267,8 @@ HDC WINAPI CreateEnhMetaFileW(
} }
size = sizeof(ENHMETAHEADER) + (length + 3) / 4 * 4; size = sizeof(ENHMETAHEADER) + (length + 3) / 4 * 4;
if (!(physDev->emh = HeapAlloc( SystemHeap, HEAP_ZERO_MEMORY, size))) { if (!(physDev->emh = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, size))) {
HeapFree( SystemHeap, 0, physDev ); HeapFree( GetProcessHeap(), 0, physDev );
GDI_HEAP_FREE( dc->hSelf ); GDI_HEAP_FREE( dc->hSelf );
return 0; return 0;
} }
@ -362,7 +362,7 @@ HENHMETAFILE WINAPI CloseEnhMetaFile( HDC hdc /* metafile DC */ )
EMFDRV_DeleteDC( dc ); EMFDRV_DeleteDC( dc );
return 0; return 0;
} }
HeapFree( SystemHeap, 0, physDev->emh ); HeapFree( GetProcessHeap(), 0, physDev->emh );
hMapping = CreateFileMappingA(physDev->hFile, NULL, PAGE_READONLY, 0, hMapping = CreateFileMappingA(physDev->hFile, NULL, PAGE_READONLY, 0,
0, NULL); 0, NULL);
TRACE("hMapping = %08x\n", hMapping ); TRACE("hMapping = %08x\n", hMapping );

View File

@ -64,8 +64,8 @@ DWORD EMFDRV_CreateBrushIndirect( DC *dc, HBRUSH hBrush )
info->bmiHeader.biBitCount); info->bmiHeader.biBitCount);
biSize = DIB_BitmapInfoSize(info, LOWORD(brushObj->logbrush.lbColor)); biSize = DIB_BitmapInfoSize(info, LOWORD(brushObj->logbrush.lbColor));
size = sizeof(EMRCREATEDIBPATTERNBRUSHPT) + biSize + bmSize; size = sizeof(EMRCREATEDIBPATTERNBRUSHPT) + biSize + bmSize;
emr = HeapAlloc( SystemHeap, 0, size ); emr = HeapAlloc( GetProcessHeap(), 0, size );
if(!emr) break;; if(!emr) break;
emr->emr.iType = EMR_CREATEDIBPATTERNBRUSHPT; emr->emr.iType = EMR_CREATEDIBPATTERNBRUSHPT;
emr->emr.nSize = size; emr->emr.nSize = size;
emr->ihBrush = index = EMFDRV_AddHandleDC( dc ); emr->ihBrush = index = EMFDRV_AddHandleDC( dc );
@ -78,7 +78,7 @@ DWORD EMFDRV_CreateBrushIndirect( DC *dc, HBRUSH hBrush )
if(!EMFDRV_WriteRecord( dc, &emr->emr )) if(!EMFDRV_WriteRecord( dc, &emr->emr ))
index = 0; index = 0;
HeapFree( SystemHeap, 0, emr ); HeapFree( GetProcessHeap(), 0, emr );
GlobalUnlock16(brushObj->logbrush.lbHatch); GlobalUnlock16(brushObj->logbrush.lbHatch);
} }
break; break;

View File

@ -39,7 +39,7 @@ BOOL MFDRV_BitBlt( DC *dcDst, INT xDst, INT yDst, INT width, INT height,
GetObject16(dcSrc->w.hBitmap, sizeof(BITMAP16), &BM); GetObject16(dcSrc->w.hBitmap, sizeof(BITMAP16), &BM);
len = sizeof(METARECORD) + 12 * sizeof(INT16) + BM.bmWidthBytes * BM.bmHeight; len = sizeof(METARECORD) + 12 * sizeof(INT16) + BM.bmWidthBytes * BM.bmHeight;
if (!(mr = HeapAlloc(SystemHeap, 0, len))) if (!(mr = HeapAlloc(GetProcessHeap(), 0, len)))
return FALSE; return FALSE;
mr->rdFunction = META_BITBLT; mr->rdFunction = META_BITBLT;
*(mr->rdParm + 7) = BM.bmWidth; *(mr->rdParm + 7) = BM.bmWidth;
@ -63,7 +63,7 @@ BOOL MFDRV_BitBlt( DC *dcDst, INT xDst, INT yDst, INT width, INT height,
} }
else else
ret = FALSE; ret = FALSE;
HeapFree( SystemHeap, 0, mr); HeapFree( GetProcessHeap(), 0, mr);
return ret; return ret;
} }
@ -96,7 +96,7 @@ BOOL MFDRV_StretchBlt( DC *dcDst, INT xDst, INT yDst, INT widthDst,
len = sizeof(METARECORD) + 10 * sizeof(INT16) len = sizeof(METARECORD) + 10 * sizeof(INT16)
+ sizeof(BITMAPINFOHEADER) + (nBPP != 24 ? 1 << nBPP: 0) * sizeof(RGBQUAD) + sizeof(BITMAPINFOHEADER) + (nBPP != 24 ? 1 << nBPP: 0) * sizeof(RGBQUAD)
+ ((BM.bmWidth * nBPP + 31) / 32) * 4 * BM.bmHeight; + ((BM.bmWidth * nBPP + 31) / 32) * 4 * BM.bmHeight;
if (!(mr = HeapAlloc( SystemHeap, 0, len))) if (!(mr = HeapAlloc( GetProcessHeap(), 0, len)))
return FALSE; return FALSE;
mr->rdFunction = META_DIBSTRETCHBLT; mr->rdFunction = META_DIBSTRETCHBLT;
lpBMI=(LPBITMAPINFOHEADER)(mr->rdParm+10); lpBMI=(LPBITMAPINFOHEADER)(mr->rdParm+10);
@ -120,7 +120,7 @@ BOOL MFDRV_StretchBlt( DC *dcDst, INT xDst, INT yDst, INT widthDst,
(LPBITMAPINFO)lpBMI, DIB_RGB_COLORS)) (LPBITMAPINFO)lpBMI, DIB_RGB_COLORS))
#else #else
len = sizeof(METARECORD) + 15 * sizeof(INT16) + BM.bmWidthBytes * BM.bmHeight; len = sizeof(METARECORD) + 15 * sizeof(INT16) + BM.bmWidthBytes * BM.bmHeight;
if (!(mr = HeapAlloc( SystemHeap, 0, len ))) if (!(mr = HeapAlloc( GetProcessHeap(), 0, len )))
return FALSE; return FALSE;
mr->rdFunction = META_STRETCHBLT; mr->rdFunction = META_STRETCHBLT;
*(mr->rdParm +10) = BM.bmWidth; *(mr->rdParm +10) = BM.bmWidth;
@ -148,7 +148,7 @@ BOOL MFDRV_StretchBlt( DC *dcDst, INT xDst, INT yDst, INT widthDst,
} }
else else
ret = FALSE; ret = FALSE;
HeapFree( SystemHeap, 0, mr); HeapFree( GetProcessHeap(), 0, mr);
return ret; return ret;
} }
@ -170,7 +170,7 @@ INT MFDRV_StretchDIBits( DC *dc, INT xDst, INT yDst, INT widthDst,
info->bmiHeader.biBitCount ); info->bmiHeader.biBitCount );
len = sizeof(METARECORD) + 10 * sizeof(WORD) + infosize + imagesize; len = sizeof(METARECORD) + 10 * sizeof(WORD) + infosize + imagesize;
mr = (METARECORD *)HeapAlloc( SystemHeap, 0, len ); mr = (METARECORD *)HeapAlloc( GetProcessHeap(), 0, len );
if(!mr) return 0; if(!mr) return 0;
mr->rdSize = len / 2; mr->rdSize = len / 2;
@ -189,7 +189,7 @@ INT MFDRV_StretchDIBits( DC *dc, INT xDst, INT yDst, INT widthDst,
memcpy(mr->rdParm + 11, info, infosize); memcpy(mr->rdParm + 11, info, infosize);
memcpy(mr->rdParm + 11 + infosize / 2, bits, imagesize); memcpy(mr->rdParm + 11 + infosize / 2, bits, imagesize);
MFDRV_WriteRecord( dc, mr, mr->rdSize * 2 ); MFDRV_WriteRecord( dc, mr, mr->rdSize * 2 );
HeapFree( SystemHeap, 0, mr ); HeapFree( GetProcessHeap(), 0, mr );
return heightSrc; return heightSrc;
} }
@ -212,7 +212,7 @@ INT MFDRV_SetDIBitsToDevice( DC *dc, INT xDst, INT yDst, DWORD cx,
info->bmiHeader.biBitCount ); info->bmiHeader.biBitCount );
len = sizeof(METARECORD) + 8 * sizeof(WORD) + infosize + imagesize; len = sizeof(METARECORD) + 8 * sizeof(WORD) + infosize + imagesize;
mr = (METARECORD *)HeapAlloc( SystemHeap, 0, len ); mr = (METARECORD *)HeapAlloc( GetProcessHeap(), 0, len );
if(!mr) return 0; if(!mr) return 0;
mr->rdSize = len / 2; mr->rdSize = len / 2;
@ -229,7 +229,7 @@ INT MFDRV_SetDIBitsToDevice( DC *dc, INT xDst, INT yDst, DWORD cx,
memcpy(mr->rdParm + 9, info, infosize); memcpy(mr->rdParm + 9, info, infosize);
memcpy(mr->rdParm + 9 + infosize / 2, bits, imagesize); memcpy(mr->rdParm + 9 + infosize / 2, bits, imagesize);
MFDRV_WriteRecord( dc, mr, mr->rdSize * 2 ); MFDRV_WriteRecord( dc, mr, mr->rdSize * 2 );
HeapFree( SystemHeap, 0, mr ); HeapFree( GetProcessHeap(), 0, mr );
return lines; return lines;
} }

View File

@ -120,7 +120,7 @@ static BOOL MFDRV_MetaPoly(DC *dc, short func, LPPOINT16 pt, short count)
METARECORD *mr; METARECORD *mr;
len = sizeof(METARECORD) + (count * 4); len = sizeof(METARECORD) + (count * 4);
if (!(mr = HeapAlloc( SystemHeap, HEAP_ZERO_MEMORY, len ))) if (!(mr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, len )))
return FALSE; return FALSE;
mr->rdSize = len / 2; mr->rdSize = len / 2;
@ -128,7 +128,7 @@ static BOOL MFDRV_MetaPoly(DC *dc, short func, LPPOINT16 pt, short count)
*(mr->rdParm) = count; *(mr->rdParm) = count;
memcpy(mr->rdParm + 1, pt, count * 4); memcpy(mr->rdParm + 1, pt, count * 4);
ret = MFDRV_WriteRecord( dc, mr, mr->rdSize * 2); ret = MFDRV_WriteRecord( dc, mr, mr->rdSize * 2);
HeapFree( SystemHeap, 0, mr); HeapFree( GetProcessHeap(), 0, mr);
return ret; return ret;
} }
@ -227,7 +227,7 @@ static INT16 MFDRV_CreateRegion(DC *dc, HRGN hrgn)
BOOL ret; BOOL ret;
len = GetRegionData( hrgn, 0, NULL ); len = GetRegionData( hrgn, 0, NULL );
if( !(rgndata = HeapAlloc( SystemHeap, 0, len )) ) { if( !(rgndata = HeapAlloc( GetProcessHeap(), 0, len )) ) {
WARN("Can't alloc rgndata buffer\n"); WARN("Can't alloc rgndata buffer\n");
return -1; return -1;
} }
@ -237,9 +237,9 @@ static INT16 MFDRV_CreateRegion(DC *dc, HRGN hrgn)
* Assume every rect is a separate band -> 6 WORDs per rect * Assume every rect is a separate band -> 6 WORDs per rect
*/ */
len = sizeof(METARECORD) + 20 + (rgndata->rdh.nCount * 12); len = sizeof(METARECORD) + 20 + (rgndata->rdh.nCount * 12);
if( !(mr = HeapAlloc( SystemHeap, HEAP_ZERO_MEMORY, len )) ) { if( !(mr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, len )) ) {
WARN("Can't alloc METARECORD buffer\n"); WARN("Can't alloc METARECORD buffer\n");
HeapFree( SystemHeap, 0, rgndata ); HeapFree( GetProcessHeap(), 0, rgndata );
return -1; return -1;
} }
@ -287,8 +287,8 @@ static INT16 MFDRV_CreateRegion(DC *dc, HRGN hrgn)
mr->rdFunction = META_CREATEREGION; mr->rdFunction = META_CREATEREGION;
mr->rdSize = len / 2; mr->rdSize = len / 2;
ret = MFDRV_WriteRecord( dc, mr, mr->rdSize * 2 ); ret = MFDRV_WriteRecord( dc, mr, mr->rdSize * 2 );
HeapFree( SystemHeap, 0, mr ); HeapFree( GetProcessHeap(), 0, mr );
HeapFree( SystemHeap, 0, rgndata ); HeapFree( GetProcessHeap(), 0, rgndata );
if(!ret) if(!ret)
{ {
WARN("MFDRV_WriteRecord failed\n"); WARN("MFDRV_WriteRecord failed\n");

View File

@ -125,7 +125,7 @@ static DC *MFDRV_AllocMetaFile(void)
if (!(dc = DC_AllocDC( &MFDRV_Funcs ))) return NULL; if (!(dc = DC_AllocDC( &MFDRV_Funcs ))) return NULL;
dc->header.wMagic = METAFILE_DC_MAGIC; dc->header.wMagic = METAFILE_DC_MAGIC;
physDev = (METAFILEDRV_PDEVICE *)HeapAlloc(SystemHeap,0,sizeof(*physDev)); physDev = (METAFILEDRV_PDEVICE *)HeapAlloc(GetProcessHeap(),0,sizeof(*physDev));
if (!physDev) if (!physDev)
{ {
GDI_HEAP_FREE( dc->hSelf ); GDI_HEAP_FREE( dc->hSelf );
@ -133,9 +133,9 @@ static DC *MFDRV_AllocMetaFile(void)
} }
dc->physDev = physDev; dc->physDev = physDev;
if (!(physDev->mh = HeapAlloc( SystemHeap, 0, sizeof(*physDev->mh) ))) if (!(physDev->mh = HeapAlloc( GetProcessHeap(), 0, sizeof(*physDev->mh) )))
{ {
HeapFree( SystemHeap, 0, physDev ); HeapFree( GetProcessHeap(), 0, physDev );
GDI_HEAP_FREE( dc->hSelf ); GDI_HEAP_FREE( dc->hSelf );
return NULL; return NULL;
} }
@ -161,8 +161,8 @@ static BOOL MFDRV_DeleteDC( DC *dc )
{ {
METAFILEDRV_PDEVICE *physDev = (METAFILEDRV_PDEVICE *)dc->physDev; METAFILEDRV_PDEVICE *physDev = (METAFILEDRV_PDEVICE *)dc->physDev;
if (physDev->mh) HeapFree( SystemHeap, 0, physDev->mh ); if (physDev->mh) HeapFree( GetProcessHeap(), 0, physDev->mh );
HeapFree( SystemHeap, 0, physDev ); HeapFree( GetProcessHeap(), 0, physDev );
dc->physDev = NULL; dc->physDev = NULL;
GDI_FreeObject(dc->hSelf); GDI_FreeObject(dc->hSelf);
return TRUE; return TRUE;
@ -352,7 +352,7 @@ BOOL MFDRV_WriteRecord( DC *dc, METARECORD *mr, DWORD rlen)
{ {
case METAFILE_MEMORY: case METAFILE_MEMORY:
len = physDev->mh->mtSize * 2 + rlen; len = physDev->mh->mtSize * 2 + rlen;
mh = HeapReAlloc( SystemHeap, 0, physDev->mh, len ); mh = HeapReAlloc( GetProcessHeap(), 0, physDev->mh, len );
if (!mh) return FALSE; if (!mh) return FALSE;
physDev->mh = mh; physDev->mh = mh;
memcpy((WORD *)physDev->mh + physDev->mh->mtSize, mr, rlen); memcpy((WORD *)physDev->mh + physDev->mh->mtSize, mr, rlen);

View File

@ -52,7 +52,7 @@ INT16 MFDRV_CreateBrushIndirect(DC *dc, HBRUSH hBrush )
lb16.lbColor = brushObj->logbrush.lbColor; lb16.lbColor = brushObj->logbrush.lbColor;
lb16.lbHatch = brushObj->logbrush.lbHatch; lb16.lbHatch = brushObj->logbrush.lbHatch;
size = sizeof(METARECORD) + sizeof(LOGBRUSH16) - 2; size = sizeof(METARECORD) + sizeof(LOGBRUSH16) - 2;
mr = HeapAlloc( SystemHeap, 0, size ); mr = HeapAlloc( GetProcessHeap(), 0, size );
mr->rdSize = size / 2; mr->rdSize = size / 2;
mr->rdFunction = META_CREATEBRUSHINDIRECT; mr->rdFunction = META_CREATEBRUSHINDIRECT;
memcpy( mr->rdParm, &lb16, sizeof(LOGBRUSH)); memcpy( mr->rdParm, &lb16, sizeof(LOGBRUSH));
@ -76,7 +76,7 @@ INT16 MFDRV_CreateBrushIndirect(DC *dc, HBRUSH hBrush )
size = sizeof(METARECORD) + sizeof(WORD) + sizeof(BITMAPINFO) + size = sizeof(METARECORD) + sizeof(WORD) + sizeof(BITMAPINFO) +
sizeof(RGBQUAD) + bmSize; sizeof(RGBQUAD) + bmSize;
mr = HeapAlloc(SystemHeap, HEAP_ZERO_MEMORY, size); mr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
if(!mr) return FALSE; if(!mr) return FALSE;
mr->rdFunction = META_DIBCREATEPATTERNBRUSH; mr->rdFunction = META_DIBCREATEPATTERNBRUSH;
mr->rdSize = size / 2; mr->rdSize = size / 2;
@ -113,7 +113,7 @@ INT16 MFDRV_CreateBrushIndirect(DC *dc, HBRUSH hBrush )
biSize = DIB_BitmapInfoSize(info, biSize = DIB_BitmapInfoSize(info,
LOWORD(brushObj->logbrush.lbColor)); LOWORD(brushObj->logbrush.lbColor));
size = sizeof(METARECORD) + biSize + bmSize + 2; size = sizeof(METARECORD) + biSize + bmSize + 2;
mr = HeapAlloc(SystemHeap, HEAP_ZERO_MEMORY, size); mr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
if(!mr) return FALSE; if(!mr) return FALSE;
mr->rdFunction = META_DIBCREATEPATTERNBRUSH; mr->rdFunction = META_DIBCREATEPATTERNBRUSH;
mr->rdSize = size / 2; mr->rdSize = size / 2;
@ -129,7 +129,7 @@ INT16 MFDRV_CreateBrushIndirect(DC *dc, HBRUSH hBrush )
index = MFDRV_AddHandleDC( dc ); index = MFDRV_AddHandleDC( dc );
if(!MFDRV_WriteRecord( dc, mr, mr->rdSize * 2)) if(!MFDRV_WriteRecord( dc, mr, mr->rdSize * 2))
index = -1; index = -1;
HeapFree(SystemHeap, 0, mr); HeapFree(GetProcessHeap(), 0, mr);
GDI_HEAP_UNLOCK( hBrush ); GDI_HEAP_UNLOCK( hBrush );
return index; return index;
} }

View File

@ -210,7 +210,7 @@ BOOL WIN16DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, LPCSTR output,
TRACE("In creatdc for (%s,%s,%s) initData 0x%p\n", TRACE("In creatdc for (%s,%s,%s) initData 0x%p\n",
driver, device, output, initData); driver, device, output, initData);
physDev = (WIN16DRV_PDEVICE *)HeapAlloc( SystemHeap, 0, sizeof(*physDev) ); physDev = (WIN16DRV_PDEVICE *)HeapAlloc( GetProcessHeap(), 0, sizeof(*physDev) );
if (!physDev) return FALSE; if (!physDev) return FALSE;
dc->physDev = physDev; dc->physDev = physDev;
@ -218,7 +218,7 @@ BOOL WIN16DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, LPCSTR output,
if (pLPD == NULL) if (pLPD == NULL)
{ {
WARN("Failed to find printer driver\n"); WARN("Failed to find printer driver\n");
HeapFree( SystemHeap, 0, physDev ); HeapFree( GetProcessHeap(), 0, physDev );
return FALSE; return FALSE;
} }
TRACE("windevCreateDC pLPD 0x%p\n", pLPD); TRACE("windevCreateDC pLPD 0x%p\n", pLPD);

View File

@ -185,7 +185,7 @@ LOADED_PRINTER_DRIVER *LoadPrinterDriver(const char *pszDriver)
memset(pLPD, 0 , sizeof(LOADED_PRINTER_DRIVER)); memset(pLPD, 0 , sizeof(LOADED_PRINTER_DRIVER));
pLPD->hInst = hInst; pLPD->hInst = hInst;
pLPD->szDriver = HEAP_strdupA(SystemHeap,0,pszDriver); pLPD->szDriver = HEAP_strdupA(GetProcessHeap(),0,pszDriver);
/* Get DS for the printer module */ /* Get DS for the printer module */
pLPD->ds_reg = hInst; pLPD->ds_reg = hInst;
@ -421,7 +421,7 @@ WORD PRTDRV_Output(LPPDEVICE lpDestDev,
RGNDATA *clip; RGNDATA *clip;
size = GetRegionData( hClipRgn, 0, NULL ); size = GetRegionData( hClipRgn, 0, NULL );
clip = HeapAlloc( SystemHeap, 0, size ); clip = HeapAlloc( GetProcessHeap(), 0, size );
if(!clip) if(!clip)
{ {
WARN("Can't alloc clip array in PRTDRV_Output\n"); WARN("Can't alloc clip array in PRTDRV_Output\n");
@ -456,7 +456,7 @@ WORD PRTDRV_Output(LPPDEVICE lpDestDev,
} }
SEGPTR_FREE(lP8); SEGPTR_FREE(lP8);
} }
HeapFree( SystemHeap, 0, clip ); HeapFree( GetProcessHeap(), 0, clip );
} }
else else
{ {

View File

@ -328,7 +328,7 @@ static LFD* LFD_Parse(LPSTR lpFont)
if (*lpch) if (*lpch)
WARN("Extra ignored in font '%s'\n", lpFont); WARN("Extra ignored in font '%s'\n", lpFont);
lfd = HeapAlloc( SystemHeap, 0, sizeof(LFD) ); lfd = HeapAlloc( GetProcessHeap(), 0, sizeof(LFD) );
if (lfd) if (lfd)
{ {
lfd->foundry = lfd_fld[0]; lfd->foundry = lfd_fld[0];
@ -1341,7 +1341,7 @@ static void XFONT_LoadDefault(LPCSTR ini, LPCSTR fonttype)
XFONT_LoadDefaultLFD(lfd, fonttype); XFONT_LoadDefaultLFD(lfd, fonttype);
else else
WARN("Ini section [%s]%s is malformed\n", INIFontSection, ini); WARN("Ini section [%s]%s is malformed\n", INIFontSection, ini);
HeapFree(SystemHeap, 0, lfd); HeapFree(GetProcessHeap(), 0, lfd);
} }
} }
} }
@ -1376,7 +1376,7 @@ static fontAlias* XFONT_CreateAlias( LPCSTR lpTypeFace, LPCSTR lpAlias )
} }
j = lstrlenA(lpTypeFace) + 1; j = lstrlenA(lpTypeFace) + 1;
pfa = HeapAlloc( SystemHeap, 0, sizeof(fontAlias) + pfa = HeapAlloc( GetProcessHeap(), 0, sizeof(fontAlias) +
j + lstrlenA(lpAlias) + 1 ); j + lstrlenA(lpAlias) + 1 );
if (pfa) if (pfa)
{ {
@ -1444,7 +1444,7 @@ static void XFONT_LoadAlias(const LFD* lfd, LPCSTR lpAlias, BOOL bSubst)
/* Update any references to the substituted font in aliasTable */ /* Update any references to the substituted font in aliasTable */
if(!strcmp(frMatch->lfFaceName, pfa->faTypeFace)) if(!strcmp(frMatch->lfFaceName, pfa->faTypeFace))
pfa->faTypeFace = HEAP_strdupA( SystemHeap, 0, lpAlias ); pfa->faTypeFace = HEAP_strdupA( GetProcessHeap(), 0, lpAlias );
prev = pfa; prev = pfa;
} }
@ -1511,7 +1511,7 @@ static void XFONT_LoadAliases(void)
XFONT_LoadAlias( lfd, "Times New Roman", FALSE); XFONT_LoadAlias( lfd, "Times New Roman", FALSE);
XFONT_LoadDefaultLFD( lfd, "serif "); XFONT_LoadDefaultLFD( lfd, "serif ");
HeapFree(SystemHeap, 0, lfd); HeapFree(GetProcessHeap(), 0, lfd);
} }
PROFILE_GetWineIniString( INIFontSection, INIDefaultSansSerif, PROFILE_GetWineIniString( INIFontSection, INIDefaultSansSerif,
@ -1525,7 +1525,7 @@ static void XFONT_LoadAliases(void)
XFONT_LoadAlias( lfd, "Arial", FALSE); XFONT_LoadAlias( lfd, "Arial", FALSE);
XFONT_LoadDefaultLFD( lfd, "sans serif "); XFONT_LoadDefaultLFD( lfd, "sans serif ");
HeapFree(SystemHeap, 0, lfd); HeapFree(GetProcessHeap(), 0, lfd);
} }
/* then user specified aliases */ /* then user specified aliases */
@ -1549,7 +1549,7 @@ static void XFONT_LoadAliases(void)
if (lfd) if (lfd)
{ {
XFONT_LoadAlias(lfd, buffer, bSubst); XFONT_LoadAlias(lfd, buffer, bSubst);
HeapFree(SystemHeap, 0, lfd); HeapFree(GetProcessHeap(), 0, lfd);
} }
} }
else else
@ -1601,10 +1601,10 @@ void XFONT_RemoveFontResource( fontResource** ppfr )
while( pfr->fi ) while( pfr->fi )
{ {
pfi = pfr->fi->next; pfi = pfr->fi->next;
HeapFree( SystemHeap, 0, pfr->fi ); HeapFree( GetProcessHeap(), 0, pfr->fi );
pfr->fi = pfi; pfr->fi = pfi;
} }
HeapFree( SystemHeap, 0, pfr ); HeapFree( GetProcessHeap(), 0, pfr );
#endif #endif
*ppfr = pfr->next; *ppfr = pfr->next;
} }
@ -1647,7 +1647,7 @@ static void XFONT_LoadIgnore(char* lfdname)
else else
WARN("Malformed font resource\n"); WARN("Malformed font resource\n");
HeapFree(SystemHeap, 0, lfd); HeapFree(GetProcessHeap(), 0, lfd);
} }
static void XFONT_LoadIgnores(void) static void XFONT_LoadIgnores(void)
@ -1696,7 +1696,7 @@ static char* XFONT_UserMetricsCache( char* buffer, int* buf_size )
int i = strlen( home ) + strlen( INIWinePrefix ) + int i = strlen( home ) + strlen( INIWinePrefix ) +
strlen( INIFontMetrics ) + strlen( pchDisplay ) + 2; strlen( INIFontMetrics ) + strlen( pchDisplay ) + 2;
if( i > *buf_size ) if( i > *buf_size )
buffer = (char*) HeapReAlloc( SystemHeap, 0, buffer, *buf_size = i ); buffer = (char*) HeapReAlloc( GetProcessHeap(), 0, buffer, *buf_size = i );
strcpy( buffer, home ); strcpy( buffer, home );
strcat( buffer, INIWinePrefix ); strcat( buffer, INIWinePrefix );
strcat( buffer, INIFontMetrics ); strcat( buffer, INIFontMetrics );
@ -1759,7 +1759,7 @@ static void XFONT_CheckFIList( fontResource* fr, fontInfo* fi, int action)
fr->fi_count--; fr->fi_count--;
if( prev ) prev->next = pfi = pfi->next; if( prev ) prev->next = pfi = pfi->next;
else fr->fi = pfi = pfi->next; else fr->fi = pfi = pfi->next;
HeapFree( SystemHeap, 0, subset ); HeapFree( GetProcessHeap(), 0, subset );
continue; continue;
} }
} }
@ -1834,14 +1834,14 @@ static int XFONT_BuildMetrics(char** x_pattern, int res, unsigned x_checksum, in
XFontStruct* x_fs; XFontStruct* x_fs;
fontInfo* pfi; fontInfo* pfi;
typeface = HEAP_strdupA(SystemHeap, 0, x_pattern[i]); typeface = HEAP_strdupA(GetProcessHeap(), 0, x_pattern[i]);
if (!typeface) if (!typeface)
break; break;
lfd = LFD_Parse(typeface); lfd = LFD_Parse(typeface);
if (!lfd) if (!lfd)
{ {
HeapFree(SystemHeap, 0, typeface); HeapFree(GetProcessHeap(), 0, typeface);
continue; continue;
} }
@ -1854,7 +1854,7 @@ static int XFONT_BuildMetrics(char** x_pattern, int res, unsigned x_checksum, in
pfr = fr; pfr = fr;
} }
if( !fi ) fi = (fontInfo*) HeapAlloc(SystemHeap, 0, sizeof(fontInfo)); if( !fi ) fi = (fontInfo*) HeapAlloc(GetProcessHeap(), 0, sizeof(fontInfo));
if( !LFD_InitFontInfo( fi, lfd, x_pattern[i]) ) if( !LFD_InitFontInfo( fi, lfd, x_pattern[i]) )
goto nextfont; goto nextfont;
@ -1862,17 +1862,17 @@ static int XFONT_BuildMetrics(char** x_pattern, int res, unsigned x_checksum, in
if( !fr ) /* add new family */ if( !fr ) /* add new family */
{ {
n_ff++; n_ff++;
fr = (fontResource*) HeapAlloc(SystemHeap, 0, sizeof(fontResource)); fr = (fontResource*) HeapAlloc(GetProcessHeap(), 0, sizeof(fontResource));
if (fr) if (fr)
{ {
memset(fr, 0, sizeof(fontResource)); memset(fr, 0, sizeof(fontResource));
fr->resource = (LFD*) HeapAlloc(SystemHeap, 0, sizeof(LFD)); fr->resource = (LFD*) HeapAlloc(GetProcessHeap(), 0, sizeof(LFD));
memset(fr->resource, 0, sizeof(LFD)); memset(fr->resource, 0, sizeof(LFD));
TRACE("family: -%s-%s-\n", lfd->foundry, lfd->family ); TRACE("family: -%s-%s-\n", lfd->foundry, lfd->family );
fr->resource->foundry = HEAP_strdupA(SystemHeap, 0, lfd->foundry); fr->resource->foundry = HEAP_strdupA(GetProcessHeap(), 0, lfd->foundry);
fr->resource->family = HEAP_strdupA(SystemHeap, 0, lfd->family); fr->resource->family = HEAP_strdupA(GetProcessHeap(), 0, lfd->family);
fr->resource->weight = ""; fr->resource->weight = "";
if( pfr ) pfr->next = fr; if( pfr ) pfr->next = fr;
@ -1934,10 +1934,10 @@ static int XFONT_BuildMetrics(char** x_pattern, int res, unsigned x_checksum, in
XFONT_CheckFIList( fr, fi, UNMARK_SUBSETS ); XFONT_CheckFIList( fr, fi, UNMARK_SUBSETS );
} }
nextfont: nextfont:
HeapFree(SystemHeap, 0, lfd); HeapFree(GetProcessHeap(), 0, lfd);
HeapFree(SystemHeap, 0, typeface); HeapFree(GetProcessHeap(), 0, typeface);
} }
if( fi ) HeapFree(SystemHeap, 0, fi); if( fi ) HeapFree(GetProcessHeap(), 0, fi);
return n_ff; return n_ff;
} }
@ -1969,7 +1969,7 @@ static BOOL XFONT_ReadCachedMetrics( int fd, int res, unsigned x_checksum, int x
if( length == (i + offset) ) if( length == (i + offset) )
{ {
lseek( fd, offset, SEEK_SET ); lseek( fd, offset, SEEK_SET );
fontList = (fontResource*)HeapAlloc( SystemHeap, 0, i); fontList = (fontResource*)HeapAlloc( GetProcessHeap(), 0, i);
if( fontList ) if( fontList )
{ {
fontResource* pfr = fontList; fontResource* pfr = fontList;
@ -2033,7 +2033,7 @@ static BOOL XFONT_ReadCachedMetrics( int fd, int res, unsigned x_checksum, int x
} }
} }
fail: fail:
if( fontList ) HeapFree( SystemHeap, 0, fontList ); if( fontList ) HeapFree( GetProcessHeap(), 0, fontList );
fontList = NULL; fontList = NULL;
close( fd ); close( fd );
} }
@ -2576,7 +2576,7 @@ static fontObject* XFONT_GetCacheEntry(void)
/* FIXME: lpXForm, lpPixmap */ /* FIXME: lpXForm, lpPixmap */
if(fontCache[j].lpX11Trans) if(fontCache[j].lpX11Trans)
HeapFree( SystemHeap, 0, fontCache[j].lpX11Trans ); HeapFree( GetProcessHeap(), 0, fontCache[j].lpX11Trans );
TSXFreeFont( display, fontCache[j].fs ); TSXFreeFont( display, fontCache[j].fs );
@ -2591,7 +2591,7 @@ static fontObject* XFONT_GetCacheEntry(void)
TRACE("\tgrowing font cache from %i to %i\n", fontCacheSize, prev_i ); TRACE("\tgrowing font cache from %i to %i\n", fontCacheSize, prev_i );
if( (newCache = (fontObject*)HeapReAlloc(SystemHeap, 0, if( (newCache = (fontObject*)HeapReAlloc(GetProcessHeap(), 0,
fontCache, prev_i)) ) fontCache, prev_i)) )
{ {
i = fontCacheSize; i = fontCacheSize;
@ -2654,7 +2654,7 @@ BOOL X11DRV_FONT_Init( DeviceCaps* pDevCaps )
} }
x_checksum |= X_PFONT_MAGIC; x_checksum |= X_PFONT_MAGIC;
buf_size = 128; buf_size = 128;
buffer = HeapAlloc( SystemHeap, 0, buf_size ); buffer = HeapAlloc( GetProcessHeap(), 0, buf_size );
/* deal with systemwide font metrics cache */ /* deal with systemwide font metrics cache */
@ -2700,7 +2700,7 @@ BOOL X11DRV_FONT_Init( DeviceCaps* pDevCaps )
TSXFreeFont(display, x_fs); TSXFreeFont(display, x_fs);
} }
} }
HeapFree(SystemHeap, 0, buffer); HeapFree(GetProcessHeap(), 0, buffer);
XFONT_WindowsNames(); XFONT_WindowsNames();
XFONT_LoadAliases(); XFONT_LoadAliases();
@ -2712,7 +2712,7 @@ BOOL X11DRV_FONT_Init( DeviceCaps* pDevCaps )
/* fontList initialization is over, allocate X font cache */ /* fontList initialization is over, allocate X font cache */
fontCache = (fontObject*) HeapAlloc(SystemHeap, 0, fontCacheSize * sizeof(fontObject)); fontCache = (fontObject*) HeapAlloc(GetProcessHeap(), 0, fontCacheSize * sizeof(fontObject));
XFONT_GrowFreeList(0, fontCacheSize - 1); XFONT_GrowFreeList(0, fontCacheSize - 1);
TRACE("done!\n"); TRACE("done!\n");
@ -2746,7 +2746,7 @@ static BOOL XFONT_SetX11Trans( fontObject *pfo )
} }
if (lfd->pixel_size[0] != '[') { if (lfd->pixel_size[0] != '[') {
HeapFree(SystemHeap, 0, lfd); HeapFree(GetProcessHeap(), 0, lfd);
TSXFree(fontName); TSXFree(fontName);
return FALSE; return FALSE;
} }
@ -2755,7 +2755,7 @@ static BOOL XFONT_SetX11Trans( fontObject *pfo )
sscanf(lfd->pixel_size, "[%f%f%f%f]", &PX->a, &PX->b, &PX->c, &PX->d); sscanf(lfd->pixel_size, "[%f%f%f%f]", &PX->a, &PX->b, &PX->c, &PX->d);
TSXFree(fontName); TSXFree(fontName);
HeapFree(SystemHeap, 0, lfd); HeapFree(GetProcessHeap(), 0, lfd);
TSXGetFontProperty( pfo->fs, RAW_ASCENT, &PX->RAW_ASCENT ); TSXGetFontProperty( pfo->fs, RAW_ASCENT, &PX->RAW_ASCENT );
TSXGetFontProperty( pfo->fs, RAW_DESCENT, &PX->RAW_DESCENT ); TSXGetFontProperty( pfo->fs, RAW_DESCENT, &PX->RAW_DESCENT );
@ -2830,9 +2830,9 @@ static X_PHYSFONT XFONT_RealizeFont( const LPLOGFONT16 plf, LPCSTR* faceMatched)
if(pfo->lf.lfEscapement != 0) { if(pfo->lf.lfEscapement != 0) {
pfo->lpX11Trans = HeapAlloc(SystemHeap, 0, sizeof(XFONTTRANS)); pfo->lpX11Trans = HeapAlloc(GetProcessHeap(), 0, sizeof(XFONTTRANS));
if(!XFONT_SetX11Trans( pfo )) { if(!XFONT_SetX11Trans( pfo )) {
HeapFree(SystemHeap, 0, pfo->lpX11Trans); HeapFree(GetProcessHeap(), 0, pfo->lpX11Trans);
pfo->lpX11Trans = NULL; pfo->lpX11Trans = NULL;
} }
} }

View File

@ -118,18 +118,18 @@ SNOOP16_RegisterDLL(NE_MODULE *pModule,LPCSTR name) {
return; /* already registered */ return; /* already registered */
dll = &((*dll)->next); dll = &((*dll)->next);
} }
*dll = (SNOOP16_DLL*)HeapAlloc(SystemHeap,HEAP_ZERO_MEMORY,sizeof(SNOOP16_DLL)); *dll = (SNOOP16_DLL*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SNOOP16_DLL));
(*dll)->next = NULL; (*dll)->next = NULL;
(*dll)->hmod = pModule->self; (*dll)->hmod = pModule->self;
if ((s=strrchr(name,'\\'))) if ((s=strrchr(name,'\\')))
name = s+1; name = s+1;
(*dll)->name = HEAP_strdupA(SystemHeap,0,name); (*dll)->name = HEAP_strdupA(GetProcessHeap(),0,name);
if ((s=strrchr((*dll)->name,'.'))) if ((s=strrchr((*dll)->name,'.')))
*s='\0'; *s='\0';
(*dll)->funhandle = GlobalHandleToSel16(GLOBAL_Alloc(GMEM_ZEROINIT,65535,0,TRUE,FALSE,FALSE)); (*dll)->funhandle = GlobalHandleToSel16(GLOBAL_Alloc(GMEM_ZEROINIT,65535,0,TRUE,FALSE,FALSE));
(*dll)->funs = GlobalLock16((*dll)->funhandle); (*dll)->funs = GlobalLock16((*dll)->funhandle);
if (!(*dll)->funs) { if (!(*dll)->funs) {
HeapFree(SystemHeap,0,*dll); HeapFree(GetProcessHeap(),0,*dll);
FIXME("out of memory\n"); FIXME("out of memory\n");
return; return;
} }
@ -185,9 +185,9 @@ SNOOP16_GetProcAddress16(HMODULE16 hmod,DWORD ordinal,FARPROC16 origfun) {
} }
} }
if (*cpnt) if (*cpnt)
fun->name = HEAP_strdupA(SystemHeap,0,name); fun->name = HEAP_strdupA(GetProcessHeap(),0,name);
else else
fun->name = HEAP_strdupA(SystemHeap,0,""); fun->name = HEAP_strdupA(GetProcessHeap(),0,"");
if (!SNOOP_ShowDebugmsgSnoop(dll->name, ordinal, fun->name)) if (!SNOOP_ShowDebugmsgSnoop(dll->name, ordinal, fun->name))
return origfun; return origfun;
@ -196,7 +196,7 @@ SNOOP16_GetProcAddress16(HMODULE16 hmod,DWORD ordinal,FARPROC16 origfun) {
char *s=strchr(fun->name,'_'); char *s=strchr(fun->name,'_');
if (!strncasecmp(s,"_thunkdata",10)) { if (!strncasecmp(s,"_thunkdata",10)) {
HeapFree(SystemHeap,0,fun->name); HeapFree(GetProcessHeap(),0,fun->name);
fun->name = NULL; fun->name = NULL;
return origfun; return origfun;
} }
@ -270,7 +270,7 @@ void WINAPI SNOOP16_Entry(FARPROC proc, LPBYTE args, CONTEXT86 *context) {
DPRINTF(" ..."); DPRINTF(" ...");
} else if (fun->nrofargs<0) { } else if (fun->nrofargs<0) {
DPRINTF("<unknown, check return>"); DPRINTF("<unknown, check return>");
ret->args = HeapAlloc(SystemHeap,0,16*sizeof(WORD)); ret->args = HeapAlloc(GetProcessHeap(),0,16*sizeof(WORD));
memcpy(ret->args,(LPBYTE)((char *) PTR_SEG_OFF_TO_LIN(SS_reg(context),LOWORD(ESP_reg(context)))+8),sizeof(WORD)*16); memcpy(ret->args,(LPBYTE)((char *) PTR_SEG_OFF_TO_LIN(SS_reg(context),LOWORD(ESP_reg(context)))+8),sizeof(WORD)*16);
} }
DPRINTF(") ret=%04x:%04x\n",HIWORD(ret->origreturn),LOWORD(ret->origreturn)); DPRINTF(") ret=%04x:%04x\n",HIWORD(ret->origreturn),LOWORD(ret->origreturn));
@ -306,7 +306,7 @@ void WINAPI SNOOP16_Return(FARPROC proc, LPBYTE args, CONTEXT86 *context) {
DPRINTF(") retval = %04x:%04x ret=%04x:%04x\n", DPRINTF(") retval = %04x:%04x ret=%04x:%04x\n",
DX_reg(context),AX_reg(context),HIWORD(ret->origreturn),LOWORD(ret->origreturn) DX_reg(context),AX_reg(context),HIWORD(ret->origreturn),LOWORD(ret->origreturn)
); );
HeapFree(SystemHeap,0,ret->args); HeapFree(GetProcessHeap(),0,ret->args);
ret->args = NULL; ret->args = NULL;
} else } else
DPRINTF("Ret %s.%ld: %s() retval = %04x:%04x ret=%04x:%04x\n", DPRINTF("Ret %s.%ld: %s() retval = %04x:%04x ret=%04x:%04x\n",

View File

@ -150,7 +150,7 @@ FARPROC THUNK_Alloc( FARPROC16 func, RELAY relay )
} }
/* Otherwise, we need to alloc a thunk */ /* Otherwise, we need to alloc a thunk */
thunk = HeapAlloc( SystemHeap, 0, sizeof(*thunk) ); thunk = HeapAlloc( GetProcessHeap(), 0, sizeof(*thunk) );
if (thunk) if (thunk)
{ {
thunk->popl_eax = 0x58; thunk->popl_eax = 0x58;
@ -179,14 +179,14 @@ void THUNK_Free( FARPROC thunk )
|| t->magic != CALLTO16_THUNK_MAGIC ) || t->magic != CALLTO16_THUNK_MAGIC )
return; return;
if (HEAP_IsInsideHeap( SystemHeap, 0, t )) if (HEAP_IsInsideHeap( GetProcessHeap(), 0, t ))
{ {
THUNK **prev = &firstThunk; THUNK **prev = &firstThunk;
while (*prev && (*prev != t)) prev = &(*prev)->next; while (*prev && (*prev != t)) prev = &(*prev)->next;
if (*prev) if (*prev)
{ {
*prev = t->next; *prev = t->next;
HeapFree( SystemHeap, 0, t ); HeapFree( GetProcessHeap(), 0, t );
return; return;
} }
} }

View File

@ -1,63 +1,15 @@
/* /*
* GDI region definitions * GDI region definitions
* Mainly taken from the X11 distribution. *
* Modifications: Copyright 1998 Huw Davies * Copyright 1998 Huw Davies
*/ */
/************************************************************************
Copyright (c) 1987 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
************************************************************************/
#ifndef __WINE_REGION_H #ifndef __WINE_REGION_H
#define __WINE_REGION_H #define __WINE_REGION_H
#include "wingdi.h" #include "wingdi.h"
#include "gdi.h" #include "gdi.h"
typedef struct { typedef struct {
INT size; INT size;
INT numRects; INT numRects;
@ -73,309 +25,6 @@ typedef struct
WINEREGION *rgn; WINEREGION *rgn;
} RGNOBJ; } RGNOBJ;
/* 1 if two RECTs overlap.
* 0 if two RECTs do not overlap.
*/
#define EXTENTCHECK(r1, r2) \
((r1)->right > (r2)->left && \
(r1)->left < (r2)->right && \
(r1)->bottom > (r2)->top && \
(r1)->top < (r2)->bottom)
/*
* Check to see if there is enough memory in the present region.
*/
#define MEMCHECK(reg, rect, firstrect){\
if ((reg)->numRects >= ((reg)->size - 1)){\
(firstrect) = HeapReAlloc( SystemHeap, 0, \
(firstrect), (2 * (sizeof(RECT)) * ((reg)->size)));\
if ((firstrect) == 0)\
return;\
(reg)->size *= 2;\
(rect) = &(firstrect)[(reg)->numRects];\
}\
}
#define EMPTY_REGION(pReg) { \
(pReg)->numRects = 0; \
(pReg)->extents.left = (pReg)->extents.top = 0; \
(pReg)->extents.right = (pReg)->extents.bottom = 0; \
(pReg)->type = NULLREGION; \
}
#define REGION_NOT_EMPTY(pReg) pReg->numRects
#define INRECT(r, x, y) \
( ( ((r).right > x)) && \
( ((r).left <= x)) && \
( ((r).bottom > y)) && \
( ((r).top <= y)) )
/*
* number of points to buffer before sending them off
* to scanlines() : Must be an even number
*/
#define NUMPTSTOBUFFER 200
/*
* used to allocate buffers for points and link
* the buffers together
*/
typedef struct _POINTBLOCK {
POINT pts[NUMPTSTOBUFFER];
struct _POINTBLOCK *next;
} POINTBLOCK;
/*
* This file contains a few macros to help track
* the edge of a filled object. The object is assumed
* to be filled in scanline order, and thus the
* algorithm used is an extension of Bresenham's line
* drawing algorithm which assumes that y is always the
* major axis.
* Since these pieces of code are the same for any filled shape,
* it is more convenient to gather the library in one
* place, but since these pieces of code are also in
* the inner loops of output primitives, procedure call
* overhead is out of the question.
* See the author for a derivation if needed.
*/
/*
* In scan converting polygons, we want to choose those pixels
* which are inside the polygon. Thus, we add .5 to the starting
* x coordinate for both left and right edges. Now we choose the
* first pixel which is inside the pgon for the left edge and the
* first pixel which is outside the pgon for the right edge.
* Draw the left pixel, but not the right.
*
* How to add .5 to the starting x coordinate:
* If the edge is moving to the right, then subtract dy from the
* error term from the general form of the algorithm.
* If the edge is moving to the left, then add dy to the error term.
*
* The reason for the difference between edges moving to the left
* and edges moving to the right is simple: If an edge is moving
* to the right, then we want the algorithm to flip immediately.
* If it is moving to the left, then we don't want it to flip until
* we traverse an entire pixel.
*/
#define BRESINITPGON(dy, x1, x2, xStart, d, m, m1, incr1, incr2) { \
int dx; /* local storage */ \
\
/* \
* if the edge is horizontal, then it is ignored \
* and assumed not to be processed. Otherwise, do this stuff. \
*/ \
if ((dy) != 0) { \
xStart = (x1); \
dx = (x2) - xStart; \
if (dx < 0) { \
m = dx / (dy); \
m1 = m - 1; \
incr1 = -2 * dx + 2 * (dy) * m1; \
incr2 = -2 * dx + 2 * (dy) * m; \
d = 2 * m * (dy) - 2 * dx - 2 * (dy); \
} else { \
m = dx / (dy); \
m1 = m + 1; \
incr1 = 2 * dx - 2 * (dy) * m1; \
incr2 = 2 * dx - 2 * (dy) * m; \
d = -2 * m * (dy) + 2 * dx; \
} \
} \
}
#define BRESINCRPGON(d, minval, m, m1, incr1, incr2) { \
if (m1 > 0) { \
if (d > 0) { \
minval += m1; \
d += incr1; \
} \
else { \
minval += m; \
d += incr2; \
} \
} else {\
if (d >= 0) { \
minval += m1; \
d += incr1; \
} \
else { \
minval += m; \
d += incr2; \
} \
} \
}
/*
* This structure contains all of the information needed
* to run the bresenham algorithm.
* The variables may be hardcoded into the declarations
* instead of using this structure to make use of
* register declarations.
*/
typedef struct {
INT minor_axis; /* minor axis */
INT d; /* decision variable */
INT m, m1; /* slope and slope+1 */
INT incr1, incr2; /* error increments */
} BRESINFO;
#define BRESINITPGONSTRUCT(dmaj, min1, min2, bres) \
BRESINITPGON(dmaj, min1, min2, bres.minor_axis, bres.d, \
bres.m, bres.m1, bres.incr1, bres.incr2)
#define BRESINCRPGONSTRUCT(bres) \
BRESINCRPGON(bres.d, bres.minor_axis, bres.m, bres.m1, bres.incr1, bres.incr2)
/*
* These are the data structures needed to scan
* convert regions. Two different scan conversion
* methods are available -- the even-odd method, and
* the winding number method.
* The even-odd rule states that a point is inside
* the polygon if a ray drawn from that point in any
* direction will pass through an odd number of
* path segments.
* By the winding number rule, a point is decided
* to be inside the polygon if a ray drawn from that
* point in any direction passes through a different
* number of clockwise and counter-clockwise path
* segments.
*
* These data structures are adapted somewhat from
* the algorithm in (Foley/Van Dam) for scan converting
* polygons.
* The basic algorithm is to start at the top (smallest y)
* of the polygon, stepping down to the bottom of
* the polygon by incrementing the y coordinate. We
* keep a list of edges which the current scanline crosses,
* sorted by x. This list is called the Active Edge Table (AET)
* As we change the y-coordinate, we update each entry in
* in the active edge table to reflect the edges new xcoord.
* This list must be sorted at each scanline in case
* two edges intersect.
* We also keep a data structure known as the Edge Table (ET),
* which keeps track of all the edges which the current
* scanline has not yet reached. The ET is basically a
* list of ScanLineList structures containing a list of
* edges which are entered at a given scanline. There is one
* ScanLineList per scanline at which an edge is entered.
* When we enter a new edge, we move it from the ET to the AET.
*
* From the AET, we can implement the even-odd rule as in
* (Foley/Van Dam).
* The winding number rule is a little trickier. We also
* keep the EdgeTableEntries in the AET linked by the
* nextWETE (winding EdgeTableEntry) link. This allows
* the edges to be linked just as before for updating
* purposes, but only uses the edges linked by the nextWETE
* link as edges representing spans of the polygon to
* drawn (as with the even-odd rule).
*/
/*
* for the winding number rule
*/
#define CLOCKWISE 1
#define COUNTERCLOCKWISE -1
typedef struct _EdgeTableEntry {
INT ymax; /* ycoord at which we exit this edge. */
BRESINFO bres; /* Bresenham info to run the edge */
struct _EdgeTableEntry *next; /* next in the list */
struct _EdgeTableEntry *back; /* for insertion sort */
struct _EdgeTableEntry *nextWETE; /* for winding num rule */
int ClockWise; /* flag for winding number rule */
} EdgeTableEntry;
typedef struct _ScanLineList{
INT scanline; /* the scanline represented */
EdgeTableEntry *edgelist; /* header node */
struct _ScanLineList *next; /* next in the list */
} ScanLineList;
typedef struct {
INT ymax; /* ymax for the polygon */
INT ymin; /* ymin for the polygon */
ScanLineList scanlines; /* header node */
} EdgeTable;
/*
* Here is a struct to help with storage allocation
* so we can allocate a big chunk at a time, and then take
* pieces from this heap when we need to.
*/
#define SLLSPERBLOCK 25
typedef struct _ScanLineListBlock {
ScanLineList SLLs[SLLSPERBLOCK];
struct _ScanLineListBlock *next;
} ScanLineListBlock;
/*
*
* a few macros for the inner loops of the fill code where
* performance considerations don't allow a procedure call.
*
* Evaluate the given edge at the given scanline.
* If the edge has expired, then we leave it and fix up
* the active edge table; otherwise, we increment the
* x value to be ready for the next scanline.
* The winding number rule is in effect, so we must notify
* the caller when the edge has been removed so he
* can reorder the Winding Active Edge Table.
*/
#define EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET) { \
if (pAET->ymax == y) { /* leaving this edge */ \
pPrevAET->next = pAET->next; \
pAET = pPrevAET->next; \
fixWAET = 1; \
if (pAET) \
pAET->back = pPrevAET; \
} \
else { \
BRESINCRPGONSTRUCT(pAET->bres); \
pPrevAET = pAET; \
pAET = pAET->next; \
} \
}
/*
* Evaluate the given edge at the given scanline.
* If the edge has expired, then we leave it and fix up
* the active edge table; otherwise, we increment the
* x value to be ready for the next scanline.
* The even-odd rule is in effect.
*/
#define EVALUATEEDGEEVENODD(pAET, pPrevAET, y) { \
if (pAET->ymax == y) { /* leaving this edge */ \
pPrevAET->next = pAET->next; \
pAET = pPrevAET->next; \
if (pAET) \
pAET->back = pPrevAET; \
} \
else { \
BRESINCRPGONSTRUCT(pAET->bres); \
pPrevAET = pAET; \
pAET = pAET->next; \
} \
}
extern BOOL REGION_DeleteObject( HRGN hrgn, RGNOBJ * obj ); extern BOOL REGION_DeleteObject( HRGN hrgn, RGNOBJ * obj );
extern BOOL REGION_UnionRectWithRgn( HRGN hrgn, const RECT *lpRect ); extern BOOL REGION_UnionRectWithRgn( HRGN hrgn, const RECT *lpRect );
extern HRGN REGION_CropRgn( HRGN hDst, HRGN hSrc, const RECT *lpRect, const POINT *lpPt ); extern HRGN REGION_CropRgn( HRGN hDst, HRGN hSrc, const RECT *lpRect, const POINT *lpPt );

View File

@ -90,13 +90,13 @@ static char *get_tok(const char *str, const char *delim)
if(str && buf) if(str && buf)
{ {
HeapFree(SystemHeap, 0, buf); HeapFree(GetProcessHeap(), 0, buf);
buf = NULL; buf = NULL;
} }
if(str && !buf) if(str && !buf)
{ {
buf = HEAP_strdupA(SystemHeap, 0, str); buf = HEAP_strdupA(GetProcessHeap(), 0, str);
cptr = strtok(buf, delim); cptr = strtok(buf, delim);
} }
else else
@ -106,7 +106,7 @@ static char *get_tok(const char *str, const char *delim)
if(!cptr) if(!cptr)
{ {
HeapFree(SystemHeap, 0, buf); HeapFree(GetProcessHeap(), 0, buf);
buf = NULL; buf = NULL;
} }
return cptr; return cptr;
@ -193,7 +193,7 @@ static BOOL AddLoadOrder(module_loadorder_t *plo, BOOL override)
{ {
/* No space in current array, make it larger */ /* No space in current array, make it larger */
nmodule_loadorder_alloc += LOADORDER_ALLOC_CLUSTER; nmodule_loadorder_alloc += LOADORDER_ALLOC_CLUSTER;
module_loadorder = (module_loadorder_t *)HeapReAlloc(SystemHeap, module_loadorder = (module_loadorder_t *)HeapReAlloc(GetProcessHeap(),
0, 0,
module_loadorder, module_loadorder,
nmodule_loadorder_alloc * sizeof(module_loadorder_t)); nmodule_loadorder_alloc * sizeof(module_loadorder_t));
@ -204,7 +204,7 @@ static BOOL AddLoadOrder(module_loadorder_t *plo, BOOL override)
} }
} }
memcpy(module_loadorder[nmodule_loadorder].loadorder, plo->loadorder, sizeof(plo->loadorder)); memcpy(module_loadorder[nmodule_loadorder].loadorder, plo->loadorder, sizeof(plo->loadorder));
module_loadorder[nmodule_loadorder].modulename = HEAP_strdupA(SystemHeap, 0, plo->modulename); module_loadorder[nmodule_loadorder].modulename = HEAP_strdupA(GetProcessHeap(), 0, plo->modulename);
nmodule_loadorder++; nmodule_loadorder++;
return TRUE; return TRUE;
} }
@ -262,7 +262,7 @@ static BOOL ParseCommandlineOverrides(void)
if(!Options.dllFlags) if(!Options.dllFlags)
return TRUE; return TRUE;
cpy = HEAP_strdupA(SystemHeap, 0, Options.dllFlags); cpy = HEAP_strdupA(GetProcessHeap(), 0, Options.dllFlags);
key = cpy; key = cpy;
next = key; next = key;
for(; next; key = next) for(; next; key = next)
@ -291,7 +291,7 @@ static BOOL ParseCommandlineOverrides(void)
} }
} }
endit: endit:
HeapFree(SystemHeap, 0, cpy); HeapFree(GetProcessHeap(), 0, cpy);
return retval;; return retval;;
} }
@ -375,7 +375,7 @@ BOOL MODULE_InitLoadOrder(void)
if(nbuffer) if(nbuffer)
{ {
extra_ld_library_path = HEAP_strdupA(SystemHeap, 0, buffer); extra_ld_library_path = HEAP_strdupA(GetProcessHeap(), 0, buffer);
TRACE("Setting extra LD_LIBRARY_PATH=%s\n", buffer); TRACE("Setting extra LD_LIBRARY_PATH=%s\n", buffer);
} }
#endif #endif

View File

@ -499,12 +499,12 @@ static HMODULE16 NE_LoadExeHeader( LPCSTR filename )
fastload_length=ne_header.fastload_length<<ne_header.align_shift_count; fastload_length=ne_header.fastload_length<<ne_header.align_shift_count;
TRACE("Using fast-load area offset=%x len=%d\n", TRACE("Using fast-load area offset=%x len=%d\n",
fastload_offset, fastload_length ); fastload_offset, fastload_length );
if ((fastload = HeapAlloc( SystemHeap, 0, fastload_length )) != NULL) if ((fastload = HeapAlloc( GetProcessHeap(), 0, fastload_length )) != NULL)
{ {
_llseek16( hFile, fastload_offset, SEEK_SET); _llseek16( hFile, fastload_offset, SEEK_SET);
if (_hread16(hFile, fastload, fastload_length) != fastload_length) if (_hread16(hFile, fastload, fastload_length) != fastload_length)
{ {
HeapFree( SystemHeap, 0, fastload ); HeapFree( GetProcessHeap(), 0, fastload );
WARN("Error reading fast-load area!\n"); WARN("Error reading fast-load area!\n");
fastload = NULL; fastload = NULL;
} }
@ -514,7 +514,7 @@ static HMODULE16 NE_LoadExeHeader( LPCSTR filename )
/* Get the segment table */ /* Get the segment table */
pModule->seg_table = (int)pData - (int)pModule; pModule->seg_table = (int)pData - (int)pModule;
buffer = HeapAlloc( SystemHeap, 0, ne_header.n_segment_tab * buffer = HeapAlloc( GetProcessHeap(), 0, ne_header.n_segment_tab *
sizeof(struct ne_segment_table_entry_s)); sizeof(struct ne_segment_table_entry_s));
if (buffer) if (buffer)
{ {
@ -525,9 +525,9 @@ static HMODULE16 NE_LoadExeHeader( LPCSTR filename )
ne_header.n_segment_tab * sizeof(struct ne_segment_table_entry_s), ne_header.n_segment_tab * sizeof(struct ne_segment_table_entry_s),
buffer )) buffer ))
{ {
HeapFree( SystemHeap, 0, buffer ); HeapFree( GetProcessHeap(), 0, buffer );
if (fastload) if (fastload)
HeapFree( SystemHeap, 0, fastload ); HeapFree( GetProcessHeap(), 0, fastload );
GlobalFree16( hModule ); GlobalFree16( hModule );
_lclose16( hFile ); _lclose16( hFile );
return (HMODULE16)11; /* invalid exe */ return (HMODULE16)11; /* invalid exe */
@ -538,12 +538,12 @@ static HMODULE16 NE_LoadExeHeader( LPCSTR filename )
memcpy( pData, pSeg, sizeof(*pSeg) ); memcpy( pData, pSeg, sizeof(*pSeg) );
pData += sizeof(SEGTABLEENTRY); pData += sizeof(SEGTABLEENTRY);
} }
HeapFree( SystemHeap, 0, buffer ); HeapFree( GetProcessHeap(), 0, buffer );
} }
else else
{ {
if (fastload) if (fastload)
HeapFree( SystemHeap, 0, fastload ); HeapFree( GetProcessHeap(), 0, fastload );
GlobalFree16( hModule ); GlobalFree16( hModule );
_lclose16( hFile ); _lclose16( hFile );
return (HMODULE16)11; /* invalid exe */ return (HMODULE16)11; /* invalid exe */
@ -574,7 +574,7 @@ static HMODULE16 NE_LoadExeHeader( LPCSTR filename )
pData )) pData ))
{ {
if (fastload) if (fastload)
HeapFree( SystemHeap, 0, fastload ); HeapFree( GetProcessHeap(), 0, fastload );
GlobalFree16( hModule ); GlobalFree16( hModule );
_lclose16( hFile ); _lclose16( hFile );
return (HMODULE16)11; /* invalid exe */ return (HMODULE16)11; /* invalid exe */
@ -591,7 +591,7 @@ static HMODULE16 NE_LoadExeHeader( LPCSTR filename )
pData )) pData ))
{ {
if (fastload) if (fastload)
HeapFree( SystemHeap, 0, fastload ); HeapFree( GetProcessHeap(), 0, fastload );
GlobalFree16( hModule ); GlobalFree16( hModule );
_lclose16( hFile ); _lclose16( hFile );
return (HMODULE16)11; /* invalid exe */ return (HMODULE16)11; /* invalid exe */
@ -608,7 +608,7 @@ static HMODULE16 NE_LoadExeHeader( LPCSTR filename )
pData )) pData ))
{ {
if (fastload) if (fastload)
HeapFree( SystemHeap, 0, fastload ); HeapFree( GetProcessHeap(), 0, fastload );
GlobalFree16( hModule ); GlobalFree16( hModule );
_lclose16( hFile ); _lclose16( hFile );
return (HMODULE16)11; /* invalid exe */ return (HMODULE16)11; /* invalid exe */
@ -617,7 +617,7 @@ static HMODULE16 NE_LoadExeHeader( LPCSTR filename )
/* Load entry table, convert it to the optimized version used by Windows */ /* Load entry table, convert it to the optimized version used by Windows */
if ((pTempEntryTable = HeapAlloc( SystemHeap, 0, ne_header.entry_tab_length)) != NULL) if ((pTempEntryTable = HeapAlloc( GetProcessHeap(), 0, ne_header.entry_tab_length)) != NULL)
{ {
BYTE nr_entries, type, *s; BYTE nr_entries, type, *s;
@ -626,9 +626,9 @@ static HMODULE16 NE_LoadExeHeader( LPCSTR filename )
if (!READ( mz_header.e_lfanew + ne_header.entry_tab_offset, if (!READ( mz_header.e_lfanew + ne_header.entry_tab_offset,
ne_header.entry_tab_length, pTempEntryTable )) ne_header.entry_tab_length, pTempEntryTable ))
{ {
HeapFree( SystemHeap, 0, pTempEntryTable ); HeapFree( GetProcessHeap(), 0, pTempEntryTable );
if (fastload) if (fastload)
HeapFree( SystemHeap, 0, fastload ); HeapFree( GetProcessHeap(), 0, fastload );
GlobalFree16( hModule ); GlobalFree16( hModule );
_lclose16( hFile ); _lclose16( hFile );
return (HMODULE16)11; /* invalid exe */ return (HMODULE16)11; /* invalid exe */
@ -689,12 +689,12 @@ static HMODULE16 NE_LoadExeHeader( LPCSTR filename )
} }
} }
} }
HeapFree( SystemHeap, 0, pTempEntryTable ); HeapFree( GetProcessHeap(), 0, pTempEntryTable );
} }
else else
{ {
if (fastload) if (fastload)
HeapFree( SystemHeap, 0, fastload ); HeapFree( GetProcessHeap(), 0, fastload );
GlobalFree16( hModule ); GlobalFree16( hModule );
_lclose16( hFile ); _lclose16( hFile );
return (HMODULE16)11; /* invalid exe */ return (HMODULE16)11; /* invalid exe */
@ -718,7 +718,7 @@ static HMODULE16 NE_LoadExeHeader( LPCSTR filename )
#undef READ #undef READ
if (fastload) if (fastload)
HeapFree( SystemHeap, 0, fastload ); HeapFree( GetProcessHeap(), 0, fastload );
/* Get the non-resident names table */ /* Get the non-resident names table */

View File

@ -305,7 +305,7 @@ static DWORD Release_reserved_mutex (HANDLE mutex, LPSTR mutex_name, BOOL releas
if (!ReleaseMutex(mutex)) if (!ReleaseMutex(mutex))
{ {
ERR("ReleaseMutex failed - %s mutex %li\n",mutex_name,GetLastError()); ERR("ReleaseMutex failed - %s mutex %li\n",mutex_name,GetLastError());
HeapFree(SystemHeap, 0, this_instance); HeapFree(GetProcessHeap(), 0, this_instance);
if ( release_handle_m ) if ( release_handle_m )
{ {
ReleaseMutex(handle_mutex); ReleaseMutex(handle_mutex);
@ -314,7 +314,7 @@ static DWORD Release_reserved_mutex (HANDLE mutex, LPSTR mutex_name, BOOL releas
} }
if ( release_this_i ) if ( release_this_i )
{ {
HeapFree(SystemHeap, 0, this_instance); HeapFree(GetProcessHeap(), 0, this_instance);
} }
return DMLERR_NO_ERROR; return DMLERR_NO_ERROR;
} }
@ -565,7 +565,7 @@ UINT WINAPI DdeInitializeW( LPDWORD pidInst, PFNCALLBACK pfnCallback,
/* grab enough heap for one control struct - not really necessary for re-initialise /* grab enough heap for one control struct - not really necessary for re-initialise
* but allows us to use same validation routines */ * but allows us to use same validation routines */
this_instance= (DDE_HANDLE_ENTRY*)HeapAlloc( SystemHeap, 0, sizeof(DDE_HANDLE_ENTRY) ); this_instance= (DDE_HANDLE_ENTRY*)HeapAlloc( GetProcessHeap(), 0, sizeof(DDE_HANDLE_ENTRY) );
if ( this_instance == NULL ) if ( this_instance == NULL )
{ {
/* catastrophe !! warn user & abort */ /* catastrophe !! warn user & abort */
@ -616,7 +616,7 @@ UINT WINAPI DdeInitializeW( LPDWORD pidInst, PFNCALLBACK pfnCallback,
handle_mutex = ConvertToGlobalHandle(handle_mutex); /* fixme when having seperate adresspaces*/ handle_mutex = ConvertToGlobalHandle(handle_mutex); /* fixme when having seperate adresspaces*/
if ( !handle_mutex ) { if ( !handle_mutex ) {
ERR("CreateMutex failed - handle list %li\n",GetLastError()); ERR("CreateMutex failed - handle list %li\n",GetLastError());
HeapFree(SystemHeap, 0, this_instance); HeapFree(GetProcessHeap(), 0, this_instance);
return DMLERR_SYS_ERROR; return DMLERR_SYS_ERROR;
} }
} else { } else {
@ -706,7 +706,7 @@ UINT WINAPI DdeInitializeW( LPDWORD pidInst, PFNCALLBACK pfnCallback,
if ( !WaitForMutex(handle_mutex) ) if ( !WaitForMutex(handle_mutex) )
{ {
HeapFree(SystemHeap, 0, this_instance); HeapFree(GetProcessHeap(), 0, this_instance);
return DMLERR_SYS_ERROR; return DMLERR_SYS_ERROR;
} }
@ -715,7 +715,7 @@ UINT WINAPI DdeInitializeW( LPDWORD pidInst, PFNCALLBACK pfnCallback,
if ( Release_reserved_mutex(handle_mutex,"handle_mutex",0,1,this_instance)) return DMLERR_SYS_ERROR; if ( Release_reserved_mutex(handle_mutex,"handle_mutex",0,1,this_instance)) return DMLERR_SYS_ERROR;
return DMLERR_DLL_USAGE; return DMLERR_DLL_USAGE;
} }
HeapFree(SystemHeap, 0, this_instance); /* finished - release heap space used as work store */ HeapFree(GetProcessHeap(), 0, this_instance); /* finished - release heap space used as work store */
/* can't reinitialise if we have initialised nothing !! */ /* can't reinitialise if we have initialised nothing !! */
reference_inst = DDE_Handle_Table_Base; reference_inst = DDE_Handle_Table_Base;
/* must first check if we have been given a valid instance to re-initialise !! how do we do that ? */ /* must first check if we have been given a valid instance to re-initialise !! how do we do that ? */
@ -1888,10 +1888,10 @@ HDDEDATA WINAPI DdeNameService( DWORD idInst, HSZ hsz1, HSZ hsz2,
reference_service = this_service; reference_service = this_service;
this_service = this_service->next; this_service = this_service->next;
DdeReleaseAtom(reference_inst,reference_service->hsz); DdeReleaseAtom(reference_inst,reference_service->hsz);
HeapFree(SystemHeap, 0, reference_service); /* finished - release heap space used as work store */ HeapFree(GetProcessHeap(), 0, reference_service); /* finished - release heap space used as work store */
} }
DdeReleaseAtom(reference_inst,this_service->hsz); DdeReleaseAtom(reference_inst,this_service->hsz);
HeapFree(SystemHeap, 0, this_service); /* finished - release heap space used as work store */ HeapFree(GetProcessHeap(), 0, this_service); /* finished - release heap space used as work store */
reference_inst->ServiceNames = NULL; reference_inst->ServiceNames = NULL;
TRACE("General de-register - finished\n"); TRACE("General de-register - finished\n");
} }
@ -1913,7 +1913,7 @@ HDDEDATA WINAPI DdeNameService( DWORD idInst, HSZ hsz1, HSZ hsz2,
DdeReserveAtom(reference_inst, hsz1); DdeReserveAtom(reference_inst, hsz1);
this_service = (ServiceNode*)HeapAlloc( SystemHeap, 0, sizeof(ServiceNode) ); this_service = (ServiceNode*)HeapAlloc( GetProcessHeap(), 0, sizeof(ServiceNode) );
this_service->hsz = hsz1; this_service->hsz = hsz1;
this_service->FilterOn = TRUE; this_service->FilterOn = TRUE;
@ -1937,7 +1937,7 @@ HDDEDATA WINAPI DdeNameService( DWORD idInst, HSZ hsz1, HSZ hsz2,
{ {
*pServiceNode = this_service->next; *pServiceNode = this_service->next;
DdeReleaseAtom(reference_inst,this_service->hsz); DdeReleaseAtom(reference_inst,this_service->hsz);
HeapFree(SystemHeap, 0, this_service); HeapFree(GetProcessHeap(), 0, this_service);
} }
} }
if ( afCmd & DNS_FILTERON ) if ( afCmd & DNS_FILTERON )

View File

@ -50,10 +50,10 @@ BOOL16 WINAPI NotifyRegister16( HTASK16 htask, FARPROC16 lpfnCallback,
break; break;
if (i==nrofnotifys) { if (i==nrofnotifys) {
if (notifys==NULL) if (notifys==NULL)
notifys=(struct notify*)HeapAlloc( SystemHeap, 0, notifys=(struct notify*)HeapAlloc( GetProcessHeap(), 0,
sizeof(struct notify) ); sizeof(struct notify) );
else else
notifys=(struct notify*)HeapReAlloc( SystemHeap, 0, notifys, notifys=(struct notify*)HeapReAlloc( GetProcessHeap(), 0, notifys,
sizeof(struct notify)*(nrofnotifys+1)); sizeof(struct notify)*(nrofnotifys+1));
if (!notifys) return FALSE; if (!notifys) return FALSE;
nrofnotifys++; nrofnotifys++;
@ -76,7 +76,7 @@ BOOL16 WINAPI NotifyUnregister16( HTASK16 htask )
if (i==-1) if (i==-1)
return FALSE; return FALSE;
memcpy(notifys+i,notifys+(i+1),sizeof(struct notify)*(nrofnotifys-i-1)); memcpy(notifys+i,notifys+(i+1),sizeof(struct notify)*(nrofnotifys-i-1));
notifys=(struct notify*)HeapReAlloc( SystemHeap, 0, notifys, notifys=(struct notify*)HeapReAlloc( GetProcessHeap(), 0, notifys,
(nrofnotifys-1)*sizeof(struct notify)); (nrofnotifys-1)*sizeof(struct notify));
nrofnotifys--; nrofnotifys--;
return TRUE; return TRUE;

View File

@ -63,7 +63,7 @@ static BOOL EMF_Delete_HENHMETAFILE( HENHMETAFILE hmf )
CloseHandle( metaObj->hMapping ); CloseHandle( metaObj->hMapping );
CloseHandle( metaObj->hFile ); CloseHandle( metaObj->hFile );
} else } else
HeapFree( SystemHeap, 0, metaObj->emh ); HeapFree( GetProcessHeap(), 0, metaObj->emh );
return GDI_FreeObject( hmf ); return GDI_FreeObject( hmf );
} }
@ -256,7 +256,7 @@ UINT WINAPI GetEnhMetaFileDescriptionW(
*/ */
HENHMETAFILE WINAPI SetEnhMetaFileBits(UINT bufsize, const BYTE *buf) HENHMETAFILE WINAPI SetEnhMetaFileBits(UINT bufsize, const BYTE *buf)
{ {
ENHMETAHEADER *emh = HeapAlloc( SystemHeap, 0, bufsize ); ENHMETAHEADER *emh = HeapAlloc( GetProcessHeap(), 0, bufsize );
memmove(emh, buf, bufsize); memmove(emh, buf, bufsize);
return EMF_Create_HENHMETAFILE( emh, 0, 0 ); return EMF_Create_HENHMETAFILE( emh, 0, 0 );
} }
@ -1333,7 +1333,7 @@ HENHMETAFILE WINAPI CopyEnhMetaFileA(
if(!emrSrc) return FALSE; if(!emrSrc) return FALSE;
if (!file) { if (!file) {
emrDst = HeapAlloc( SystemHeap, 0, emrSrc->nBytes ); emrDst = HeapAlloc( GetProcessHeap(), 0, emrSrc->nBytes );
memcpy( emrDst, emrSrc, emrSrc->nBytes ); memcpy( emrDst, emrSrc, emrSrc->nBytes );
hmfDst = EMF_Create_HENHMETAFILE( emrDst, 0, 0 ); hmfDst = EMF_Create_HENHMETAFILE( emrDst, 0, 0 );
} else { } else {
@ -1478,7 +1478,7 @@ HENHMETAFILE WINAPI SetWinMetaFileBits(UINT cbBuffer,
/* 1. Get the header - skip over this and get straight to the records */ /* 1. Get the header - skip over this and get straight to the records */
uNewEnhMetaFileBufferSize = sizeof( ENHMETAHEADER ); uNewEnhMetaFileBufferSize = sizeof( ENHMETAHEADER );
lpNewEnhMetaFileBuffer = HeapAlloc( SystemHeap, HEAP_ZERO_MEMORY, lpNewEnhMetaFileBuffer = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
uNewEnhMetaFileBufferSize ); uNewEnhMetaFileBufferSize );
if( lpNewEnhMetaFileBuffer == NULL ) if( lpNewEnhMetaFileBuffer == NULL )
@ -1533,7 +1533,7 @@ HENHMETAFILE WINAPI SetWinMetaFileBits(UINT cbBuffer,
#define EMF_ReAllocAndAdjustPointers( a , b ) \ #define EMF_ReAllocAndAdjustPointers( a , b ) \
{ \ { \
LPVOID lpTmp; \ LPVOID lpTmp; \
lpTmp = HeapReAlloc( SystemHeap, 0, \ lpTmp = HeapReAlloc( GetProcessHeap(), 0, \
lpNewEnhMetaFileBuffer, \ lpNewEnhMetaFileBuffer, \
uNewEnhMetaFileBufferSize + (b) ); \ uNewEnhMetaFileBufferSize + (b) ); \
if( lpTmp == NULL ) { ERR( "No memory!\n" ); goto error; } \ if( lpTmp == NULL ) { ERR( "No memory!\n" ); goto error; } \
@ -1802,7 +1802,7 @@ HENHMETAFILE WINAPI SetWinMetaFileBits(UINT cbBuffer,
error: error:
/* Free the data associated with our copy since it's been copied */ /* Free the data associated with our copy since it's been copied */
HeapFree( SystemHeap, 0, lpNewEnhMetaFileBuffer ); HeapFree( GetProcessHeap(), 0, lpNewEnhMetaFileBuffer );
return 0; return 0;
} }

View File

@ -165,7 +165,7 @@ BOOL WINAPI DeleteMetaFile( HMETAFILE hmf )
METAHEADER *mh = MF_GetMetaHeader( hmf ); METAHEADER *mh = MF_GetMetaHeader( hmf );
if(!mh) return FALSE; if(!mh) return FALSE;
HeapFree( SystemHeap, 0, mh ); HeapFree( GetProcessHeap(), 0, mh );
GDI_FreeObject( hmf ); GDI_FreeObject( hmf );
return TRUE; return TRUE;
} }
@ -182,21 +182,21 @@ static METAHEADER *MF_ReadMetaFile(HFILE hfile)
DWORD BytesRead, size; DWORD BytesRead, size;
size = sizeof(METAHEADER); size = sizeof(METAHEADER);
mh = HeapAlloc( SystemHeap, 0, size ); mh = HeapAlloc( GetProcessHeap(), 0, size );
if(!mh) return NULL; if(!mh) return NULL;
if(ReadFile( hfile, mh, size, &BytesRead, NULL) == 0 || if(ReadFile( hfile, mh, size, &BytesRead, NULL) == 0 ||
BytesRead != size) { BytesRead != size) {
HeapFree( SystemHeap, 0, mh ); HeapFree( GetProcessHeap(), 0, mh );
return NULL; return NULL;
} }
size = mh->mtSize * 2; size = mh->mtSize * 2;
mh = HeapReAlloc( SystemHeap, 0, mh, size ); mh = HeapReAlloc( GetProcessHeap(), 0, mh, size );
if(!mh) return NULL; if(!mh) return NULL;
size -= sizeof(METAHEADER); size -= sizeof(METAHEADER);
if(ReadFile( hfile, (char *)mh + sizeof(METAHEADER), size, &BytesRead, if(ReadFile( hfile, (char *)mh + sizeof(METAHEADER), size, &BytesRead,
NULL) == 0 || NULL) == 0 ||
BytesRead != size) { BytesRead != size) {
HeapFree( SystemHeap, 0, mh ); HeapFree( GetProcessHeap(), 0, mh );
return NULL; return NULL;
} }
@ -319,10 +319,10 @@ METAHEADER *MF_CreateMetaHeaderDisk(METAHEADER *mh, LPCSTR filename)
METAHEADERDISK *mhd; METAHEADERDISK *mhd;
DWORD size; DWORD size;
mh = HeapReAlloc( SystemHeap, 0, mh, mh = HeapReAlloc( GetProcessHeap(), 0, mh,
sizeof(METAHEADER) + sizeof(METAHEADERDISK)); sizeof(METAHEADER) + sizeof(METAHEADERDISK));
mh->mtType = METAFILE_DISK; mh->mtType = METAFILE_DISK;
size = HeapSize( SystemHeap, 0, mh ); size = HeapSize( GetProcessHeap(), 0, mh );
mhd = (METAHEADERDISK *)((char *)mh + sizeof(METAHEADER)); mhd = (METAHEADERDISK *)((char *)mh + sizeof(METAHEADER));
strcpy(mhd->filename, filename); strcpy(mhd->filename, filename);
return mh; return mh;
@ -344,7 +344,7 @@ HMETAFILE16 WINAPI CopyMetaFile16( HMETAFILE16 hSrcMetaFile, LPCSTR lpFilename)
if(mh->mtType == METAFILE_DISK) if(mh->mtType == METAFILE_DISK)
mh2 = MF_LoadDiskBasedMetaFile(mh); mh2 = MF_LoadDiskBasedMetaFile(mh);
else { else {
mh2 = HeapAlloc( SystemHeap, 0, mh->mtSize * 2 ); mh2 = HeapAlloc( GetProcessHeap(), 0, mh->mtSize * 2 );
memcpy( mh2, mh, mh->mtSize * 2 ); memcpy( mh2, mh, mh->mtSize * 2 );
} }
MF_ReleaseMetaHeader16( hSrcMetaFile ); MF_ReleaseMetaHeader16( hSrcMetaFile );
@ -352,7 +352,7 @@ HMETAFILE16 WINAPI CopyMetaFile16( HMETAFILE16 hSrcMetaFile, LPCSTR lpFilename)
if(lpFilename) { /* disk based metafile */ if(lpFilename) { /* disk based metafile */
if((hFile = CreateFileA(lpFilename, GENERIC_WRITE, 0, NULL, if((hFile = CreateFileA(lpFilename, GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, 0, -1)) == HFILE_ERROR) { CREATE_ALWAYS, 0, -1)) == HFILE_ERROR) {
HeapFree( SystemHeap, 0, mh2 ); HeapFree( GetProcessHeap(), 0, mh2 );
return 0; return 0;
} }
WriteFile(hFile, mh2, mh2->mtSize * 2, NULL, NULL); WriteFile(hFile, mh2, mh2->mtSize * 2, NULL, NULL);
@ -394,7 +394,7 @@ HMETAFILE WINAPI CopyMetaFileA(
if(mh->mtType == METAFILE_DISK) if(mh->mtType == METAFILE_DISK)
mh2 = MF_LoadDiskBasedMetaFile(mh); mh2 = MF_LoadDiskBasedMetaFile(mh);
else { else {
mh2 = HeapAlloc( SystemHeap, 0, mh->mtSize * 2 ); mh2 = HeapAlloc( GetProcessHeap(), 0, mh->mtSize * 2 );
memcpy( mh2, mh, mh->mtSize * 2 ); memcpy( mh2, mh, mh->mtSize * 2 );
} }
MF_ReleaseMetaHeader( hSrcMetaFile ); MF_ReleaseMetaHeader( hSrcMetaFile );
@ -402,7 +402,7 @@ HMETAFILE WINAPI CopyMetaFileA(
if(lpFilename) { /* disk based metafile */ if(lpFilename) { /* disk based metafile */
if((hFile = CreateFileA(lpFilename, GENERIC_WRITE, 0, NULL, if((hFile = CreateFileA(lpFilename, GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, 0, -1)) == HFILE_ERROR) { CREATE_ALWAYS, 0, -1)) == HFILE_ERROR) {
HeapFree( SystemHeap, 0, mh2 ); HeapFree( GetProcessHeap(), 0, mh2 );
return 0; return 0;
} }
WriteFile(hFile, mh2, mh2->mtSize * 2, NULL, NULL); WriteFile(hFile, mh2, mh2->mtSize * 2, NULL, NULL);
@ -487,7 +487,7 @@ static BOOL MF_PlayMetaFile( HDC hdc, METAHEADER *mh)
hFont = GetCurrentObject(hdc, OBJ_FONT); hFont = GetCurrentObject(hdc, OBJ_FONT);
/* create the handle table */ /* create the handle table */
ht = HeapAlloc( SystemHeap, HEAP_ZERO_MEMORY, ht = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(HANDLETABLE16) * mh->mtNoObjects); sizeof(HANDLETABLE16) * mh->mtNoObjects);
if(!ht) return FALSE; if(!ht) return FALSE;
@ -518,9 +518,9 @@ static BOOL MF_PlayMetaFile( HDC hdc, METAHEADER *mh)
DeleteObject(*(ht->objectHandle + i)); DeleteObject(*(ht->objectHandle + i));
/* free handle table */ /* free handle table */
HeapFree( SystemHeap, 0, ht ); HeapFree( GetProcessHeap(), 0, ht );
if(loaded) if(loaded)
HeapFree( SystemHeap, 0, mh ); HeapFree( GetProcessHeap(), 0, mh );
return TRUE; return TRUE;
} }
@ -631,7 +631,7 @@ BOOL16 WINAPI EnumMetaFile16( HDC16 hdc, HMETAFILE16 hmf,
/* free handle table */ /* free handle table */
GlobalFree16(hHT); GlobalFree16(hHT);
if(loaded) if(loaded)
HeapFree( SystemHeap, 0, mh ); HeapFree( GetProcessHeap(), 0, mh );
MF_ReleaseMetaHeader16(hmf); MF_ReleaseMetaHeader16(hmf);
return result; return result;
} }
@ -679,7 +679,7 @@ BOOL WINAPI EnumMetaFile(
hBrush = GetCurrentObject(hdc, OBJ_BRUSH); hBrush = GetCurrentObject(hdc, OBJ_BRUSH);
hFont = GetCurrentObject(hdc, OBJ_FONT); hFont = GetCurrentObject(hdc, OBJ_FONT);
ht = HeapAlloc( SystemHeap, HEAP_ZERO_MEMORY, ht = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(HANDLETABLE) * mh->mtNoObjects); sizeof(HANDLETABLE) * mh->mtNoObjects);
/* loop through metafile records */ /* loop through metafile records */
@ -710,9 +710,9 @@ BOOL WINAPI EnumMetaFile(
DeleteObject(*(ht->objectHandle + i)); DeleteObject(*(ht->objectHandle + i));
/* free handle table */ /* free handle table */
HeapFree( SystemHeap, 0, ht); HeapFree( GetProcessHeap(), 0, ht);
if(loaded) if(loaded)
HeapFree( SystemHeap, 0, mh ); HeapFree( GetProcessHeap(), 0, mh );
MF_ReleaseMetaHeader(hmf); MF_ReleaseMetaHeader(hmf);
return result; return result;
} }
@ -1269,7 +1269,7 @@ HMETAFILE WINAPI SetMetaFileBitsEx(
const BYTE *lpData /* pointer to metafile data */ const BYTE *lpData /* pointer to metafile data */
) )
{ {
METAHEADER *mh = HeapAlloc( SystemHeap, 0, size ); METAHEADER *mh = HeapAlloc( GetProcessHeap(), 0, size );
if (!mh) return 0; if (!mh) return 0;
memcpy(mh, lpData, size); memcpy(mh, lpData, size);
return MF_Create_HMETAFILE(mh); return MF_Create_HMETAFILE(mh);

View File

@ -93,6 +93,309 @@ SOFTWARE.
DEFAULT_DEBUG_CHANNEL(region); DEFAULT_DEBUG_CHANNEL(region);
/* 1 if two RECTs overlap.
* 0 if two RECTs do not overlap.
*/
#define EXTENTCHECK(r1, r2) \
((r1)->right > (r2)->left && \
(r1)->left < (r2)->right && \
(r1)->bottom > (r2)->top && \
(r1)->top < (r2)->bottom)
/*
* Check to see if there is enough memory in the present region.
*/
#define MEMCHECK(reg, rect, firstrect){\
if ((reg)->numRects >= ((reg)->size - 1)){\
(firstrect) = HeapReAlloc( GetProcessHeap(), 0, \
(firstrect), (2 * (sizeof(RECT)) * ((reg)->size)));\
if ((firstrect) == 0)\
return;\
(reg)->size *= 2;\
(rect) = &(firstrect)[(reg)->numRects];\
}\
}
#define EMPTY_REGION(pReg) { \
(pReg)->numRects = 0; \
(pReg)->extents.left = (pReg)->extents.top = 0; \
(pReg)->extents.right = (pReg)->extents.bottom = 0; \
(pReg)->type = NULLREGION; \
}
#define REGION_NOT_EMPTY(pReg) pReg->numRects
#define INRECT(r, x, y) \
( ( ((r).right > x)) && \
( ((r).left <= x)) && \
( ((r).bottom > y)) && \
( ((r).top <= y)) )
/*
* number of points to buffer before sending them off
* to scanlines() : Must be an even number
*/
#define NUMPTSTOBUFFER 200
/*
* used to allocate buffers for points and link
* the buffers together
*/
typedef struct _POINTBLOCK {
POINT pts[NUMPTSTOBUFFER];
struct _POINTBLOCK *next;
} POINTBLOCK;
/*
* This file contains a few macros to help track
* the edge of a filled object. The object is assumed
* to be filled in scanline order, and thus the
* algorithm used is an extension of Bresenham's line
* drawing algorithm which assumes that y is always the
* major axis.
* Since these pieces of code are the same for any filled shape,
* it is more convenient to gather the library in one
* place, but since these pieces of code are also in
* the inner loops of output primitives, procedure call
* overhead is out of the question.
* See the author for a derivation if needed.
*/
/*
* In scan converting polygons, we want to choose those pixels
* which are inside the polygon. Thus, we add .5 to the starting
* x coordinate for both left and right edges. Now we choose the
* first pixel which is inside the pgon for the left edge and the
* first pixel which is outside the pgon for the right edge.
* Draw the left pixel, but not the right.
*
* How to add .5 to the starting x coordinate:
* If the edge is moving to the right, then subtract dy from the
* error term from the general form of the algorithm.
* If the edge is moving to the left, then add dy to the error term.
*
* The reason for the difference between edges moving to the left
* and edges moving to the right is simple: If an edge is moving
* to the right, then we want the algorithm to flip immediately.
* If it is moving to the left, then we don't want it to flip until
* we traverse an entire pixel.
*/
#define BRESINITPGON(dy, x1, x2, xStart, d, m, m1, incr1, incr2) { \
int dx; /* local storage */ \
\
/* \
* if the edge is horizontal, then it is ignored \
* and assumed not to be processed. Otherwise, do this stuff. \
*/ \
if ((dy) != 0) { \
xStart = (x1); \
dx = (x2) - xStart; \
if (dx < 0) { \
m = dx / (dy); \
m1 = m - 1; \
incr1 = -2 * dx + 2 * (dy) * m1; \
incr2 = -2 * dx + 2 * (dy) * m; \
d = 2 * m * (dy) - 2 * dx - 2 * (dy); \
} else { \
m = dx / (dy); \
m1 = m + 1; \
incr1 = 2 * dx - 2 * (dy) * m1; \
incr2 = 2 * dx - 2 * (dy) * m; \
d = -2 * m * (dy) + 2 * dx; \
} \
} \
}
#define BRESINCRPGON(d, minval, m, m1, incr1, incr2) { \
if (m1 > 0) { \
if (d > 0) { \
minval += m1; \
d += incr1; \
} \
else { \
minval += m; \
d += incr2; \
} \
} else {\
if (d >= 0) { \
minval += m1; \
d += incr1; \
} \
else { \
minval += m; \
d += incr2; \
} \
} \
}
/*
* This structure contains all of the information needed
* to run the bresenham algorithm.
* The variables may be hardcoded into the declarations
* instead of using this structure to make use of
* register declarations.
*/
typedef struct {
INT minor_axis; /* minor axis */
INT d; /* decision variable */
INT m, m1; /* slope and slope+1 */
INT incr1, incr2; /* error increments */
} BRESINFO;
#define BRESINITPGONSTRUCT(dmaj, min1, min2, bres) \
BRESINITPGON(dmaj, min1, min2, bres.minor_axis, bres.d, \
bres.m, bres.m1, bres.incr1, bres.incr2)
#define BRESINCRPGONSTRUCT(bres) \
BRESINCRPGON(bres.d, bres.minor_axis, bres.m, bres.m1, bres.incr1, bres.incr2)
/*
* These are the data structures needed to scan
* convert regions. Two different scan conversion
* methods are available -- the even-odd method, and
* the winding number method.
* The even-odd rule states that a point is inside
* the polygon if a ray drawn from that point in any
* direction will pass through an odd number of
* path segments.
* By the winding number rule, a point is decided
* to be inside the polygon if a ray drawn from that
* point in any direction passes through a different
* number of clockwise and counter-clockwise path
* segments.
*
* These data structures are adapted somewhat from
* the algorithm in (Foley/Van Dam) for scan converting
* polygons.
* The basic algorithm is to start at the top (smallest y)
* of the polygon, stepping down to the bottom of
* the polygon by incrementing the y coordinate. We
* keep a list of edges which the current scanline crosses,
* sorted by x. This list is called the Active Edge Table (AET)
* As we change the y-coordinate, we update each entry in
* in the active edge table to reflect the edges new xcoord.
* This list must be sorted at each scanline in case
* two edges intersect.
* We also keep a data structure known as the Edge Table (ET),
* which keeps track of all the edges which the current
* scanline has not yet reached. The ET is basically a
* list of ScanLineList structures containing a list of
* edges which are entered at a given scanline. There is one
* ScanLineList per scanline at which an edge is entered.
* When we enter a new edge, we move it from the ET to the AET.
*
* From the AET, we can implement the even-odd rule as in
* (Foley/Van Dam).
* The winding number rule is a little trickier. We also
* keep the EdgeTableEntries in the AET linked by the
* nextWETE (winding EdgeTableEntry) link. This allows
* the edges to be linked just as before for updating
* purposes, but only uses the edges linked by the nextWETE
* link as edges representing spans of the polygon to
* drawn (as with the even-odd rule).
*/
/*
* for the winding number rule
*/
#define CLOCKWISE 1
#define COUNTERCLOCKWISE -1
typedef struct _EdgeTableEntry {
INT ymax; /* ycoord at which we exit this edge. */
BRESINFO bres; /* Bresenham info to run the edge */
struct _EdgeTableEntry *next; /* next in the list */
struct _EdgeTableEntry *back; /* for insertion sort */
struct _EdgeTableEntry *nextWETE; /* for winding num rule */
int ClockWise; /* flag for winding number rule */
} EdgeTableEntry;
typedef struct _ScanLineList{
INT scanline; /* the scanline represented */
EdgeTableEntry *edgelist; /* header node */
struct _ScanLineList *next; /* next in the list */
} ScanLineList;
typedef struct {
INT ymax; /* ymax for the polygon */
INT ymin; /* ymin for the polygon */
ScanLineList scanlines; /* header node */
} EdgeTable;
/*
* Here is a struct to help with storage allocation
* so we can allocate a big chunk at a time, and then take
* pieces from this heap when we need to.
*/
#define SLLSPERBLOCK 25
typedef struct _ScanLineListBlock {
ScanLineList SLLs[SLLSPERBLOCK];
struct _ScanLineListBlock *next;
} ScanLineListBlock;
/*
*
* a few macros for the inner loops of the fill code where
* performance considerations don't allow a procedure call.
*
* Evaluate the given edge at the given scanline.
* If the edge has expired, then we leave it and fix up
* the active edge table; otherwise, we increment the
* x value to be ready for the next scanline.
* The winding number rule is in effect, so we must notify
* the caller when the edge has been removed so he
* can reorder the Winding Active Edge Table.
*/
#define EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET) { \
if (pAET->ymax == y) { /* leaving this edge */ \
pPrevAET->next = pAET->next; \
pAET = pPrevAET->next; \
fixWAET = 1; \
if (pAET) \
pAET->back = pPrevAET; \
} \
else { \
BRESINCRPGONSTRUCT(pAET->bres); \
pPrevAET = pAET; \
pAET = pAET->next; \
} \
}
/*
* Evaluate the given edge at the given scanline.
* If the edge has expired, then we leave it and fix up
* the active edge table; otherwise, we increment the
* x value to be ready for the next scanline.
* The even-odd rule is in effect.
*/
#define EVALUATEEDGEEVENODD(pAET, pPrevAET, y) { \
if (pAET->ymax == y) { /* leaving this edge */ \
pPrevAET->next = pAET->next; \
pAET = pPrevAET->next; \
if (pAET) \
pAET->back = pPrevAET; \
} \
else { \
BRESINCRPGONSTRUCT(pAET->bres); \
pPrevAET = pAET; \
pAET = pAET->next; \
} \
}
typedef void (*voidProcp)(); typedef void (*voidProcp)();
/* Note the parameter order is different from the X11 equivalents */ /* Note the parameter order is different from the X11 equivalents */
@ -132,15 +435,15 @@ static WINEREGION *REGION_AllocWineRegion( INT n )
{ {
WINEREGION *pReg; WINEREGION *pReg;
if ((pReg = HeapAlloc(SystemHeap, 0, sizeof( WINEREGION )))) if ((pReg = HeapAlloc(GetProcessHeap(), 0, sizeof( WINEREGION ))))
{ {
if ((pReg->rects = HeapAlloc(SystemHeap, 0, n * sizeof( RECT )))) if ((pReg->rects = HeapAlloc(GetProcessHeap(), 0, n * sizeof( RECT ))))
{ {
pReg->size = n; pReg->size = n;
EMPTY_REGION(pReg); EMPTY_REGION(pReg);
return pReg; return pReg;
} }
HeapFree(SystemHeap, 0, pReg); HeapFree(GetProcessHeap(), 0, pReg);
} }
return NULL; return NULL;
} }
@ -172,8 +475,8 @@ static HRGN REGION_CreateRegion( INT n )
*/ */
static void REGION_DestroyWineRegion( WINEREGION* pReg ) static void REGION_DestroyWineRegion( WINEREGION* pReg )
{ {
HeapFree( SystemHeap, 0, pReg->rects ); HeapFree( GetProcessHeap(), 0, pReg->rects );
HeapFree( SystemHeap, 0, pReg ); HeapFree( GetProcessHeap(), 0, pReg );
return; return;
} }
@ -998,7 +1301,7 @@ static void REGION_CopyRegion(WINEREGION *dst, WINEREGION *src)
{ {
if (dst->size < src->numRects) if (dst->size < src->numRects)
{ {
if (! (dst->rects = HeapReAlloc( SystemHeap, 0, dst->rects, if (! (dst->rects = HeapReAlloc( GetProcessHeap(), 0, dst->rects,
src->numRects * sizeof(RECT) ))) src->numRects * sizeof(RECT) )))
return; return;
dst->size = src->numRects; dst->size = src->numRects;
@ -1233,7 +1536,7 @@ static void REGION_RegionOp(
*/ */
newReg->size = MAX(reg1->numRects,reg2->numRects) * 2; newReg->size = MAX(reg1->numRects,reg2->numRects) * 2;
if (! (newReg->rects = HeapAlloc( SystemHeap, 0, if (! (newReg->rects = HeapAlloc( GetProcessHeap(), 0,
sizeof(RECT) * newReg->size ))) sizeof(RECT) * newReg->size )))
{ {
newReg->size = 0; newReg->size = 0;
@ -1426,7 +1729,7 @@ static void REGION_RegionOp(
{ {
RECT *prev_rects = newReg->rects; RECT *prev_rects = newReg->rects;
newReg->size = newReg->numRects; newReg->size = newReg->numRects;
newReg->rects = HeapReAlloc( SystemHeap, 0, newReg->rects, newReg->rects = HeapReAlloc( GetProcessHeap(), 0, newReg->rects,
sizeof(RECT) * newReg->size ); sizeof(RECT) * newReg->size );
if (! newReg->rects) if (! newReg->rects)
newReg->rects = prev_rects; newReg->rects = prev_rects;
@ -1438,11 +1741,11 @@ static void REGION_RegionOp(
* the region is empty * the region is empty
*/ */
newReg->size = 1; newReg->size = 1;
HeapFree( SystemHeap, 0, newReg->rects ); HeapFree( GetProcessHeap(), 0, newReg->rects );
newReg->rects = HeapAlloc( SystemHeap, 0, sizeof(RECT) ); newReg->rects = HeapAlloc( GetProcessHeap(), 0, sizeof(RECT) );
} }
} }
HeapFree( SystemHeap, 0, oldRects ); HeapFree( GetProcessHeap(), 0, oldRects );
return; return;
} }
@ -1989,7 +2292,7 @@ static void REGION_InsertEdgeInET(EdgeTable *ET, EdgeTableEntry *ETE,
{ {
if (*iSLLBlock > SLLSPERBLOCK-1) if (*iSLLBlock > SLLSPERBLOCK-1)
{ {
tmpSLLBlock = HeapAlloc( SystemHeap, 0, sizeof(ScanLineListBlock)); tmpSLLBlock = HeapAlloc( GetProcessHeap(), 0, sizeof(ScanLineListBlock));
if(!tmpSLLBlock) if(!tmpSLLBlock)
{ {
WARN("Can't alloc SLLB\n"); WARN("Can't alloc SLLB\n");
@ -2273,7 +2576,7 @@ static void REGION_FreeStorage(ScanLineListBlock *pSLLBlock)
while (pSLLBlock) while (pSLLBlock)
{ {
tmpSLLBlock = pSLLBlock->next; tmpSLLBlock = pSLLBlock->next;
HeapFree( SystemHeap, 0, pSLLBlock ); HeapFree( GetProcessHeap(), 0, pSLLBlock );
pSLLBlock = tmpSLLBlock; pSLLBlock = tmpSLLBlock;
} }
} }
@ -2298,7 +2601,7 @@ static int REGION_PtsToRegion(int numFullPtBlocks, int iCurPtBlock,
numRects = ((numFullPtBlocks * NUMPTSTOBUFFER) + iCurPtBlock) >> 1; numRects = ((numFullPtBlocks * NUMPTSTOBUFFER) + iCurPtBlock) >> 1;
if (!(reg->rects = HeapReAlloc( SystemHeap, 0, reg->rects, if (!(reg->rects = HeapReAlloc( GetProcessHeap(), 0, reg->rects,
sizeof(RECT) * numRects ))) sizeof(RECT) * numRects )))
return(0); return(0);
@ -2401,7 +2704,7 @@ HRGN WINAPI CreatePolyPolygonRgn(const POINT *Pts, const INT *Count,
for(poly = total = 0; poly < nbpolygons; poly++) for(poly = total = 0; poly < nbpolygons; poly++)
total += Count[poly]; total += Count[poly];
if (! (pETEs = HeapAlloc( SystemHeap, 0, sizeof(EdgeTableEntry) * total ))) if (! (pETEs = HeapAlloc( GetProcessHeap(), 0, sizeof(EdgeTableEntry) * total )))
{ {
REGION_DeleteObject( hrgn, obj ); REGION_DeleteObject( hrgn, obj );
return 0; return 0;
@ -2438,7 +2741,7 @@ HRGN WINAPI CreatePolyPolygonRgn(const POINT *Pts, const INT *Count,
* send out the buffer * send out the buffer
*/ */
if (iPts == NUMPTSTOBUFFER) { if (iPts == NUMPTSTOBUFFER) {
tmpPtBlock = HeapAlloc( SystemHeap, 0, sizeof(POINTBLOCK)); tmpPtBlock = HeapAlloc( GetProcessHeap(), 0, sizeof(POINTBLOCK));
if(!tmpPtBlock) { if(!tmpPtBlock) {
WARN("Can't alloc tPB\n"); WARN("Can't alloc tPB\n");
return 0; return 0;
@ -2488,7 +2791,7 @@ HRGN WINAPI CreatePolyPolygonRgn(const POINT *Pts, const INT *Count,
* send out the buffer * send out the buffer
*/ */
if (iPts == NUMPTSTOBUFFER) { if (iPts == NUMPTSTOBUFFER) {
tmpPtBlock = HeapAlloc( SystemHeap, 0, tmpPtBlock = HeapAlloc( GetProcessHeap(), 0,
sizeof(POINTBLOCK) ); sizeof(POINTBLOCK) );
if(!tmpPtBlock) { if(!tmpPtBlock) {
WARN("Can't alloc tPB\n"); WARN("Can't alloc tPB\n");
@ -2518,10 +2821,10 @@ HRGN WINAPI CreatePolyPolygonRgn(const POINT *Pts, const INT *Count,
REGION_PtsToRegion(numFullPtBlocks, iPts, &FirstPtBlock, region); REGION_PtsToRegion(numFullPtBlocks, iPts, &FirstPtBlock, region);
for (curPtBlock = FirstPtBlock.next; --numFullPtBlocks >= 0;) { for (curPtBlock = FirstPtBlock.next; --numFullPtBlocks >= 0;) {
tmpPtBlock = curPtBlock->next; tmpPtBlock = curPtBlock->next;
HeapFree( SystemHeap, 0, curPtBlock ); HeapFree( GetProcessHeap(), 0, curPtBlock );
curPtBlock = tmpPtBlock; curPtBlock = tmpPtBlock;
} }
HeapFree( SystemHeap, 0, pETEs ); HeapFree( GetProcessHeap(), 0, pETEs );
GDI_HEAP_UNLOCK( hrgn ); GDI_HEAP_UNLOCK( hrgn );
return hrgn; return hrgn;
} }
@ -2549,16 +2852,16 @@ HRGN16 WINAPI CreatePolyPolygonRgn16( const POINT16 *points,
for (i = 0; i < nbpolygons; i++) for (i = 0; i < nbpolygons; i++)
npts += count[i]; npts += count[i];
points32 = HeapAlloc( SystemHeap, 0, npts * sizeof(POINT) ); points32 = HeapAlloc( GetProcessHeap(), 0, npts * sizeof(POINT) );
for (i = 0; i < npts; i++) for (i = 0; i < npts; i++)
CONV_POINT16TO32( &(points[i]), &(points32[i]) ); CONV_POINT16TO32( &(points[i]), &(points32[i]) );
count32 = HeapAlloc( SystemHeap, 0, nbpolygons * sizeof(INT) ); count32 = HeapAlloc( GetProcessHeap(), 0, nbpolygons * sizeof(INT) );
for (i = 0; i < nbpolygons; i++) for (i = 0; i < nbpolygons; i++)
count32[i] = count[i]; count32[i] = count[i];
hrgn = CreatePolyPolygonRgn( points32, count32, nbpolygons, mode ); hrgn = CreatePolyPolygonRgn( points32, count32, nbpolygons, mode );
HeapFree( SystemHeap, 0, count32 ); HeapFree( GetProcessHeap(), 0, count32 );
HeapFree( SystemHeap, 0, points32 ); HeapFree( GetProcessHeap(), 0, points32 );
return hrgn; return hrgn;
} }
@ -2633,7 +2936,7 @@ static BOOL REGION_CropAndOffsetRegion(const POINT* off, const RECT *rect, WINER
return TRUE; return TRUE;
} }
else else
xrect = HeapReAlloc( SystemHeap, 0, rgnDst->rects, xrect = HeapReAlloc( GetProcessHeap(), 0, rgnDst->rects,
rgnSrc->size * sizeof( RECT )); rgnSrc->size * sizeof( RECT ));
if( xrect ) if( xrect )
{ {
@ -2664,7 +2967,7 @@ static BOOL REGION_CropAndOffsetRegion(const POINT* off, const RECT *rect, WINER
empty: empty:
if( !rgnDst->rects ) if( !rgnDst->rects )
{ {
rgnDst->rects = HeapAlloc(SystemHeap, 0, RGN_DEFAULT_RECTS * sizeof( RECT )); rgnDst->rects = HeapAlloc(GetProcessHeap(), 0, RGN_DEFAULT_RECTS * sizeof( RECT ));
if( rgnDst->rects ) if( rgnDst->rects )
rgnDst->size = RGN_DEFAULT_RECTS; rgnDst->size = RGN_DEFAULT_RECTS;
else else
@ -2694,7 +2997,7 @@ empty:
if((rgnDst != rgnSrc) && (rgnDst->size < (i = (clipb - clipa)))) if((rgnDst != rgnSrc) && (rgnDst->size < (i = (clipb - clipa))))
{ {
rgnDst->rects = HeapReAlloc( SystemHeap, 0, rgnDst->rects = HeapReAlloc( GetProcessHeap(), 0,
rgnDst->rects, i * sizeof(RECT)); rgnDst->rects, i * sizeof(RECT));
if( !rgnDst->rects ) return FALSE; if( !rgnDst->rects ) return FALSE;
rgnDst->size = i; rgnDst->size = i;
@ -2816,7 +3119,7 @@ HRGN REGION_CropRgn( HRGN hDst, HRGN hSrc, const RECT *lpRect, const POINT *lpPt
} }
else else
{ {
if ((rgnDst = HeapAlloc(SystemHeap, 0, sizeof( WINEREGION )))) if ((rgnDst = HeapAlloc(GetProcessHeap(), 0, sizeof( WINEREGION ))))
{ {
rgnDst->size = rgnDst->numRects = 0; rgnDst->size = rgnDst->numRects = 0;
rgnDst->rects = NULL; /* back end will allocate exact number */ rgnDst->rects = NULL; /* back end will allocate exact number */
@ -2851,8 +3154,8 @@ HRGN REGION_CropRgn( HRGN hDst, HRGN hSrc, const RECT *lpRect, const POINT *lpPt
{ {
fail: fail:
if( rgnDst->rects ) if( rgnDst->rects )
HeapFree( SystemHeap, 0, rgnDst->rects ); HeapFree( GetProcessHeap(), 0, rgnDst->rects );
HeapFree( SystemHeap, 0, rgnDst ); HeapFree( GetProcessHeap(), 0, rgnDst );
goto done; goto done;
} }

View File

@ -131,17 +131,17 @@ SNOOP_RegisterDLL(HMODULE hmod,LPCSTR name,DWORD nrofordinals) {
return; /* already registered */ return; /* already registered */
dll = &((*dll)->next); dll = &((*dll)->next);
} }
*dll = (SNOOP_DLL*)HeapAlloc(SystemHeap,HEAP_ZERO_MEMORY,sizeof(SNOOP_DLL)); *dll = (SNOOP_DLL*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SNOOP_DLL));
(*dll)->next = NULL; (*dll)->next = NULL;
(*dll)->hmod = hmod; (*dll)->hmod = hmod;
(*dll)->nrofordinals = nrofordinals; (*dll)->nrofordinals = nrofordinals;
(*dll)->name = HEAP_strdupA(SystemHeap,0,name); (*dll)->name = HEAP_strdupA(GetProcessHeap(),0,name);
if ((s=strrchr((*dll)->name,'.'))) if ((s=strrchr((*dll)->name,'.')))
*s='\0'; *s='\0';
(*dll)->funs = VirtualAlloc(NULL,nrofordinals*sizeof(SNOOP_FUN),MEM_COMMIT|MEM_RESERVE,PAGE_EXECUTE_READWRITE); (*dll)->funs = VirtualAlloc(NULL,nrofordinals*sizeof(SNOOP_FUN),MEM_COMMIT|MEM_RESERVE,PAGE_EXECUTE_READWRITE);
memset((*dll)->funs,0,nrofordinals*sizeof(SNOOP_FUN)); memset((*dll)->funs,0,nrofordinals*sizeof(SNOOP_FUN));
if (!(*dll)->funs) { if (!(*dll)->funs) {
HeapFree(SystemHeap,0,*dll); HeapFree(GetProcessHeap(),0,*dll);
FIXME("out of memory\n"); FIXME("out of memory\n");
return; return;
} }
@ -187,7 +187,7 @@ SNOOP_GetProcAddress(HMODULE hmod,LPCSTR name,DWORD ordinal,FARPROC origfun) {
return origfun; return origfun;
assert(ordinal<dll->nrofordinals); assert(ordinal<dll->nrofordinals);
fun = dll->funs+ordinal; fun = dll->funs+ordinal;
if (!fun->name) fun->name = HEAP_strdupA(SystemHeap,0,name); if (!fun->name) fun->name = HEAP_strdupA(GetProcessHeap(),0,name);
fun->lcall = 0xe8; fun->lcall = 0xe8;
/* NOTE: origreturn struct member MUST come directly after snoopentry */ /* NOTE: origreturn struct member MUST come directly after snoopentry */
fun->snoopentry = (char*)SNOOP_Entry-((char*)(&fun->nrofargs)); fun->snoopentry = (char*)SNOOP_Entry-((char*)(&fun->nrofargs));
@ -323,7 +323,7 @@ void WINAPI SNOOP_DoEntry( CONTEXT86 *context )
DPRINTF(" ..."); DPRINTF(" ...");
} else if (fun->nrofargs<0) { } else if (fun->nrofargs<0) {
DPRINTF("<unknown, check return>"); DPRINTF("<unknown, check return>");
ret->args = HeapAlloc(SystemHeap,0,16*sizeof(DWORD)); ret->args = HeapAlloc(GetProcessHeap(),0,16*sizeof(DWORD));
memcpy(ret->args,(LPBYTE)(ESP_reg(context)+4),sizeof(DWORD)*16); memcpy(ret->args,(LPBYTE)(ESP_reg(context)+4),sizeof(DWORD)*16);
} }
DPRINTF(") ret=%08lx fs=%04lx\n",(DWORD)ret->origreturn,FS_reg(context)); DPRINTF(") ret=%08lx fs=%04lx\n",(DWORD)ret->origreturn,FS_reg(context));
@ -355,7 +355,7 @@ void WINAPI SNOOP_DoReturn( CONTEXT86 *context )
DPRINTF(") retval = %08lx ret=%08lx fs=%04lx\n", DPRINTF(") retval = %08lx ret=%08lx fs=%04lx\n",
EAX_reg(context),(DWORD)ret->origreturn,FS_reg(context) EAX_reg(context),(DWORD)ret->origreturn,FS_reg(context)
); );
HeapFree(SystemHeap,0,ret->args); HeapFree(GetProcessHeap(),0,ret->args);
ret->args = NULL; ret->args = NULL;
} else } else
DPRINTF("Ret %s.%ld: %s() retval = %08lx ret=%08lx fs=%04lx\n", DPRINTF("Ret %s.%ld: %s() retval = %08lx ret=%08lx fs=%04lx\n",

View File

@ -180,7 +180,7 @@ static int DRIVER_MapMsg16To32(WORD wMsg, DWORD* lParam1, DWORD* lParam2)
*lParam1 = (DWORD)PTR_SEG_TO_LIN(*lParam1); *lParam1 = (DWORD)PTR_SEG_TO_LIN(*lParam1);
if (*lParam2 && wMsg == DRV_OPEN) { if (*lParam2 && wMsg == DRV_OPEN) {
LPMCI_OPEN_DRIVER_PARMS16 modp16 = PTR_SEG_TO_LIN(*lParam2); LPMCI_OPEN_DRIVER_PARMS16 modp16 = PTR_SEG_TO_LIN(*lParam2);
char* ptr = HeapAlloc(SystemHeap, 0, sizeof(LPMCI_OPEN_DRIVER_PARMS16) + sizeof(MCI_OPEN_DRIVER_PARMSA)); char* ptr = HeapAlloc(GetProcessHeap(), 0, sizeof(LPMCI_OPEN_DRIVER_PARMS16) + sizeof(MCI_OPEN_DRIVER_PARMSA));
LPMCI_OPEN_DRIVER_PARMSA modp32; LPMCI_OPEN_DRIVER_PARMSA modp32;
if (ptr) { if (ptr) {
@ -200,13 +200,13 @@ static int DRIVER_MapMsg16To32(WORD wMsg, DWORD* lParam1, DWORD* lParam2)
case DRV_INSTALL: case DRV_INSTALL:
/* lParam1 is a handle to a window (or not used), lParam2 is a pointer to DRVCONFIGINFO */ /* lParam1 is a handle to a window (or not used), lParam2 is a pointer to DRVCONFIGINFO */
if (*lParam2) { if (*lParam2) {
LPDRVCONFIGINFO dci32 = HeapAlloc(SystemHeap, 0, sizeof(DRVCONFIGINFO)); LPDRVCONFIGINFO dci32 = HeapAlloc(GetProcessHeap(), 0, sizeof(DRVCONFIGINFO));
LPDRVCONFIGINFO16 dci16 = PTR_SEG_TO_LIN(*lParam2); LPDRVCONFIGINFO16 dci16 = PTR_SEG_TO_LIN(*lParam2);
if (dci32) { if (dci32) {
dci32->dwDCISize = sizeof(DRVCONFIGINFO); dci32->dwDCISize = sizeof(DRVCONFIGINFO);
dci32->lpszDCISectionName = HEAP_strdupAtoW(SystemHeap, 0, PTR_SEG_TO_LIN(dci16->lpszDCISectionName)); dci32->lpszDCISectionName = HEAP_strdupAtoW(GetProcessHeap(), 0, PTR_SEG_TO_LIN(dci16->lpszDCISectionName));
dci32->lpszDCIAliasName = HEAP_strdupAtoW(SystemHeap, 0, PTR_SEG_TO_LIN(dci16->lpszDCIAliasName)); dci32->lpszDCIAliasName = HEAP_strdupAtoW(GetProcessHeap(), 0, PTR_SEG_TO_LIN(dci16->lpszDCIAliasName));
if (dci32->lpszDCISectionName == NULL || dci32->lpszDCIAliasName == NULL) if (dci32->lpszDCISectionName == NULL || dci32->lpszDCIAliasName == NULL)
return -2; return -2;
} else { } else {
@ -265,7 +265,7 @@ static int DRIVER_UnMapMsg16To32(WORD wMsg, DWORD lParam1, DWORD lParam2)
modp16->wCustomCommandTable = modp32->wCustomCommandTable; modp16->wCustomCommandTable = modp32->wCustomCommandTable;
modp16->wType = modp32->wType; modp16->wType = modp32->wType;
if (!HeapFree(SystemHeap, 0, modp32)) if (!HeapFree(GetProcessHeap(), 0, modp32))
FIXME("bad free line=%d\n", __LINE__); FIXME("bad free line=%d\n", __LINE__);
} }
ret = 0; ret = 0;
@ -275,11 +275,11 @@ static int DRIVER_UnMapMsg16To32(WORD wMsg, DWORD lParam1, DWORD lParam2)
/* lParam1 is a handle to a window (or not used), lParam2 is a pointer to DRVCONFIGINFO, lParam2 */ /* lParam1 is a handle to a window (or not used), lParam2 is a pointer to DRVCONFIGINFO, lParam2 */
if (lParam2) { if (lParam2) {
LPDRVCONFIGINFO dci32 = (LPDRVCONFIGINFO)lParam2; LPDRVCONFIGINFO dci32 = (LPDRVCONFIGINFO)lParam2;
if (!HeapFree(SystemHeap, 0, (LPVOID)dci32->lpszDCISectionName)) if (!HeapFree(GetProcessHeap(), 0, (LPVOID)dci32->lpszDCISectionName))
FIXME("bad free line=%d\n", __LINE__); FIXME("bad free line=%d\n", __LINE__);
if (!HeapFree(SystemHeap, 0, (LPVOID)dci32->lpszDCIAliasName)) if (!HeapFree(GetProcessHeap(), 0, (LPVOID)dci32->lpszDCIAliasName))
FIXME("bad free line=%d\n", __LINE__); FIXME("bad free line=%d\n", __LINE__);
if (!HeapFree(SystemHeap, 0, dci32)) if (!HeapFree(GetProcessHeap(), 0, dci32))
FIXME("bad free line=%d\n", __LINE__); FIXME("bad free line=%d\n", __LINE__);
} }
ret = 0; ret = 0;
@ -369,18 +369,18 @@ static int DRIVER_MapMsg32To16(WORD wMsg, DWORD* lParam1, DWORD* lParam2)
dci16->dwDCISize = sizeof(DRVCONFIGINFO16); dci16->dwDCISize = sizeof(DRVCONFIGINFO16);
if ((str1 = HEAP_strdupWtoA(SystemHeap, 0, dci32->lpszDCISectionName)) != NULL && if ((str1 = HEAP_strdupWtoA(GetProcessHeap(), 0, dci32->lpszDCISectionName)) != NULL &&
(str2 = SEGPTR_STRDUP(str1)) != NULL) { (str2 = SEGPTR_STRDUP(str1)) != NULL) {
dci16->lpszDCISectionName = (LPSTR)SEGPTR_GET(str2); dci16->lpszDCISectionName = (LPSTR)SEGPTR_GET(str2);
if (!HeapFree(SystemHeap, 0, str1)) if (!HeapFree(GetProcessHeap(), 0, str1))
FIXME("bad free line=%d\n", __LINE__); FIXME("bad free line=%d\n", __LINE__);
} else { } else {
return -2; return -2;
} }
if ((str1 = HEAP_strdupWtoA(SystemHeap, 0, dci32->lpszDCIAliasName)) != NULL && if ((str1 = HEAP_strdupWtoA(GetProcessHeap(), 0, dci32->lpszDCIAliasName)) != NULL &&
(str2 = SEGPTR_STRDUP(str1)) != NULL) { (str2 = SEGPTR_STRDUP(str1)) != NULL) {
dci16->lpszDCIAliasName = (LPSTR)SEGPTR_GET(str2); dci16->lpszDCIAliasName = (LPSTR)SEGPTR_GET(str2);
if (!HeapFree(SystemHeap, 0, str1)) if (!HeapFree(GetProcessHeap(), 0, str1))
FIXME("bad free line=%d\n", __LINE__); FIXME("bad free line=%d\n", __LINE__);
} else { } else {
return -2; return -2;
@ -655,7 +655,7 @@ BOOL DRIVER_CloseDriver(LPWINE_DRIVER lpDrv, DWORD lParam1, DWORD lParam2)
SendDriverMessage((HDRVR)lpDrv, DRV_CLOSE, lParam1, lParam2); SendDriverMessage((HDRVR)lpDrv, DRV_CLOSE, lParam1, lParam2);
if (DRIVER_RemoveFromList(lpDrv)) { if (DRIVER_RemoveFromList(lpDrv)) {
HeapFree(SystemHeap, 0, lpDrv); HeapFree(GetProcessHeap(), 0, lpDrv);
return TRUE; return TRUE;
} }
} }
@ -674,7 +674,7 @@ LPWINE_DRIVER DRIVER_RegisterDriver16(LPCSTR lpName, HMODULE16 hModule, DRIVERPR
{ {
LPWINE_DRIVER lpDrv; LPWINE_DRIVER lpDrv;
lpDrv = HeapAlloc(SystemHeap, 0, sizeof(WINE_DRIVER)); lpDrv = HeapAlloc(GetProcessHeap(), 0, sizeof(WINE_DRIVER));
if (lpDrv != NULL) { if (lpDrv != NULL) {
lpDrv->dwFlags = WINE_GDF_EXIST|WINE_GDF_16BIT; lpDrv->dwFlags = WINE_GDF_EXIST|WINE_GDF_16BIT;
lpDrv->dwDriverID = 0; lpDrv->dwDriverID = 0;
@ -684,7 +684,7 @@ LPWINE_DRIVER DRIVER_RegisterDriver16(LPCSTR lpName, HMODULE16 hModule, DRIVERPR
lpDrv->d.d16.lpDrvProc = lpProc; lpDrv->d.d16.lpDrvProc = lpProc;
if (!DRIVER_AddToList(lpDrv, lParam, bCallFrom32)) { if (!DRIVER_AddToList(lpDrv, lParam, bCallFrom32)) {
HeapFree(SystemHeap, 0, lpDrv); HeapFree(GetProcessHeap(), 0, lpDrv);
lpDrv = NULL; lpDrv = NULL;
} }
} }
@ -702,7 +702,7 @@ LPWINE_DRIVER DRIVER_RegisterDriver32(LPCSTR lpName, HMODULE hModule, DRIVERPROC
{ {
LPWINE_DRIVER lpDrv; LPWINE_DRIVER lpDrv;
lpDrv = HeapAlloc(SystemHeap, 0, sizeof(WINE_DRIVER)); lpDrv = HeapAlloc(GetProcessHeap(), 0, sizeof(WINE_DRIVER));
if (lpDrv != NULL) { if (lpDrv != NULL) {
lpDrv->dwFlags = WINE_GDF_EXIST; lpDrv->dwFlags = WINE_GDF_EXIST;
lpDrv->dwDriverID = 0; lpDrv->dwDriverID = 0;
@ -712,7 +712,7 @@ LPWINE_DRIVER DRIVER_RegisterDriver32(LPCSTR lpName, HMODULE hModule, DRIVERPROC
lpDrv->d.d32.lpDrvProc = lpProc; lpDrv->d.d32.lpDrvProc = lpProc;
if (!DRIVER_AddToList(lpDrv, lParam, bCallFrom32)) { if (!DRIVER_AddToList(lpDrv, lParam, bCallFrom32)) {
HeapFree(SystemHeap, 0, lpDrv); HeapFree(GetProcessHeap(), 0, lpDrv);
lpDrv = NULL; lpDrv = NULL;
} }
} }

View File

@ -72,7 +72,7 @@ static void HOOK_Map16To32Common(INT id, INT code, WPARAM *pwParam,
case WH_JOURNALRECORD: case WH_JOURNALRECORD:
{ {
LPMSG16 lpmsg16 = PTR_SEG_TO_LIN(*plParam); LPMSG16 lpmsg16 = PTR_SEG_TO_LIN(*plParam);
LPMSG lpmsg32 = HeapAlloc( SystemHeap, 0, sizeof(*lpmsg32) ); LPMSG lpmsg32 = HeapAlloc( GetProcessHeap(), 0, sizeof(*lpmsg32) );
STRUCT32_MSG16to32( lpmsg16, lpmsg32 ); STRUCT32_MSG16to32( lpmsg16, lpmsg32 );
*plParam = (LPARAM)lpmsg32; *plParam = (LPARAM)lpmsg32;
@ -82,7 +82,7 @@ static void HOOK_Map16To32Common(INT id, INT code, WPARAM *pwParam,
case WH_JOURNALPLAYBACK: case WH_JOURNALPLAYBACK:
{ {
LPEVENTMSG16 lpem16 = PTR_SEG_TO_LIN(*plParam); LPEVENTMSG16 lpem16 = PTR_SEG_TO_LIN(*plParam);
LPEVENTMSG lpem32 = HeapAlloc( SystemHeap, 0, sizeof(*lpem32) ); LPEVENTMSG lpem32 = HeapAlloc( GetProcessHeap(), 0, sizeof(*lpem32) );
lpem32->message = lpem16->message; lpem32->message = lpem16->message;
lpem32->paramL = lpem16->paramL; lpem32->paramL = lpem16->paramL;
@ -97,7 +97,7 @@ static void HOOK_Map16To32Common(INT id, INT code, WPARAM *pwParam,
case WH_CALLWNDPROC: case WH_CALLWNDPROC:
{ {
LPCWPSTRUCT16 lpcwp16 = PTR_SEG_TO_LIN(*plParam); LPCWPSTRUCT16 lpcwp16 = PTR_SEG_TO_LIN(*plParam);
LPCWPSTRUCT lpcwp32 = HeapAlloc( SystemHeap, 0, sizeof(*lpcwp32) ); LPCWPSTRUCT lpcwp32 = HeapAlloc( GetProcessHeap(), 0, sizeof(*lpcwp32) );
lpcwp32->hwnd = lpcwp16->hwnd; lpcwp32->hwnd = lpcwp16->hwnd;
lpcwp32->lParam = lpcwp16->lParam; lpcwp32->lParam = lpcwp16->lParam;
@ -119,9 +119,9 @@ static void HOOK_Map16To32Common(INT id, INT code, WPARAM *pwParam,
{ {
LPCBT_CREATEWND16 lpcbtcw16 = PTR_SEG_TO_LIN(*plParam); LPCBT_CREATEWND16 lpcbtcw16 = PTR_SEG_TO_LIN(*plParam);
LPCREATESTRUCT16 lpcs16 = PTR_SEG_TO_LIN(lpcbtcw16->lpcs); LPCREATESTRUCT16 lpcs16 = PTR_SEG_TO_LIN(lpcbtcw16->lpcs);
LPCBT_CREATEWNDA lpcbtcw32 = HeapAlloc( SystemHeap, 0, LPCBT_CREATEWNDA lpcbtcw32 = HeapAlloc( GetProcessHeap(), 0,
sizeof(*lpcbtcw32) ); sizeof(*lpcbtcw32) );
lpcbtcw32->lpcs = HeapAlloc( SystemHeap, 0, lpcbtcw32->lpcs = HeapAlloc( GetProcessHeap(), 0,
sizeof(*lpcbtcw32->lpcs) ); sizeof(*lpcbtcw32->lpcs) );
STRUCT32_CREATESTRUCT16to32A( lpcs16, STRUCT32_CREATESTRUCT16to32A( lpcs16,
@ -130,7 +130,7 @@ static void HOOK_Map16To32Common(INT id, INT code, WPARAM *pwParam,
if (HIWORD(lpcs16->lpszName)) if (HIWORD(lpcs16->lpszName))
lpcbtcw32->lpcs->lpszName = lpcbtcw32->lpcs->lpszName =
(bA) ? PTR_SEG_TO_LIN(lpcs16->lpszName) (bA) ? PTR_SEG_TO_LIN(lpcs16->lpszName)
: HEAP_strdupAtoW( SystemHeap, 0, : HEAP_strdupAtoW( GetProcessHeap(), 0,
PTR_SEG_TO_LIN(lpcs16->lpszName) ); PTR_SEG_TO_LIN(lpcs16->lpszName) );
else else
lpcbtcw32->lpcs->lpszName = (LPCSTR)lpcs16->lpszName; lpcbtcw32->lpcs->lpszName = (LPCSTR)lpcs16->lpszName;
@ -138,7 +138,7 @@ static void HOOK_Map16To32Common(INT id, INT code, WPARAM *pwParam,
if (HIWORD(lpcs16->lpszClass)) if (HIWORD(lpcs16->lpszClass))
lpcbtcw32->lpcs->lpszClass = lpcbtcw32->lpcs->lpszClass =
(bA) ? PTR_SEG_TO_LIN(lpcs16->lpszClass) (bA) ? PTR_SEG_TO_LIN(lpcs16->lpszClass)
: HEAP_strdupAtoW( SystemHeap, 0, : HEAP_strdupAtoW( GetProcessHeap(), 0,
PTR_SEG_TO_LIN(lpcs16->lpszClass) ); PTR_SEG_TO_LIN(lpcs16->lpszClass) );
else else
lpcbtcw32->lpcs->lpszClass = (LPCSTR)lpcs16->lpszClass; lpcbtcw32->lpcs->lpszClass = (LPCSTR)lpcs16->lpszClass;
@ -151,7 +151,7 @@ static void HOOK_Map16To32Common(INT id, INT code, WPARAM *pwParam,
case HCBT_ACTIVATE: case HCBT_ACTIVATE:
{ {
LPCBTACTIVATESTRUCT16 lpcas16 = PTR_SEG_TO_LIN(*plParam); LPCBTACTIVATESTRUCT16 lpcas16 = PTR_SEG_TO_LIN(*plParam);
LPCBTACTIVATESTRUCT lpcas32 = HeapAlloc( SystemHeap, 0, LPCBTACTIVATESTRUCT lpcas32 = HeapAlloc( GetProcessHeap(), 0,
sizeof(*lpcas32) ); sizeof(*lpcas32) );
lpcas32->fMouse = lpcas16->fMouse; lpcas32->fMouse = lpcas16->fMouse;
lpcas32->hWndActive = lpcas16->hWndActive; lpcas32->hWndActive = lpcas16->hWndActive;
@ -161,7 +161,7 @@ static void HOOK_Map16To32Common(INT id, INT code, WPARAM *pwParam,
case HCBT_CLICKSKIPPED: case HCBT_CLICKSKIPPED:
{ {
LPMOUSEHOOKSTRUCT16 lpms16 = PTR_SEG_TO_LIN(*plParam); LPMOUSEHOOKSTRUCT16 lpms16 = PTR_SEG_TO_LIN(*plParam);
LPMOUSEHOOKSTRUCT lpms32 = HeapAlloc( SystemHeap, 0, LPMOUSEHOOKSTRUCT lpms32 = HeapAlloc( GetProcessHeap(), 0,
sizeof(*lpms32) ); sizeof(*lpms32) );
CONV_POINT16TO32( &lpms16->pt, &lpms32->pt ); CONV_POINT16TO32( &lpms16->pt, &lpms32->pt );
@ -178,7 +178,7 @@ static void HOOK_Map16To32Common(INT id, INT code, WPARAM *pwParam,
case HCBT_MOVESIZE: case HCBT_MOVESIZE:
{ {
LPRECT16 lprect16 = PTR_SEG_TO_LIN(*plParam); LPRECT16 lprect16 = PTR_SEG_TO_LIN(*plParam);
LPRECT lprect32 = HeapAlloc( SystemHeap, 0, LPRECT lprect32 = HeapAlloc( GetProcessHeap(), 0,
sizeof(*lprect32) ); sizeof(*lprect32) );
CONV_RECT16TO32( lprect16, lprect32 ); CONV_RECT16TO32( lprect16, lprect32 );
@ -191,7 +191,7 @@ static void HOOK_Map16To32Common(INT id, INT code, WPARAM *pwParam,
case WH_MOUSE: case WH_MOUSE:
{ {
LPMOUSEHOOKSTRUCT16 lpms16 = PTR_SEG_TO_LIN(*plParam); LPMOUSEHOOKSTRUCT16 lpms16 = PTR_SEG_TO_LIN(*plParam);
LPMOUSEHOOKSTRUCT lpms32 = HeapAlloc( SystemHeap, 0, LPMOUSEHOOKSTRUCT lpms32 = HeapAlloc( GetProcessHeap(), 0,
sizeof(*lpms32) ); sizeof(*lpms32) );
CONV_POINT16TO32( &lpms16->pt, &lpms32->pt ); CONV_POINT16TO32( &lpms16->pt, &lpms32->pt );
@ -208,7 +208,7 @@ static void HOOK_Map16To32Common(INT id, INT code, WPARAM *pwParam,
case WH_DEBUG: case WH_DEBUG:
{ {
LPDEBUGHOOKINFO16 lpdh16 = PTR_SEG_TO_LIN(*plParam); LPDEBUGHOOKINFO16 lpdh16 = PTR_SEG_TO_LIN(*plParam);
LPDEBUGHOOKINFO lpdh32 = HeapAlloc( SystemHeap, 0, LPDEBUGHOOKINFO lpdh32 = HeapAlloc( GetProcessHeap(), 0,
sizeof(*lpdh32) ); sizeof(*lpdh32) );
lpdh32->idThread = 0; /* FIXME */ lpdh32->idThread = 0; /* FIXME */
@ -270,7 +270,7 @@ static void HOOK_UnMap16To32Common(INT id, INT code, WPARAM wParamOrig,
case WH_JOURNALRECORD: case WH_JOURNALRECORD:
case WH_JOURNALPLAYBACK: case WH_JOURNALPLAYBACK:
HeapFree( SystemHeap, 0, (LPVOID)lParam ); HeapFree( GetProcessHeap(), 0, (LPVOID)lParam );
break; break;
case WH_CALLWNDPROC: case WH_CALLWNDPROC:
@ -280,7 +280,7 @@ static void HOOK_UnMap16To32Common(INT id, INT code, WPARAM wParamOrig,
lpcwp32->lParam, 0 ); lpcwp32->lParam, 0 );
else WINPROC_UnmapMsg16To32W( lpcwp32->hwnd,lpcwp32->message, lpcwp32->wParam, else WINPROC_UnmapMsg16To32W( lpcwp32->hwnd,lpcwp32->message, lpcwp32->wParam,
lpcwp32->lParam, 0 ); lpcwp32->lParam, 0 );
HeapFree( SystemHeap, 0, lpcwp32 ); HeapFree( GetProcessHeap(), 0, lpcwp32 );
break; break;
} }
@ -288,14 +288,14 @@ static void HOOK_UnMap16To32Common(INT id, INT code, WPARAM wParamOrig,
{ {
LPMSG16 lpmsg16 = PTR_SEG_TO_LIN(lParamOrig); LPMSG16 lpmsg16 = PTR_SEG_TO_LIN(lParamOrig);
STRUCT32_MSG32to16( (LPMSG)lParam, lpmsg16 ); STRUCT32_MSG32to16( (LPMSG)lParam, lpmsg16 );
HeapFree( SystemHeap, 0, (LPVOID)lParam ); HeapFree( GetProcessHeap(), 0, (LPVOID)lParam );
break; break;
} }
case WH_MOUSE: case WH_MOUSE:
case WH_DEBUG: case WH_DEBUG:
HeapFree( SystemHeap, 0, (LPVOID)lParam ); HeapFree( GetProcessHeap(), 0, (LPVOID)lParam );
break; break;
case WH_CBT: case WH_CBT:
@ -309,21 +309,21 @@ static void HOOK_UnMap16To32Common(INT id, INT code, WPARAM wParamOrig,
if( !bA ) if( !bA )
{ {
if (HIWORD(lpcbtcw32->lpcs->lpszName)) if (HIWORD(lpcbtcw32->lpcs->lpszName))
HeapFree( SystemHeap, 0, (LPWSTR)lpcbtcw32->lpcs->lpszName ); HeapFree( GetProcessHeap(), 0, (LPWSTR)lpcbtcw32->lpcs->lpszName );
if (HIWORD(lpcbtcw32->lpcs->lpszClass)) if (HIWORD(lpcbtcw32->lpcs->lpszClass))
HeapFree( SystemHeap, 0, (LPWSTR)lpcbtcw32->lpcs->lpszClass ); HeapFree( GetProcessHeap(), 0, (LPWSTR)lpcbtcw32->lpcs->lpszClass );
} }
lpcbtcw16->hwndInsertAfter = lpcbtcw32->hwndInsertAfter; lpcbtcw16->hwndInsertAfter = lpcbtcw32->hwndInsertAfter;
HeapFree( SystemHeap, 0, lpcbtcw32->lpcs ); HeapFree( GetProcessHeap(), 0, lpcbtcw32->lpcs );
} /* fall through */ } /* fall through */
case HCBT_ACTIVATE: case HCBT_ACTIVATE:
case HCBT_CLICKSKIPPED: case HCBT_CLICKSKIPPED:
case HCBT_MOVESIZE: case HCBT_MOVESIZE:
HeapFree( SystemHeap, 0, (LPVOID)lParam); HeapFree( GetProcessHeap(), 0, (LPVOID)lParam);
break; break;
} }
break; break;
@ -687,16 +687,16 @@ static void HOOK_Map32ATo32W(INT id, INT code, WPARAM *pwParam,
if (id == WH_CBT && code == HCBT_CREATEWND) if (id == WH_CBT && code == HCBT_CREATEWND)
{ {
LPCBT_CREATEWNDA lpcbtcwA = (LPCBT_CREATEWNDA)*plParam; LPCBT_CREATEWNDA lpcbtcwA = (LPCBT_CREATEWNDA)*plParam;
LPCBT_CREATEWNDW lpcbtcwW = HeapAlloc( SystemHeap, 0, LPCBT_CREATEWNDW lpcbtcwW = HeapAlloc( GetProcessHeap(), 0,
sizeof(*lpcbtcwW) ); sizeof(*lpcbtcwW) );
lpcbtcwW->lpcs = HeapAlloc( SystemHeap, 0, sizeof(*lpcbtcwW->lpcs) ); lpcbtcwW->lpcs = HeapAlloc( GetProcessHeap(), 0, sizeof(*lpcbtcwW->lpcs) );
lpcbtcwW->hwndInsertAfter = lpcbtcwA->hwndInsertAfter; lpcbtcwW->hwndInsertAfter = lpcbtcwA->hwndInsertAfter;
*lpcbtcwW->lpcs = *(LPCREATESTRUCTW)lpcbtcwA->lpcs; *lpcbtcwW->lpcs = *(LPCREATESTRUCTW)lpcbtcwA->lpcs;
if (HIWORD(lpcbtcwA->lpcs->lpszName)) if (HIWORD(lpcbtcwA->lpcs->lpszName))
{ {
lpcbtcwW->lpcs->lpszName = HEAP_strdupAtoW( SystemHeap, 0, lpcbtcwW->lpcs->lpszName = HEAP_strdupAtoW( GetProcessHeap(), 0,
lpcbtcwA->lpcs->lpszName ); lpcbtcwA->lpcs->lpszName );
} }
else else
@ -704,7 +704,7 @@ static void HOOK_Map32ATo32W(INT id, INT code, WPARAM *pwParam,
if (HIWORD(lpcbtcwA->lpcs->lpszClass)) if (HIWORD(lpcbtcwA->lpcs->lpszClass))
{ {
lpcbtcwW->lpcs->lpszClass = HEAP_strdupAtoW( SystemHeap, 0, lpcbtcwW->lpcs->lpszClass = HEAP_strdupAtoW( GetProcessHeap(), 0,
lpcbtcwA->lpcs->lpszClass ); lpcbtcwA->lpcs->lpszClass );
} }
else else
@ -726,11 +726,11 @@ static void HOOK_UnMap32ATo32W(INT id, INT code, WPARAM wParamOrig,
{ {
LPCBT_CREATEWNDW lpcbtcwW = (LPCBT_CREATEWNDW)lParam; LPCBT_CREATEWNDW lpcbtcwW = (LPCBT_CREATEWNDW)lParam;
if (HIWORD(lpcbtcwW->lpcs->lpszName)) if (HIWORD(lpcbtcwW->lpcs->lpszName))
HeapFree( SystemHeap, 0, (LPWSTR)lpcbtcwW->lpcs->lpszName ); HeapFree( GetProcessHeap(), 0, (LPWSTR)lpcbtcwW->lpcs->lpszName );
if (HIWORD(lpcbtcwW->lpcs->lpszClass)) if (HIWORD(lpcbtcwW->lpcs->lpszClass))
HeapFree( SystemHeap, 0, (LPWSTR)lpcbtcwW->lpcs->lpszClass ); HeapFree( GetProcessHeap(), 0, (LPWSTR)lpcbtcwW->lpcs->lpszClass );
HeapFree( SystemHeap, 0, lpcbtcwW->lpcs ); HeapFree( GetProcessHeap(), 0, lpcbtcwW->lpcs );
HeapFree( SystemHeap, 0, lpcbtcwW ); HeapFree( GetProcessHeap(), 0, lpcbtcwW );
} }
return; return;
} }
@ -745,21 +745,21 @@ static void HOOK_Map32WTo32A(INT id, INT code, WPARAM *pwParam,
if (id == WH_CBT && code == HCBT_CREATEWND) if (id == WH_CBT && code == HCBT_CREATEWND)
{ {
LPCBT_CREATEWNDW lpcbtcwW = (LPCBT_CREATEWNDW)*plParam; LPCBT_CREATEWNDW lpcbtcwW = (LPCBT_CREATEWNDW)*plParam;
LPCBT_CREATEWNDA lpcbtcwA = HeapAlloc( SystemHeap, 0, LPCBT_CREATEWNDA lpcbtcwA = HeapAlloc( GetProcessHeap(), 0,
sizeof(*lpcbtcwA) ); sizeof(*lpcbtcwA) );
lpcbtcwA->lpcs = HeapAlloc( SystemHeap, 0, sizeof(*lpcbtcwA->lpcs) ); lpcbtcwA->lpcs = HeapAlloc( GetProcessHeap(), 0, sizeof(*lpcbtcwA->lpcs) );
lpcbtcwA->hwndInsertAfter = lpcbtcwW->hwndInsertAfter; lpcbtcwA->hwndInsertAfter = lpcbtcwW->hwndInsertAfter;
*lpcbtcwA->lpcs = *(LPCREATESTRUCTA)lpcbtcwW->lpcs; *lpcbtcwA->lpcs = *(LPCREATESTRUCTA)lpcbtcwW->lpcs;
if (HIWORD(lpcbtcwW->lpcs->lpszName)) if (HIWORD(lpcbtcwW->lpcs->lpszName))
lpcbtcwA->lpcs->lpszName = HEAP_strdupWtoA( SystemHeap, 0, lpcbtcwA->lpcs->lpszName = HEAP_strdupWtoA( GetProcessHeap(), 0,
lpcbtcwW->lpcs->lpszName ); lpcbtcwW->lpcs->lpszName );
else else
lpcbtcwA->lpcs->lpszName = (LPSTR)lpcbtcwW->lpcs->lpszName; lpcbtcwA->lpcs->lpszName = (LPSTR)lpcbtcwW->lpcs->lpszName;
if (HIWORD(lpcbtcwW->lpcs->lpszClass)) if (HIWORD(lpcbtcwW->lpcs->lpszClass))
lpcbtcwA->lpcs->lpszClass = HEAP_strdupWtoA( SystemHeap, 0, lpcbtcwA->lpcs->lpszClass = HEAP_strdupWtoA( GetProcessHeap(), 0,
lpcbtcwW->lpcs->lpszClass ); lpcbtcwW->lpcs->lpszClass );
else else
lpcbtcwA->lpcs->lpszClass = (LPSTR)lpcbtcwW->lpcs->lpszClass; lpcbtcwA->lpcs->lpszClass = (LPSTR)lpcbtcwW->lpcs->lpszClass;
@ -780,11 +780,11 @@ static void HOOK_UnMap32WTo32A(INT id, INT code, WPARAM wParamOrig,
{ {
LPCBT_CREATEWNDA lpcbtcwA = (LPCBT_CREATEWNDA)lParam; LPCBT_CREATEWNDA lpcbtcwA = (LPCBT_CREATEWNDA)lParam;
if (HIWORD(lpcbtcwA->lpcs->lpszName)) if (HIWORD(lpcbtcwA->lpcs->lpszName))
HeapFree( SystemHeap, 0, (LPSTR)lpcbtcwA->lpcs->lpszName ); HeapFree( GetProcessHeap(), 0, (LPSTR)lpcbtcwA->lpcs->lpszName );
if (HIWORD(lpcbtcwA->lpcs->lpszClass)) if (HIWORD(lpcbtcwA->lpcs->lpszClass))
HeapFree( SystemHeap, 0, (LPSTR)lpcbtcwA->lpcs->lpszClass ); HeapFree( GetProcessHeap(), 0, (LPSTR)lpcbtcwA->lpcs->lpszClass );
HeapFree( SystemHeap, 0, lpcbtcwA->lpcs ); HeapFree( GetProcessHeap(), 0, lpcbtcwA->lpcs );
HeapFree( SystemHeap, 0, lpcbtcwA ); HeapFree( GetProcessHeap(), 0, lpcbtcwA );
} }
return; return;
} }

View File

@ -2704,7 +2704,7 @@ HWND WINAPI GetLastActivePopup( HWND hwnd )
* WIN_BuildWinArray * WIN_BuildWinArray
* *
* Build an array of pointers to the children of a given window. * Build an array of pointers to the children of a given window.
* The array must be freed with HeapFree(SystemHeap). Return NULL * The array must be freed with WIN_ReleaseWinArray. Return NULL
* when no windows are found. * when no windows are found.
*/ */
WND **WIN_BuildWinArray( WND *wndPtr, UINT bwaFlags, UINT* pTotal ) WND **WIN_BuildWinArray( WND *wndPtr, UINT bwaFlags, UINT* pTotal )
@ -2739,7 +2739,7 @@ WND **WIN_BuildWinArray( WND *wndPtr, UINT bwaFlags, UINT* pTotal )
{ {
/* Now build the list of all windows */ /* Now build the list of all windows */
if ((list = (WND **)HeapAlloc( SystemHeap, 0, sizeof(WND *) * (count + 1)))) if ((list = (WND **)HeapAlloc( GetProcessHeap(), 0, sizeof(WND *) * (count + 1))))
{ {
for (pWnd = WIN_LockWndPtr(wndPtr->child), ppWnd = list, count = 0; pWnd; WIN_UpdateWndPtr(&pWnd,pWnd->next)) for (pWnd = WIN_LockWndPtr(wndPtr->child), ppWnd = list, count = 0; pWnd; WIN_UpdateWndPtr(&pWnd,pWnd->next))
{ {
@ -2765,7 +2765,7 @@ WND **WIN_BuildWinArray( WND *wndPtr, UINT bwaFlags, UINT* pTotal )
void WIN_ReleaseWinArray(WND **wndArray) void WIN_ReleaseWinArray(WND **wndArray)
{ {
/* Future : this function will also unlock all windows associated with wndArray */ /* Future : this function will also unlock all windows associated with wndArray */
HeapFree( SystemHeap, 0, wndArray ); HeapFree( GetProcessHeap(), 0, wndArray );
} }

View File

@ -524,7 +524,7 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM wParam, LPARAM *plparam
{ {
case WM_GETTEXT: case WM_GETTEXT:
{ {
LPARAM *ptr = (LPARAM *)HeapAlloc( SystemHeap, 0, LPARAM *ptr = (LPARAM *)HeapAlloc( GetProcessHeap(), 0,
wParam * sizeof(WCHAR) + sizeof(LPARAM) ); wParam * sizeof(WCHAR) + sizeof(LPARAM) );
if (!ptr) return -1; if (!ptr) return -1;
*ptr++ = *plparam; /* Store previous lParam */ *ptr++ = *plparam; /* Store previous lParam */
@ -543,7 +543,7 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM wParam, LPARAM *plparam
case LB_FINDSTRING: case LB_FINDSTRING:
case LB_SELECTSTRING: case LB_SELECTSTRING:
case EM_REPLACESEL: case EM_REPLACESEL:
*plparam = (LPARAM)HEAP_strdupAtoW( SystemHeap, 0, (LPCSTR)*plparam ); *plparam = (LPARAM)HEAP_strdupAtoW( GetProcessHeap(), 0, (LPCSTR)*plparam );
return (*plparam ? 1 : -1); return (*plparam ? 1 : -1);
case WM_NCCREATE: case WM_NCCREATE:
@ -555,14 +555,14 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM wParam, LPARAM *plparam
LPCWSTR lpszClass; /* allocated Class */ LPCWSTR lpszClass; /* allocated Class */
}; };
struct s *xs = HeapAlloc( SystemHeap, HEAP_ZERO_MEMORY, sizeof(struct s)); struct s *xs = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct s));
if (!xs) return -1; if (!xs) return -1;
xs->cs = *(CREATESTRUCTW *)*plparam; xs->cs = *(CREATESTRUCTW *)*plparam;
if (HIWORD(xs->cs.lpszName)) if (HIWORD(xs->cs.lpszName))
xs->lpszName = xs->cs.lpszName = HEAP_strdupAtoW( SystemHeap, 0, xs->lpszName = xs->cs.lpszName = HEAP_strdupAtoW( GetProcessHeap(), 0,
(LPCSTR)xs->cs.lpszName ); (LPCSTR)xs->cs.lpszName );
if (HIWORD(xs->cs.lpszClass)) if (HIWORD(xs->cs.lpszClass))
xs->lpszClass = xs->cs.lpszClass = HEAP_strdupAtoW( SystemHeap, 0, xs->lpszClass = xs->cs.lpszClass = HEAP_strdupAtoW( GetProcessHeap(), 0,
(LPCSTR)xs->cs.lpszClass ); (LPCSTR)xs->cs.lpszClass );
*plparam = (LPARAM)xs; *plparam = (LPARAM)xs;
} }
@ -570,14 +570,14 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM wParam, LPARAM *plparam
case WM_MDICREATE: case WM_MDICREATE:
{ {
MDICREATESTRUCTW *cs = MDICREATESTRUCTW *cs =
(MDICREATESTRUCTW *)HeapAlloc( SystemHeap, 0, sizeof(*cs) ); (MDICREATESTRUCTW *)HeapAlloc( GetProcessHeap(), 0, sizeof(*cs) );
if (!cs) return -1; if (!cs) return -1;
*cs = *(MDICREATESTRUCTW *)*plparam; *cs = *(MDICREATESTRUCTW *)*plparam;
if (HIWORD(cs->szClass)) if (HIWORD(cs->szClass))
cs->szClass = HEAP_strdupAtoW( SystemHeap, 0, cs->szClass = HEAP_strdupAtoW( GetProcessHeap(), 0,
(LPCSTR)cs->szClass ); (LPCSTR)cs->szClass );
if (HIWORD(cs->szTitle)) if (HIWORD(cs->szTitle))
cs->szTitle = HEAP_strdupAtoW( SystemHeap, 0, cs->szTitle = HEAP_strdupAtoW( GetProcessHeap(), 0,
(LPCSTR)cs->szTitle ); (LPCSTR)cs->szTitle );
*plparam = (LPARAM)cs; *plparam = (LPARAM)cs;
} }
@ -587,12 +587,12 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM wParam, LPARAM *plparam
case LB_ADDSTRING: case LB_ADDSTRING:
case LB_INSERTSTRING: case LB_INSERTSTRING:
if ( WINPROC_TestLBForStr( hwnd )) if ( WINPROC_TestLBForStr( hwnd ))
*plparam = (LPARAM)HEAP_strdupAtoW( SystemHeap, 0, (LPCSTR)*plparam ); *plparam = (LPARAM)HEAP_strdupAtoW( GetProcessHeap(), 0, (LPCSTR)*plparam );
return (*plparam ? 1 : -1); return (*plparam ? 1 : -1);
case LB_GETTEXT: /* fixme: fixed sized buffer */ case LB_GETTEXT: /* fixme: fixed sized buffer */
{ if ( WINPROC_TestLBForStr( hwnd )) { if ( WINPROC_TestLBForStr( hwnd ))
{ LPARAM *ptr = (LPARAM *)HeapAlloc( SystemHeap, 0, 256 * sizeof(WCHAR) + sizeof(LPARAM) ); { LPARAM *ptr = (LPARAM *)HeapAlloc( GetProcessHeap(), 0, 256 * sizeof(WCHAR) + sizeof(LPARAM) );
if (!ptr) return -1; if (!ptr) return -1;
*ptr++ = *plparam; /* Store previous lParam */ *ptr++ = *plparam; /* Store previous lParam */
*plparam = (LPARAM)ptr; *plparam = (LPARAM)ptr;
@ -604,12 +604,12 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM wParam, LPARAM *plparam
case CB_ADDSTRING: case CB_ADDSTRING:
case CB_INSERTSTRING: case CB_INSERTSTRING:
if ( WINPROC_TestCBForStr( hwnd )) if ( WINPROC_TestCBForStr( hwnd ))
*plparam = (LPARAM)HEAP_strdupAtoW( SystemHeap, 0, (LPCSTR)*plparam ); *plparam = (LPARAM)HEAP_strdupAtoW( GetProcessHeap(), 0, (LPCSTR)*plparam );
return (*plparam ? 1 : -1); return (*plparam ? 1 : -1);
case CB_GETLBTEXT: /* fixme: fixed sized buffer */ case CB_GETLBTEXT: /* fixme: fixed sized buffer */
{ if ( WINPROC_TestCBForStr( hwnd )) { if ( WINPROC_TestCBForStr( hwnd ))
{ LPARAM *ptr = (LPARAM *)HeapAlloc( SystemHeap, 0, 256 * sizeof(WCHAR) + sizeof(LPARAM) ); { LPARAM *ptr = (LPARAM *)HeapAlloc( GetProcessHeap(), 0, 256 * sizeof(WCHAR) + sizeof(LPARAM) );
if (!ptr) return -1; if (!ptr) return -1;
*ptr++ = *plparam; /* Store previous lParam */ *ptr++ = *plparam; /* Store previous lParam */
*plparam = (LPARAM)ptr; *plparam = (LPARAM)ptr;
@ -620,7 +620,7 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM wParam, LPARAM *plparam
/* Multiline edit */ /* Multiline edit */
case EM_GETLINE: case EM_GETLINE:
{ WORD len = (WORD)*plparam; { WORD len = (WORD)*plparam;
LPARAM *ptr = (LPARAM *) HEAP_xalloc( SystemHeap, 0, sizeof(LPARAM) + sizeof (WORD) + len*sizeof(WCHAR) ); LPARAM *ptr = (LPARAM *) HEAP_xalloc( GetProcessHeap(), 0, sizeof(LPARAM) + sizeof (WORD) + len*sizeof(WCHAR) );
if (!ptr) return -1; if (!ptr) return -1;
*ptr++ = *plparam; /* Store previous lParam */ *ptr++ = *plparam; /* Store previous lParam */
*((WORD *) ptr) = len; /* Store the length */ *((WORD *) ptr) = len; /* Store the length */
@ -654,7 +654,7 @@ void WINPROC_UnmapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
{ {
LPARAM *ptr = (LPARAM *)lParam - 1; LPARAM *ptr = (LPARAM *)lParam - 1;
lstrcpynWtoA( (LPSTR)*ptr, (LPWSTR)lParam, wParam ); lstrcpynWtoA( (LPSTR)*ptr, (LPWSTR)lParam, wParam );
HeapFree( SystemHeap, 0, ptr ); HeapFree( GetProcessHeap(), 0, ptr );
} }
break; break;
@ -667,9 +667,9 @@ void WINPROC_UnmapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
LPWSTR lpszClass; /* allocated Class */ LPWSTR lpszClass; /* allocated Class */
}; };
struct s *xs = (struct s *)lParam; struct s *xs = (struct s *)lParam;
if (xs->lpszName) HeapFree( SystemHeap, 0, xs->lpszName ); if (xs->lpszName) HeapFree( GetProcessHeap(), 0, xs->lpszName );
if (xs->lpszClass) HeapFree( SystemHeap, 0, xs->lpszClass ); if (xs->lpszClass) HeapFree( GetProcessHeap(), 0, xs->lpszClass );
HeapFree( SystemHeap, 0, xs ); HeapFree( GetProcessHeap(), 0, xs );
} }
break; break;
@ -677,10 +677,10 @@ void WINPROC_UnmapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
{ {
MDICREATESTRUCTW *cs = (MDICREATESTRUCTW *)lParam; MDICREATESTRUCTW *cs = (MDICREATESTRUCTW *)lParam;
if (HIWORD(cs->szTitle)) if (HIWORD(cs->szTitle))
HeapFree( SystemHeap, 0, (LPVOID)cs->szTitle ); HeapFree( GetProcessHeap(), 0, (LPVOID)cs->szTitle );
if (HIWORD(cs->szClass)) if (HIWORD(cs->szClass))
HeapFree( SystemHeap, 0, (LPVOID)cs->szClass ); HeapFree( GetProcessHeap(), 0, (LPVOID)cs->szClass );
HeapFree( SystemHeap, 0, cs ); HeapFree( GetProcessHeap(), 0, cs );
} }
break; break;
@ -695,21 +695,21 @@ void WINPROC_UnmapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
case LB_FINDSTRING: case LB_FINDSTRING:
case LB_SELECTSTRING: case LB_SELECTSTRING:
case EM_REPLACESEL: case EM_REPLACESEL:
HeapFree( SystemHeap, 0, (void *)lParam ); HeapFree( GetProcessHeap(), 0, (void *)lParam );
break; break;
/* Listbox */ /* Listbox */
case LB_ADDSTRING: case LB_ADDSTRING:
case LB_INSERTSTRING: case LB_INSERTSTRING:
if ( WINPROC_TestLBForStr( hwnd )) if ( WINPROC_TestLBForStr( hwnd ))
HeapFree( SystemHeap, 0, (void *)lParam ); HeapFree( GetProcessHeap(), 0, (void *)lParam );
break; break;
case LB_GETTEXT: case LB_GETTEXT:
{ if ( WINPROC_TestLBForStr( hwnd )) { if ( WINPROC_TestLBForStr( hwnd ))
{ LPARAM *ptr = (LPARAM *)lParam - 1; { LPARAM *ptr = (LPARAM *)lParam - 1;
lstrcpyWtoA( (LPSTR)*ptr, (LPWSTR)(lParam) ); lstrcpyWtoA( (LPSTR)*ptr, (LPWSTR)(lParam) );
HeapFree( SystemHeap, 0, ptr ); HeapFree( GetProcessHeap(), 0, ptr );
} }
} }
break; break;
@ -718,14 +718,14 @@ void WINPROC_UnmapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
case CB_ADDSTRING: case CB_ADDSTRING:
case CB_INSERTSTRING: case CB_INSERTSTRING:
if ( WINPROC_TestCBForStr( hwnd )) if ( WINPROC_TestCBForStr( hwnd ))
HeapFree( SystemHeap, 0, (void *)lParam ); HeapFree( GetProcessHeap(), 0, (void *)lParam );
break; break;
case CB_GETLBTEXT: case CB_GETLBTEXT:
{ if ( WINPROC_TestCBForStr( hwnd )) { if ( WINPROC_TestCBForStr( hwnd ))
{ LPARAM *ptr = (LPARAM *)lParam - 1; { LPARAM *ptr = (LPARAM *)lParam - 1;
lstrcpyWtoA( (LPSTR)*ptr, (LPWSTR)(lParam) ); lstrcpyWtoA( (LPSTR)*ptr, (LPWSTR)(lParam) );
HeapFree( SystemHeap, 0, ptr ); HeapFree( GetProcessHeap(), 0, ptr );
} }
} }
break; break;
@ -735,7 +735,7 @@ void WINPROC_UnmapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
{ LPARAM * ptr = (LPARAM *)lParam - 1; /* get the old lParam */ { LPARAM * ptr = (LPARAM *)lParam - 1; /* get the old lParam */
WORD len = *(WORD *) lParam; WORD len = *(WORD *) lParam;
lstrcpynWtoA( (LPSTR)*ptr , (LPWSTR)lParam, len ); lstrcpynWtoA( (LPSTR)*ptr , (LPWSTR)lParam, len );
HeapFree( SystemHeap, 0, ptr ); HeapFree( GetProcessHeap(), 0, ptr );
} }
break; break;
} }
@ -753,7 +753,7 @@ INT WINPROC_MapMsg32WTo32A( HWND hwnd, UINT msg, WPARAM wParam, LPARAM *plparam
{ {
case WM_GETTEXT: case WM_GETTEXT:
{ {
LPARAM *ptr = (LPARAM *)HeapAlloc( SystemHeap, 0, LPARAM *ptr = (LPARAM *)HeapAlloc( GetProcessHeap(), 0,
wParam + sizeof(LPARAM) ); wParam + sizeof(LPARAM) );
if (!ptr) return -1; if (!ptr) return -1;
*ptr++ = *plparam; /* Store previous lParam */ *ptr++ = *plparam; /* Store previous lParam */
@ -772,21 +772,21 @@ INT WINPROC_MapMsg32WTo32A( HWND hwnd, UINT msg, WPARAM wParam, LPARAM *plparam
case LB_FINDSTRING: case LB_FINDSTRING:
case LB_SELECTSTRING: case LB_SELECTSTRING:
case EM_REPLACESEL: case EM_REPLACESEL:
*plparam = (LPARAM)HEAP_strdupWtoA( SystemHeap, 0, (LPCWSTR)*plparam ); *plparam = (LPARAM)HEAP_strdupWtoA( GetProcessHeap(), 0, (LPCWSTR)*plparam );
return (*plparam ? 1 : -1); return (*plparam ? 1 : -1);
case WM_NCCREATE: case WM_NCCREATE:
case WM_CREATE: case WM_CREATE:
{ {
CREATESTRUCTA *cs = (CREATESTRUCTA *)HeapAlloc( SystemHeap, 0, CREATESTRUCTA *cs = (CREATESTRUCTA *)HeapAlloc( GetProcessHeap(), 0,
sizeof(*cs) ); sizeof(*cs) );
if (!cs) return -1; if (!cs) return -1;
*cs = *(CREATESTRUCTA *)*plparam; *cs = *(CREATESTRUCTA *)*plparam;
if (HIWORD(cs->lpszName)) if (HIWORD(cs->lpszName))
cs->lpszName = HEAP_strdupWtoA( SystemHeap, 0, cs->lpszName = HEAP_strdupWtoA( GetProcessHeap(), 0,
(LPCWSTR)cs->lpszName ); (LPCWSTR)cs->lpszName );
if (HIWORD(cs->lpszClass)) if (HIWORD(cs->lpszClass))
cs->lpszClass = HEAP_strdupWtoA( SystemHeap, 0, cs->lpszClass = HEAP_strdupWtoA( GetProcessHeap(), 0,
(LPCWSTR)cs->lpszClass); (LPCWSTR)cs->lpszClass);
*plparam = (LPARAM)cs; *plparam = (LPARAM)cs;
} }
@ -794,14 +794,14 @@ INT WINPROC_MapMsg32WTo32A( HWND hwnd, UINT msg, WPARAM wParam, LPARAM *plparam
case WM_MDICREATE: case WM_MDICREATE:
{ {
MDICREATESTRUCTA *cs = MDICREATESTRUCTA *cs =
(MDICREATESTRUCTA *)HeapAlloc( SystemHeap, 0, sizeof(*cs) ); (MDICREATESTRUCTA *)HeapAlloc( GetProcessHeap(), 0, sizeof(*cs) );
if (!cs) return -1; if (!cs) return -1;
*cs = *(MDICREATESTRUCTA *)*plparam; *cs = *(MDICREATESTRUCTA *)*plparam;
if (HIWORD(cs->szTitle)) if (HIWORD(cs->szTitle))
cs->szTitle = HEAP_strdupWtoA( SystemHeap, 0, cs->szTitle = HEAP_strdupWtoA( GetProcessHeap(), 0,
(LPCWSTR)cs->szTitle ); (LPCWSTR)cs->szTitle );
if (HIWORD(cs->szClass)) if (HIWORD(cs->szClass))
cs->szClass = HEAP_strdupWtoA( SystemHeap, 0, cs->szClass = HEAP_strdupWtoA( GetProcessHeap(), 0,
(LPCWSTR)cs->szClass ); (LPCWSTR)cs->szClass );
*plparam = (LPARAM)cs; *plparam = (LPARAM)cs;
} }
@ -811,12 +811,12 @@ INT WINPROC_MapMsg32WTo32A( HWND hwnd, UINT msg, WPARAM wParam, LPARAM *plparam
case LB_ADDSTRING: case LB_ADDSTRING:
case LB_INSERTSTRING: case LB_INSERTSTRING:
if ( WINPROC_TestLBForStr( hwnd )) if ( WINPROC_TestLBForStr( hwnd ))
*plparam = (LPARAM)HEAP_strdupWtoA( SystemHeap, 0, (LPCWSTR)*plparam ); *plparam = (LPARAM)HEAP_strdupWtoA( GetProcessHeap(), 0, (LPCWSTR)*plparam );
return (*plparam ? 1 : -1); return (*plparam ? 1 : -1);
case LB_GETTEXT: /* fixme: fixed sized buffer */ case LB_GETTEXT: /* fixme: fixed sized buffer */
{ if ( WINPROC_TestLBForStr( hwnd )) { if ( WINPROC_TestLBForStr( hwnd ))
{ LPARAM *ptr = (LPARAM *)HeapAlloc( SystemHeap, 0, 256 + sizeof(LPARAM) ); { LPARAM *ptr = (LPARAM *)HeapAlloc( GetProcessHeap(), 0, 256 + sizeof(LPARAM) );
if (!ptr) return -1; if (!ptr) return -1;
*ptr++ = *plparam; /* Store previous lParam */ *ptr++ = *plparam; /* Store previous lParam */
*plparam = (LPARAM)ptr; *plparam = (LPARAM)ptr;
@ -828,12 +828,12 @@ INT WINPROC_MapMsg32WTo32A( HWND hwnd, UINT msg, WPARAM wParam, LPARAM *plparam
case CB_ADDSTRING: case CB_ADDSTRING:
case CB_INSERTSTRING: case CB_INSERTSTRING:
if ( WINPROC_TestCBForStr( hwnd )) if ( WINPROC_TestCBForStr( hwnd ))
*plparam = (LPARAM)HEAP_strdupWtoA( SystemHeap, 0, (LPCWSTR)*plparam ); *plparam = (LPARAM)HEAP_strdupWtoA( GetProcessHeap(), 0, (LPCWSTR)*plparam );
return (*plparam ? 1 : -1); return (*plparam ? 1 : -1);
case CB_GETLBTEXT: /* fixme: fixed sized buffer */ case CB_GETLBTEXT: /* fixme: fixed sized buffer */
{ if ( WINPROC_TestCBForStr( hwnd )) { if ( WINPROC_TestCBForStr( hwnd ))
{ LPARAM *ptr = (LPARAM *)HeapAlloc( SystemHeap, 0, 256 + sizeof(LPARAM) ); { LPARAM *ptr = (LPARAM *)HeapAlloc( GetProcessHeap(), 0, 256 + sizeof(LPARAM) );
if (!ptr) return -1; if (!ptr) return -1;
*ptr++ = *plparam; /* Store previous lParam */ *ptr++ = *plparam; /* Store previous lParam */
*plparam = (LPARAM)ptr; *plparam = (LPARAM)ptr;
@ -844,7 +844,7 @@ INT WINPROC_MapMsg32WTo32A( HWND hwnd, UINT msg, WPARAM wParam, LPARAM *plparam
/* Multiline edit */ /* Multiline edit */
case EM_GETLINE: case EM_GETLINE:
{ WORD len = (WORD)*plparam; { WORD len = (WORD)*plparam;
LPARAM *ptr = (LPARAM *) HEAP_xalloc( SystemHeap, 0, sizeof(LPARAM) + sizeof (WORD) + len*sizeof(CHAR) ); LPARAM *ptr = (LPARAM *) HEAP_xalloc( GetProcessHeap(), 0, sizeof(LPARAM) + sizeof (WORD) + len*sizeof(CHAR) );
if (!ptr) return -1; if (!ptr) return -1;
*ptr++ = *plparam; /* Store previous lParam */ *ptr++ = *plparam; /* Store previous lParam */
*((WORD *) ptr) = len; /* Store the length */ *((WORD *) ptr) = len; /* Store the length */
@ -878,7 +878,7 @@ void WINPROC_UnmapMsg32WTo32A( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
{ {
LPARAM *ptr = (LPARAM *)lParam - 1; LPARAM *ptr = (LPARAM *)lParam - 1;
lstrcpynAtoW( (LPWSTR)*ptr, (LPSTR)lParam, wParam ); lstrcpynAtoW( (LPWSTR)*ptr, (LPSTR)lParam, wParam );
HeapFree( SystemHeap, 0, ptr ); HeapFree( GetProcessHeap(), 0, ptr );
} }
break; break;
@ -893,7 +893,7 @@ void WINPROC_UnmapMsg32WTo32A( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
case LB_FINDSTRING: case LB_FINDSTRING:
case LB_SELECTSTRING: case LB_SELECTSTRING:
case EM_REPLACESEL: case EM_REPLACESEL:
HeapFree( SystemHeap, 0, (void *)lParam ); HeapFree( GetProcessHeap(), 0, (void *)lParam );
break; break;
case WM_NCCREATE: case WM_NCCREATE:
@ -901,10 +901,10 @@ void WINPROC_UnmapMsg32WTo32A( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
{ {
CREATESTRUCTA *cs = (CREATESTRUCTA *)lParam; CREATESTRUCTA *cs = (CREATESTRUCTA *)lParam;
if (HIWORD(cs->lpszName)) if (HIWORD(cs->lpszName))
HeapFree( SystemHeap, 0, (LPVOID)cs->lpszName ); HeapFree( GetProcessHeap(), 0, (LPVOID)cs->lpszName );
if (HIWORD(cs->lpszClass)) if (HIWORD(cs->lpszClass))
HeapFree( SystemHeap, 0, (LPVOID)cs->lpszClass ); HeapFree( GetProcessHeap(), 0, (LPVOID)cs->lpszClass );
HeapFree( SystemHeap, 0, cs ); HeapFree( GetProcessHeap(), 0, cs );
} }
break; break;
@ -912,10 +912,10 @@ void WINPROC_UnmapMsg32WTo32A( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
{ {
MDICREATESTRUCTA *cs = (MDICREATESTRUCTA *)lParam; MDICREATESTRUCTA *cs = (MDICREATESTRUCTA *)lParam;
if (HIWORD(cs->szTitle)) if (HIWORD(cs->szTitle))
HeapFree( SystemHeap, 0, (LPVOID)cs->szTitle ); HeapFree( GetProcessHeap(), 0, (LPVOID)cs->szTitle );
if (HIWORD(cs->szClass)) if (HIWORD(cs->szClass))
HeapFree( SystemHeap, 0, (LPVOID)cs->szClass ); HeapFree( GetProcessHeap(), 0, (LPVOID)cs->szClass );
HeapFree( SystemHeap, 0, cs ); HeapFree( GetProcessHeap(), 0, cs );
} }
break; break;
@ -923,14 +923,14 @@ void WINPROC_UnmapMsg32WTo32A( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
case LB_ADDSTRING: case LB_ADDSTRING:
case LB_INSERTSTRING: case LB_INSERTSTRING:
if ( WINPROC_TestLBForStr( hwnd )) if ( WINPROC_TestLBForStr( hwnd ))
HeapFree( SystemHeap, 0, (void *)lParam ); HeapFree( GetProcessHeap(), 0, (void *)lParam );
break; break;
case LB_GETTEXT: case LB_GETTEXT:
{ if ( WINPROC_TestLBForStr( hwnd )) { if ( WINPROC_TestLBForStr( hwnd ))
{ LPARAM *ptr = (LPARAM *)lParam - 1; { LPARAM *ptr = (LPARAM *)lParam - 1;
lstrcpyAtoW( (LPWSTR)*ptr, (LPSTR)(lParam) ); lstrcpyAtoW( (LPWSTR)*ptr, (LPSTR)(lParam) );
HeapFree( SystemHeap, 0, ptr ); HeapFree( GetProcessHeap(), 0, ptr );
} }
} }
break; break;
@ -939,14 +939,14 @@ void WINPROC_UnmapMsg32WTo32A( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
case CB_ADDSTRING: case CB_ADDSTRING:
case CB_INSERTSTRING: case CB_INSERTSTRING:
if ( WINPROC_TestCBForStr( hwnd )) if ( WINPROC_TestCBForStr( hwnd ))
HeapFree( SystemHeap, 0, (void *)lParam ); HeapFree( GetProcessHeap(), 0, (void *)lParam );
break; break;
case CB_GETLBTEXT: case CB_GETLBTEXT:
{ if ( WINPROC_TestCBForStr( hwnd )) { if ( WINPROC_TestCBForStr( hwnd ))
{ LPARAM *ptr = (LPARAM *)lParam - 1; { LPARAM *ptr = (LPARAM *)lParam - 1;
lstrcpyAtoW( (LPWSTR)*ptr, (LPSTR)(lParam) ); lstrcpyAtoW( (LPWSTR)*ptr, (LPSTR)(lParam) );
HeapFree( SystemHeap, 0, ptr ); HeapFree( GetProcessHeap(), 0, ptr );
} }
} }
break; break;
@ -956,7 +956,7 @@ void WINPROC_UnmapMsg32WTo32A( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
{ LPARAM * ptr = (LPARAM *)lParam - 1; /* get the old lparam */ { LPARAM * ptr = (LPARAM *)lParam - 1; /* get the old lparam */
WORD len = *(WORD *)ptr; WORD len = *(WORD *)ptr;
lstrcpynAtoW( (LPWSTR) *ptr, (LPSTR)lParam, len ); lstrcpynAtoW( (LPWSTR) *ptr, (LPSTR)lParam, len );
HeapFree( SystemHeap, 0, ptr ); HeapFree( GetProcessHeap(), 0, ptr );
} }
break; break;
} }
@ -998,7 +998,7 @@ INT WINPROC_MapMsg16To32A( UINT16 msg16, WPARAM16 wParam16, UINT *pmsg32,
{ {
COMPAREITEMSTRUCT16* cis16 = (COMPAREITEMSTRUCT16 *)PTR_SEG_TO_LIN(*plparam); COMPAREITEMSTRUCT16* cis16 = (COMPAREITEMSTRUCT16 *)PTR_SEG_TO_LIN(*plparam);
COMPAREITEMSTRUCT *cis = (COMPAREITEMSTRUCT *) COMPAREITEMSTRUCT *cis = (COMPAREITEMSTRUCT *)
HeapAlloc(SystemHeap, 0, sizeof(*cis)); HeapAlloc(GetProcessHeap(), 0, sizeof(*cis));
if (!cis) return -1; if (!cis) return -1;
cis->CtlType = cis16->CtlType; cis->CtlType = cis16->CtlType;
cis->CtlID = cis16->CtlID; cis->CtlID = cis16->CtlID;
@ -1015,7 +1015,7 @@ INT WINPROC_MapMsg16To32A( UINT16 msg16, WPARAM16 wParam16, UINT *pmsg32,
{ {
DELETEITEMSTRUCT16* dis16 = (DELETEITEMSTRUCT16 *)PTR_SEG_TO_LIN(*plparam); DELETEITEMSTRUCT16* dis16 = (DELETEITEMSTRUCT16 *)PTR_SEG_TO_LIN(*plparam);
DELETEITEMSTRUCT *dis = (DELETEITEMSTRUCT *) DELETEITEMSTRUCT *dis = (DELETEITEMSTRUCT *)
HeapAlloc(SystemHeap, 0, sizeof(*dis)); HeapAlloc(GetProcessHeap(), 0, sizeof(*dis));
if (!dis) return -1; if (!dis) return -1;
dis->CtlType = dis16->CtlType; dis->CtlType = dis16->CtlType;
dis->CtlID = dis16->CtlID; dis->CtlID = dis16->CtlID;
@ -1028,7 +1028,7 @@ INT WINPROC_MapMsg16To32A( UINT16 msg16, WPARAM16 wParam16, UINT *pmsg32,
{ {
MEASUREITEMSTRUCT16* mis16 = (MEASUREITEMSTRUCT16 *)PTR_SEG_TO_LIN(*plparam); MEASUREITEMSTRUCT16* mis16 = (MEASUREITEMSTRUCT16 *)PTR_SEG_TO_LIN(*plparam);
MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *) MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *)
HeapAlloc(SystemHeap, 0, HeapAlloc(GetProcessHeap(), 0,
sizeof(*mis) + sizeof(LPARAM)); sizeof(*mis) + sizeof(LPARAM));
if (!mis) return -1; if (!mis) return -1;
mis->CtlType = mis16->CtlType; mis->CtlType = mis16->CtlType;
@ -1044,7 +1044,7 @@ INT WINPROC_MapMsg16To32A( UINT16 msg16, WPARAM16 wParam16, UINT *pmsg32,
case WM_DRAWITEM: case WM_DRAWITEM:
{ {
DRAWITEMSTRUCT16* dis16 = (DRAWITEMSTRUCT16 *)PTR_SEG_TO_LIN(*plparam); DRAWITEMSTRUCT16* dis16 = (DRAWITEMSTRUCT16 *)PTR_SEG_TO_LIN(*plparam);
DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT*)HeapAlloc(SystemHeap, 0, DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT*)HeapAlloc(GetProcessHeap(), 0,
sizeof(*dis)); sizeof(*dis));
if (!dis) return -1; if (!dis) return -1;
dis->CtlType = dis16->CtlType; dis->CtlType = dis16->CtlType;
@ -1061,7 +1061,7 @@ INT WINPROC_MapMsg16To32A( UINT16 msg16, WPARAM16 wParam16, UINT *pmsg32,
return 1; return 1;
case WM_GETMINMAXINFO: case WM_GETMINMAXINFO:
{ {
MINMAXINFO *mmi = (MINMAXINFO *)HeapAlloc( SystemHeap, 0, MINMAXINFO *mmi = (MINMAXINFO *)HeapAlloc( GetProcessHeap(), 0,
sizeof(*mmi) + sizeof(LPARAM)); sizeof(*mmi) + sizeof(LPARAM));
if (!mmi) return -1; if (!mmi) return -1;
STRUCT32_MINMAXINFO16to32( (MINMAXINFO16*)PTR_SEG_TO_LIN(*plparam), STRUCT32_MINMAXINFO16to32( (MINMAXINFO16*)PTR_SEG_TO_LIN(*plparam),
@ -1079,7 +1079,7 @@ INT WINPROC_MapMsg16To32A( UINT16 msg16, WPARAM16 wParam16, UINT *pmsg32,
MDICREATESTRUCT16 *cs16 = MDICREATESTRUCT16 *cs16 =
(MDICREATESTRUCT16 *)PTR_SEG_TO_LIN(*plparam); (MDICREATESTRUCT16 *)PTR_SEG_TO_LIN(*plparam);
MDICREATESTRUCTA *cs = MDICREATESTRUCTA *cs =
(MDICREATESTRUCTA *)HeapAlloc( SystemHeap, 0, (MDICREATESTRUCTA *)HeapAlloc( GetProcessHeap(), 0,
sizeof(*cs) + sizeof(LPARAM) ); sizeof(*cs) + sizeof(LPARAM) );
if (!cs) return -1; if (!cs) return -1;
STRUCT32_MDICREATESTRUCT16to32A( cs16, cs ); STRUCT32_MDICREATESTRUCT16to32A( cs16, cs );
@ -1090,7 +1090,7 @@ INT WINPROC_MapMsg16To32A( UINT16 msg16, WPARAM16 wParam16, UINT *pmsg32,
} }
return 1; return 1;
case WM_MDIGETACTIVE: case WM_MDIGETACTIVE:
*plparam = (LPARAM)HeapAlloc( SystemHeap, 0, sizeof(BOOL) ); *plparam = (LPARAM)HeapAlloc( GetProcessHeap(), 0, sizeof(BOOL) );
*(BOOL*)(*plparam) = 0; *(BOOL*)(*plparam) = 0;
return 1; return 1;
case WM_MDISETMENU: case WM_MDISETMENU:
@ -1128,14 +1128,14 @@ INT WINPROC_MapMsg16To32A( UINT16 msg16, WPARAM16 wParam16, UINT *pmsg32,
NCCALCSIZE_PARAMS16 *nc16; NCCALCSIZE_PARAMS16 *nc16;
NCCALCSIZE_PARAMS *nc; NCCALCSIZE_PARAMS *nc;
nc = (NCCALCSIZE_PARAMS *)HeapAlloc( SystemHeap, 0, nc = (NCCALCSIZE_PARAMS *)HeapAlloc( GetProcessHeap(), 0,
sizeof(*nc) + sizeof(LPARAM) ); sizeof(*nc) + sizeof(LPARAM) );
if (!nc) return -1; if (!nc) return -1;
nc16 = (NCCALCSIZE_PARAMS16 *)PTR_SEG_TO_LIN(*plparam); nc16 = (NCCALCSIZE_PARAMS16 *)PTR_SEG_TO_LIN(*plparam);
CONV_RECT16TO32( &nc16->rgrc[0], &nc->rgrc[0] ); CONV_RECT16TO32( &nc16->rgrc[0], &nc->rgrc[0] );
if (wParam16) if (wParam16)
{ {
nc->lppos = (WINDOWPOS *)HeapAlloc( SystemHeap, 0, nc->lppos = (WINDOWPOS *)HeapAlloc( GetProcessHeap(), 0,
sizeof(*nc->lppos) ); sizeof(*nc->lppos) );
CONV_RECT16TO32( &nc16->rgrc[1], &nc->rgrc[1] ); CONV_RECT16TO32( &nc16->rgrc[1], &nc->rgrc[1] );
CONV_RECT16TO32( &nc16->rgrc[2], &nc->rgrc[2] ); CONV_RECT16TO32( &nc16->rgrc[2], &nc->rgrc[2] );
@ -1149,7 +1149,7 @@ INT WINPROC_MapMsg16To32A( UINT16 msg16, WPARAM16 wParam16, UINT *pmsg32,
case WM_CREATE: case WM_CREATE:
{ {
CREATESTRUCT16 *cs16 = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(*plparam); CREATESTRUCT16 *cs16 = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(*plparam);
CREATESTRUCTA *cs = (CREATESTRUCTA *)HeapAlloc( SystemHeap, 0, CREATESTRUCTA *cs = (CREATESTRUCTA *)HeapAlloc( GetProcessHeap(), 0,
sizeof(*cs) + sizeof(LPARAM) ); sizeof(*cs) + sizeof(LPARAM) );
if (!cs) return -1; if (!cs) return -1;
STRUCT32_CREATESTRUCT16to32A( cs16, cs ); STRUCT32_CREATESTRUCT16to32A( cs16, cs );
@ -1169,7 +1169,7 @@ INT WINPROC_MapMsg16To32A( UINT16 msg16, WPARAM16 wParam16, UINT *pmsg32,
case WM_WINDOWPOSCHANGING: case WM_WINDOWPOSCHANGING:
case WM_WINDOWPOSCHANGED: case WM_WINDOWPOSCHANGED:
{ {
WINDOWPOS *wp = (WINDOWPOS *)HeapAlloc( SystemHeap, 0, WINDOWPOS *wp = (WINDOWPOS *)HeapAlloc( GetProcessHeap(), 0,
sizeof(*wp) + sizeof(LPARAM) ); sizeof(*wp) + sizeof(LPARAM) );
if (!wp) return -1; if (!wp) return -1;
STRUCT32_WINDOWPOS16to32( (WINDOWPOS16 *)PTR_SEG_TO_LIN(*plparam), STRUCT32_WINDOWPOS16to32( (WINDOWPOS16 *)PTR_SEG_TO_LIN(*plparam),
@ -1182,7 +1182,7 @@ INT WINPROC_MapMsg16To32A( UINT16 msg16, WPARAM16 wParam16, UINT *pmsg32,
if (*plparam) if (*plparam)
{ {
LPMSG16 msg16 = (LPMSG16)PTR_SEG_TO_LIN(*plparam); LPMSG16 msg16 = (LPMSG16)PTR_SEG_TO_LIN(*plparam);
LPMSG msg32 = (LPMSG)HeapAlloc( SystemHeap, 0, sizeof(MSG) ); LPMSG msg32 = (LPMSG)HeapAlloc( GetProcessHeap(), 0, sizeof(MSG) );
if (!msg32) return -1; if (!msg32) return -1;
msg32->hwnd = msg16->hwnd; msg32->hwnd = msg16->hwnd;
@ -1193,7 +1193,7 @@ INT WINPROC_MapMsg16To32A( UINT16 msg16, WPARAM16 wParam16, UINT *pmsg32,
if (WINPROC_MapMsg16To32A(msg16->message,msg16->wParam, if (WINPROC_MapMsg16To32A(msg16->message,msg16->wParam,
&msg32->message,&msg32->wParam, &msg32->message,&msg32->wParam,
&msg32->lParam)<0) { &msg32->lParam)<0) {
HeapFree( SystemHeap, 0, msg32 ); HeapFree( GetProcessHeap(), 0, msg32 );
return -1; return -1;
} }
*plparam = (LPARAM)msg32; *plparam = (LPARAM)msg32;
@ -1241,7 +1241,7 @@ LRESULT WINPROC_UnmapMsg16To32A( HWND16 hwnd, UINT msg, WPARAM wParam, LPARAM lP
case WM_COMPAREITEM: case WM_COMPAREITEM:
case WM_DELETEITEM: case WM_DELETEITEM:
case WM_DRAWITEM: case WM_DRAWITEM:
HeapFree( SystemHeap, 0, (LPVOID)lParam ); HeapFree( GetProcessHeap(), 0, (LPVOID)lParam );
break; break;
case WM_MEASUREITEM: case WM_MEASUREITEM:
{ {
@ -1251,7 +1251,7 @@ LRESULT WINPROC_UnmapMsg16To32A( HWND16 hwnd, UINT msg, WPARAM wParam, LPARAM lP
mis16 = (MEASUREITEMSTRUCT16 *)PTR_SEG_TO_LIN(lParam); mis16 = (MEASUREITEMSTRUCT16 *)PTR_SEG_TO_LIN(lParam);
mis16->itemWidth = (UINT16)mis->itemWidth; mis16->itemWidth = (UINT16)mis->itemWidth;
mis16->itemHeight = (UINT16)mis->itemHeight; mis16->itemHeight = (UINT16)mis->itemHeight;
HeapFree( SystemHeap, 0, mis ); HeapFree( GetProcessHeap(), 0, mis );
} }
break; break;
case WM_GETMINMAXINFO: case WM_GETMINMAXINFO:
@ -1260,7 +1260,7 @@ LRESULT WINPROC_UnmapMsg16To32A( HWND16 hwnd, UINT msg, WPARAM wParam, LPARAM lP
lParam = *(LPARAM *)(mmi + 1); lParam = *(LPARAM *)(mmi + 1);
STRUCT32_MINMAXINFO32to16( mmi, STRUCT32_MINMAXINFO32to16( mmi,
(MINMAXINFO16 *)PTR_SEG_TO_LIN(lParam)); (MINMAXINFO16 *)PTR_SEG_TO_LIN(lParam));
HeapFree( SystemHeap, 0, mmi ); HeapFree( GetProcessHeap(), 0, mmi );
} }
break; break;
case WM_MDICREATE: case WM_MDICREATE:
@ -1269,12 +1269,12 @@ LRESULT WINPROC_UnmapMsg16To32A( HWND16 hwnd, UINT msg, WPARAM wParam, LPARAM lP
lParam = *(LPARAM *)(cs + 1); lParam = *(LPARAM *)(cs + 1);
STRUCT32_MDICREATESTRUCT32Ato16( cs, STRUCT32_MDICREATESTRUCT32Ato16( cs,
(MDICREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam) ); (MDICREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam) );
HeapFree( SystemHeap, 0, cs ); HeapFree( GetProcessHeap(), 0, cs );
} }
break; break;
case WM_MDIGETACTIVE: case WM_MDIGETACTIVE:
result = MAKELONG( LOWORD(result), (BOOL16)(*(BOOL *)lParam) ); result = MAKELONG( LOWORD(result), (BOOL16)(*(BOOL *)lParam) );
HeapFree( SystemHeap, 0, (BOOL *)lParam ); HeapFree( GetProcessHeap(), 0, (BOOL *)lParam );
break; break;
case WM_NCCALCSIZE: case WM_NCCALCSIZE:
{ {
@ -1291,10 +1291,10 @@ LRESULT WINPROC_UnmapMsg16To32A( HWND16 hwnd, UINT msg, WPARAM wParam, LPARAM lP
{ {
STRUCT32_WINDOWPOS32to16( nc->lppos, STRUCT32_WINDOWPOS32to16( nc->lppos,
(WINDOWPOS16 *)PTR_SEG_TO_LIN(nc16->lppos)); (WINDOWPOS16 *)PTR_SEG_TO_LIN(nc16->lppos));
HeapFree( SystemHeap, 0, nc->lppos ); HeapFree( GetProcessHeap(), 0, nc->lppos );
} }
} }
HeapFree( SystemHeap, 0, nc ); HeapFree( GetProcessHeap(), 0, nc );
} }
break; break;
case WM_NCCREATE: case WM_NCCREATE:
@ -1304,7 +1304,7 @@ LRESULT WINPROC_UnmapMsg16To32A( HWND16 hwnd, UINT msg, WPARAM wParam, LPARAM lP
lParam = *(LPARAM *)(cs + 1); lParam = *(LPARAM *)(cs + 1);
STRUCT32_CREATESTRUCT32Ato16( cs, STRUCT32_CREATESTRUCT32Ato16( cs,
(CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam) ); (CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam) );
HeapFree( SystemHeap, 0, cs ); HeapFree( GetProcessHeap(), 0, cs );
} }
break; break;
case WM_WINDOWPOSCHANGING: case WM_WINDOWPOSCHANGING:
@ -1313,7 +1313,7 @@ LRESULT WINPROC_UnmapMsg16To32A( HWND16 hwnd, UINT msg, WPARAM wParam, LPARAM lP
WINDOWPOS *wp = (WINDOWPOS *)lParam; WINDOWPOS *wp = (WINDOWPOS *)lParam;
lParam = *(LPARAM *)(wp + 1); lParam = *(LPARAM *)(wp + 1);
STRUCT32_WINDOWPOS32to16(wp,(WINDOWPOS16 *)PTR_SEG_TO_LIN(lParam)); STRUCT32_WINDOWPOS32to16(wp,(WINDOWPOS16 *)PTR_SEG_TO_LIN(lParam));
HeapFree( SystemHeap, 0, wp ); HeapFree( GetProcessHeap(), 0, wp );
} }
break; break;
case WM_GETDLGCODE: case WM_GETDLGCODE:
@ -1323,7 +1323,7 @@ LRESULT WINPROC_UnmapMsg16To32A( HWND16 hwnd, UINT msg, WPARAM wParam, LPARAM lP
WINPROC_UnmapMsg16To32A( hwnd, msg32->message, msg32->wParam, msg32->lParam, WINPROC_UnmapMsg16To32A( hwnd, msg32->message, msg32->wParam, msg32->lParam,
result); result);
HeapFree( SystemHeap, 0, msg32 ); HeapFree( GetProcessHeap(), 0, msg32 );
} }
break; break;
} }
@ -1350,17 +1350,17 @@ INT WINPROC_MapMsg16To32W( HWND16 hwnd, UINT16 msg16, WPARAM16 wParam16, UINT *p
case WM_CREATE: case WM_CREATE:
{ {
CREATESTRUCT16 *cs16 = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(*plparam); CREATESTRUCT16 *cs16 = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(*plparam);
CREATESTRUCTW *cs = (CREATESTRUCTW *)HeapAlloc( SystemHeap, 0, CREATESTRUCTW *cs = (CREATESTRUCTW *)HeapAlloc( GetProcessHeap(), 0,
sizeof(*cs) + sizeof(LPARAM) ); sizeof(*cs) + sizeof(LPARAM) );
if (!cs) return -1; if (!cs) return -1;
STRUCT32_CREATESTRUCT16to32A( cs16, (CREATESTRUCTA *)cs ); STRUCT32_CREATESTRUCT16to32A( cs16, (CREATESTRUCTA *)cs );
cs->lpszName = (LPCWSTR)PTR_SEG_TO_LIN(cs16->lpszName); cs->lpszName = (LPCWSTR)PTR_SEG_TO_LIN(cs16->lpszName);
cs->lpszClass = (LPCWSTR)PTR_SEG_TO_LIN(cs16->lpszClass); cs->lpszClass = (LPCWSTR)PTR_SEG_TO_LIN(cs16->lpszClass);
if (HIWORD(cs->lpszName)) if (HIWORD(cs->lpszName))
cs->lpszName = HEAP_strdupAtoW( SystemHeap, 0, cs->lpszName = HEAP_strdupAtoW( GetProcessHeap(), 0,
(LPCSTR)cs->lpszName ); (LPCSTR)cs->lpszName );
if (HIWORD(cs->lpszClass)) if (HIWORD(cs->lpszClass))
cs->lpszClass = HEAP_strdupAtoW( SystemHeap, 0, cs->lpszClass = HEAP_strdupAtoW( GetProcessHeap(), 0,
(LPCSTR)cs->lpszClass ); (LPCSTR)cs->lpszClass );
*(LPARAM *)(cs + 1) = *plparam; /* Store the previous lParam */ *(LPARAM *)(cs + 1) = *plparam; /* Store the previous lParam */
*plparam = (LPARAM)cs; *plparam = (LPARAM)cs;
@ -1371,17 +1371,17 @@ INT WINPROC_MapMsg16To32W( HWND16 hwnd, UINT16 msg16, WPARAM16 wParam16, UINT *p
MDICREATESTRUCT16 *cs16 = MDICREATESTRUCT16 *cs16 =
(MDICREATESTRUCT16 *)PTR_SEG_TO_LIN(*plparam); (MDICREATESTRUCT16 *)PTR_SEG_TO_LIN(*plparam);
MDICREATESTRUCTW *cs = MDICREATESTRUCTW *cs =
(MDICREATESTRUCTW *)HeapAlloc( SystemHeap, 0, (MDICREATESTRUCTW *)HeapAlloc( GetProcessHeap(), 0,
sizeof(*cs) + sizeof(LPARAM) ); sizeof(*cs) + sizeof(LPARAM) );
if (!cs) return -1; if (!cs) return -1;
STRUCT32_MDICREATESTRUCT16to32A( cs16, (MDICREATESTRUCTA *)cs ); STRUCT32_MDICREATESTRUCT16to32A( cs16, (MDICREATESTRUCTA *)cs );
cs->szTitle = (LPCWSTR)PTR_SEG_TO_LIN(cs16->szTitle); cs->szTitle = (LPCWSTR)PTR_SEG_TO_LIN(cs16->szTitle);
cs->szClass = (LPCWSTR)PTR_SEG_TO_LIN(cs16->szClass); cs->szClass = (LPCWSTR)PTR_SEG_TO_LIN(cs16->szClass);
if (HIWORD(cs->szTitle)) if (HIWORD(cs->szTitle))
cs->szTitle = HEAP_strdupAtoW( SystemHeap, 0, cs->szTitle = HEAP_strdupAtoW( GetProcessHeap(), 0,
(LPCSTR)cs->szTitle ); (LPCSTR)cs->szTitle );
if (HIWORD(cs->szClass)) if (HIWORD(cs->szClass))
cs->szClass = HEAP_strdupAtoW( SystemHeap, 0, cs->szClass = HEAP_strdupAtoW( GetProcessHeap(), 0,
(LPCSTR)cs->szClass ); (LPCSTR)cs->szClass );
*(LPARAM *)(cs + 1) = *plparam; /* Store the previous lParam */ *(LPARAM *)(cs + 1) = *plparam; /* Store the previous lParam */
*plparam = (LPARAM)cs; *plparam = (LPARAM)cs;
@ -1391,7 +1391,7 @@ INT WINPROC_MapMsg16To32W( HWND16 hwnd, UINT16 msg16, WPARAM16 wParam16, UINT *p
if (*plparam) if (*plparam)
{ {
LPMSG16 msg16 = (LPMSG16)PTR_SEG_TO_LIN(*plparam); LPMSG16 msg16 = (LPMSG16)PTR_SEG_TO_LIN(*plparam);
LPMSG msg32 = (LPMSG)HeapAlloc( SystemHeap, 0, sizeof(MSG) ); LPMSG msg32 = (LPMSG)HeapAlloc( GetProcessHeap(), 0, sizeof(MSG) );
if (!msg32) return -1; if (!msg32) return -1;
msg32->hwnd = msg16->hwnd; msg32->hwnd = msg16->hwnd;
@ -1402,7 +1402,7 @@ INT WINPROC_MapMsg16To32W( HWND16 hwnd, UINT16 msg16, WPARAM16 wParam16, UINT *p
if (WINPROC_MapMsg16To32W(hwnd, msg16->message,msg16->wParam, if (WINPROC_MapMsg16To32W(hwnd, msg16->message,msg16->wParam,
&msg32->message,&msg32->wParam, &msg32->message,&msg32->wParam,
&msg32->lParam)<0) { &msg32->lParam)<0) {
HeapFree( SystemHeap, 0, msg32 ); HeapFree( GetProcessHeap(), 0, msg32 );
return -1; return -1;
} }
*plparam = (LPARAM)msg32; *plparam = (LPARAM)msg32;
@ -1438,10 +1438,10 @@ LRESULT WINPROC_UnmapMsg16To32W( HWND16 hwnd, UINT msg, WPARAM wParam, LPARAM lP
STRUCT32_CREATESTRUCT32Ato16( (CREATESTRUCTA *)cs, STRUCT32_CREATESTRUCT32Ato16( (CREATESTRUCTA *)cs,
(CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam) ); (CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam) );
if (HIWORD(cs->lpszName)) if (HIWORD(cs->lpszName))
HeapFree( SystemHeap, 0, (LPVOID)cs->lpszName ); HeapFree( GetProcessHeap(), 0, (LPVOID)cs->lpszName );
if (HIWORD(cs->lpszClass)) if (HIWORD(cs->lpszClass))
HeapFree( SystemHeap, 0, (LPVOID)cs->lpszClass ); HeapFree( GetProcessHeap(), 0, (LPVOID)cs->lpszClass );
HeapFree( SystemHeap, 0, cs ); HeapFree( GetProcessHeap(), 0, cs );
} }
break; break;
case WM_MDICREATE: case WM_MDICREATE:
@ -1451,10 +1451,10 @@ LRESULT WINPROC_UnmapMsg16To32W( HWND16 hwnd, UINT msg, WPARAM wParam, LPARAM lP
STRUCT32_MDICREATESTRUCT32Ato16( (MDICREATESTRUCTA *)cs, STRUCT32_MDICREATESTRUCT32Ato16( (MDICREATESTRUCTA *)cs,
(MDICREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam) ); (MDICREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam) );
if (HIWORD(cs->szTitle)) if (HIWORD(cs->szTitle))
HeapFree( SystemHeap, 0, (LPVOID)cs->szTitle ); HeapFree( GetProcessHeap(), 0, (LPVOID)cs->szTitle );
if (HIWORD(cs->szClass)) if (HIWORD(cs->szClass))
HeapFree( SystemHeap, 0, (LPVOID)cs->szClass ); HeapFree( GetProcessHeap(), 0, (LPVOID)cs->szClass );
HeapFree( SystemHeap, 0, cs ); HeapFree( GetProcessHeap(), 0, cs );
} }
break; break;
case WM_GETDLGCODE: case WM_GETDLGCODE:
@ -1464,7 +1464,7 @@ LRESULT WINPROC_UnmapMsg16To32W( HWND16 hwnd, UINT msg, WPARAM wParam, LPARAM lP
WINPROC_UnmapMsg16To32W( hwnd, msg32->message, msg32->wParam, msg32->lParam, WINPROC_UnmapMsg16To32W( hwnd, msg32->message, msg32->wParam, msg32->lParam,
result); result);
HeapFree( SystemHeap, 0, msg32 ); HeapFree( GetProcessHeap(), 0, msg32 );
} }
break; break;
default: default: