pkg://wine-990704-1.src.rpm:3624176/Wine-990704.tar.gz
info downloads
wine-990704/ 40755 771 771 0 6737705671 12402 5 ustar julliard julliard wine-990704/dlls/ 40755 771 771 0 6737705664 13342 5 ustar julliard julliard wine-990704/dlls/ver/ 40755 771 771 0 6737705664 14136 5 ustar julliard julliard wine-990704/dlls/ver/.cvsignore 100644 771 771 11 6655025652 16152 0 ustar julliard julliard Makefile
wine-990704/dlls/ver/Makefile.in 100644 771 771 317 6655025652 16250 0 ustar julliard julliard DEFS = @DLLFLAGS@ -D__WINE__
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = ver
C_SRCS = \
ver16.c
all: $(MODULE).o
@MAKE_RULES@
### Dependencies:
wine-990704/dlls/ver/ver16.c 100644 771 771 12107 6723746133 15352 0 ustar julliard julliard /*
* Implementation of VER.DLL
*
* Copyright 1999 Ulrich Weigand
*/
#include "winbase.h"
#include "winver.h"
#include "ldt.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(ver)
/*************************************************************************
* GetFileResourceSize16 [VER.2]
*/
DWORD WINAPI GetFileResourceSize16( LPCSTR lpszFileName,
SEGPTR spszResType, SEGPTR spszResId,
LPDWORD lpdwFileOffset )
{
LPCSTR lpszResType = HIWORD( spszResType )? PTR_SEG_TO_LIN( spszResType )
: (LPCSTR)spszResType;
LPCSTR lpszResId = HIWORD( spszResId )? PTR_SEG_TO_LIN( spszResId )
: (LPCSTR)spszResId;
return GetFileResourceSize( lpszFileName,
lpszResType, lpszResId, lpdwFileOffset );
}
/*************************************************************************
* GetFileResource16 [VER.3]
*/
DWORD WINAPI GetFileResource16( LPCSTR lpszFileName,
SEGPTR spszResType, SEGPTR spszResId,
DWORD dwFileOffset,
DWORD dwResLen, LPVOID lpvData )
{
LPCSTR lpszResType = HIWORD( spszResType )? PTR_SEG_TO_LIN( spszResType )
: (LPCSTR)spszResType;
LPCSTR lpszResId = HIWORD( spszResId )? PTR_SEG_TO_LIN( spszResId )
: (LPCSTR)spszResId;
return GetFileResource( lpszFileName, lpszResType, lpszResId,
dwFileOffset, dwResLen, lpvData );
}
/*************************************************************************
* GetFileVersionInfoSize16 [VER.6]
*/
DWORD WINAPI GetFileVersionInfoSize16( LPCSTR lpszFileName, LPDWORD lpdwHandle )
{
TRACE("(%s, %p)\n", debugstr_a(lpszFileName), lpdwHandle );
return GetFileVersionInfoSizeA( lpszFileName, lpdwHandle );
}
/*************************************************************************
* GetFileVersionInfo16 [VER.7]
*/
DWORD WINAPI GetFileVersionInfo16( LPCSTR lpszFileName, DWORD handle,
DWORD cbBuf, LPVOID lpvData )
{
TRACE("(%s, %08lx, %ld, %p)\n",
debugstr_a(lpszFileName), handle, cbBuf, lpvData );
return GetFileVersionInfoA( lpszFileName, handle, cbBuf, lpvData );
}
/*************************************************************************
* VerFindFile16 [VER.8]
*/
DWORD WINAPI VerFindFile16( UINT16 flags, LPCSTR lpszFilename,
LPCSTR lpszWinDir, LPCSTR lpszAppDir,
LPSTR lpszCurDir, UINT16 *lpuCurDirLen,
LPSTR lpszDestDir, UINT16 *lpuDestDirLen )
{
UINT curDirLen, destDirLen;
DWORD retv = VerFindFileA( flags, lpszFilename, lpszWinDir, lpszAppDir,
lpszCurDir, &curDirLen, lpszDestDir, &destDirLen );
*lpuCurDirLen = (UINT16)curDirLen;
*lpuDestDirLen = (UINT16)destDirLen;
return retv;
}
/*************************************************************************
* VerInstallFile16 [VER.9]
*/
DWORD WINAPI VerInstallFile16( UINT16 flags,
LPCSTR lpszSrcFilename, LPCSTR lpszDestFilename,
LPCSTR lpszSrcDir, LPCSTR lpszDestDir, LPCSTR lpszCurDir,
LPSTR lpszTmpFile, UINT16 *lpwTmpFileLen )
{
UINT filelen;
DWORD retv = VerInstallFileA( flags, lpszSrcFilename, lpszDestFilename,
lpszSrcDir, lpszDestDir, lpszCurDir,
lpszTmpFile, &filelen);
*lpwTmpFileLen = (UINT16)filelen;
return retv;
}
/*************************************************************************
* VerLanguageName16 [VER.10]
*/
DWORD WINAPI VerLanguageName16( UINT16 uLang, LPSTR lpszLang, UINT16 cbLang )
{
return VerLanguageNameA( uLang, lpszLang, cbLang );
}
/*************************************************************************
* VerQueryValue16 [VER.11]
*/
DWORD WINAPI VerQueryValue16( SEGPTR spvBlock, LPCSTR lpszSubBlock,
SEGPTR *lpspBuffer, UINT16 *lpcb )
{
LPVOID lpvBlock = PTR_SEG_TO_LIN( spvBlock );
LPVOID buffer = lpvBlock;
UINT buflen;
DWORD retv;
TRACE("(%p, %s, %p, %p)\n",
lpvBlock, debugstr_a(lpszSubBlock), lpspBuffer, lpcb );
retv = VerQueryValueA( lpvBlock, lpszSubBlock, &buffer, &buflen );
if ( !retv ) return FALSE;
if ( OFFSETOF( spvBlock ) + ((char *) buffer - (char *) lpvBlock) >= 0x10000 )
{
FIXME("offset %08X too large relative to %04X:%04X\n",
(char *) buffer - (char *) lpvBlock, SELECTOROF( spvBlock ), OFFSETOF( spvBlock ) );
return FALSE;
}
*lpcb = buflen;
*lpspBuffer = (SEGPTR) ((char *) spvBlock + ((char *) buffer - (char *) lpvBlock));
return retv;
}
wine-990704/dlls/.cvsignore 100644 771 771 11 6605734113 15350 0 ustar julliard julliard Makefile
wine-990704/dlls/Makefile.in 100644 771 771 1040 6672726321 15466 0 ustar julliard julliard SUBDIRS = \
advapi32 \
avifil32 \
comctl32 \
commdlg \
imagehlp \
msacm \
msacm32 \
ntdll \
psapi \
shell32 \
tapi32 \
ver \
version \
winaspi \
wnaspi32
all: $(SUBDIRS)
$(SUBDIRS): dummy
@cd $@; $(MAKE)
depend:
for i in $(SUBDIRS); do (cd $$i && $(MAKE) depend) || exit 1; done
install:
for i in $(SUBDIRS); do (cd $$i && $(MAKE) install) || exit 1; done
uninstall:
for i in $(SUBDIRS); do (cd $$i && $(MAKE) uninstall) || exit 1; done
clean:
for i in $(SUBDIRS); do (cd $$i && $(MAKE) clean) || exit 1; done
dummy:
wine-990704/dlls/advapi32/ 40755 771 771 0 6737705664 14753 5 ustar julliard julliard wine-990704/dlls/advapi32/.cvsignore 100644 771 771 11 6643663435 16773 0 ustar julliard julliard Makefile
wine-990704/dlls/advapi32/Makefile.in 100644 771 771 457 6661240421 17060 0 ustar julliard julliard DEFS = @DLLFLAGS@ -D__WINE__
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = advapi32
C_SRCS = \
advapi.c \
crypt.c \
eventlog.c \
security.c \
service.c
all: check_wrc $(MODULE).o
@MAKE_RULES@
$(RC_SRCS:.rc=.s): $(WRC)
### Dependencies:
wine-990704/dlls/advapi32/advapi.c 100644 771 771 2253 6737431746 16457 0 ustar julliard julliard /*
* Win32 advapi functions
*
* Copyright 1995 Sven Verdoolaege
*/
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include "winbase.h"
#include "windef.h"
#include "winerror.h"
#include "wine/winestring.h"
#include "debugtools.h"
/******************************************************************************
* GetUserName32A [ADVAPI32.67]
*/
BOOL WINAPI
GetUserNameA( LPSTR lpszName, LPDWORD lpSize )
{
size_t len;
char *name;
name=getlogin();
#if 0
/* FIXME: should use getpwuid() here */
if (!name) name=cuserid(NULL);
#endif
len = name ? strlen(name) : 0;
if (!len || !lpSize || len > *lpSize) {
if (lpszName) *lpszName = 0;
return 0;
}
*lpSize=len;
strcpy(lpszName, name);
return 1;
}
/******************************************************************************
* GetUserName32W [ADVAPI32.68]
*
* PARAMS
* lpszName []
* lpSize []
*/
BOOL WINAPI
GetUserNameW( LPWSTR lpszName, LPDWORD lpSize )
{
LPSTR name = (LPSTR)HeapAlloc( GetProcessHeap(), 0, *lpSize );
DWORD size = *lpSize;
BOOL res = GetUserNameA(name,lpSize);
lstrcpynAtoW(lpszName,name,size);
HeapFree( GetProcessHeap(), 0, name );
return res;
}
wine-990704/dlls/advapi32/crypt.c 100644 771 771 1521 6716756013 16343 0 ustar julliard julliard /*
* dlls/advapi32/crypt.c
*/
#include "windef.h"
#include "winerror.h"
#include "wincrypt.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(advapi)
/******************************************************************************
* CryptAcquireContextA
* Acquire a crypto provider context handle.
*
* PARAMS
* phProv: Pointer to HCRYPTPROV for the output.
* pszContainer: FIXME (unknown)
* pszProvider: FIXME (unknown)
* dwProvType: Crypto provider type to get a handle.
* dwFlags: flags for the operation
*
* RETURNS TRUE on success, FALSE on failure.
*/
BOOL WINAPI
CryptAcquireContextA( HCRYPTPROV *phProv, LPCSTR pszContainer,
LPCSTR pszProvider, DWORD dwProvType, DWORD dwFlags)
{
FIXME_(advapi)("(%p, %s, %s, %ld, %08lx): stub!\n", phProv, pszContainer,
pszProvider, dwProvType, dwFlags);
return FALSE;
}
wine-990704/dlls/advapi32/eventlog.c 100644 771 771 15013 6737637401 17050 0 ustar julliard julliard /*
* Win32 advapi functions
*
* Copyright 1995 Sven Verdoolaege, 1998 Juergen Schmied
*/
#include "winbase.h"
#include "windef.h"
#include "winerror.h"
#include "heap.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(advapi)
/******************************************************************************
* BackupEventLog32A [ADVAPI32.15]
*/
BOOL WINAPI BackupEventLogA( HANDLE hEventLog, LPCSTR lpBackupFileName )
{
FIXME("stub\n");
return TRUE;
}
/******************************************************************************
* BackupEventLog32W [ADVAPI32.16]
*
* PARAMS
* hEventLog []
* lpBackupFileName []
*/
BOOL WINAPI
BackupEventLogW( HANDLE hEventLog, LPCWSTR lpBackupFileName )
{
FIXME("stub\n");
return TRUE;
}
/******************************************************************************
* ClearEventLog32A [ADVAPI32.19]
*/
BOOL WINAPI ClearEventLogA ( HANDLE hEventLog, LPCSTR lpBackupFileName )
{
FIXME("stub\n");
return TRUE;
}
/******************************************************************************
* ClearEventLog32W [ADVAPI32.20]
*/
BOOL WINAPI ClearEventLogW ( HANDLE hEventLog, LPCWSTR lpBackupFileName )
{
FIXME("stub\n");
return TRUE;
}
/******************************************************************************
* CloseEventLog32 [ADVAPI32.21]
*/
BOOL WINAPI CloseEventLog ( HANDLE hEventLog )
{
FIXME("stub\n");
return TRUE;
}
/******************************************************************************
* DeregisterEventSource32 [ADVAPI32.32]
* Closes a handle to the specified event log
*
* PARAMS
* hEventLog [I] Handle to event log
*
* RETURNS STD
*/
BOOL WINAPI DeregisterEventSource( HANDLE hEventLog )
{
FIXME("(%d): stub\n",hEventLog);
return TRUE;
}
/******************************************************************************
* GetNumberOfEventLogRecords32 [ADVAPI32.49]
*
* PARAMS
* hEventLog []
* NumberOfRecords []
*/
BOOL WINAPI
GetNumberOfEventLogRecords( HANDLE hEventLog, PDWORD NumberOfRecords )
{
FIXME("stub\n");
return TRUE;
}
/******************************************************************************
* GetOldestEventLogRecord32 [ADVAPI32.50]
*
* PARAMS
* hEventLog []
* OldestRecord []
*/
BOOL WINAPI
GetOldestEventLogRecord( HANDLE hEventLog, PDWORD OldestRecord )
{
FIXME(":stub\n");
return TRUE;
}
/******************************************************************************
* NotifyChangeEventLog32 [ADVAPI32.98]
*
* PARAMS
* hEventLog []
* hEvent []
*/
BOOL WINAPI NotifyChangeEventLog( HANDLE hEventLog, HANDLE hEvent )
{
FIXME("stub\n");
return TRUE;
}
/******************************************************************************
* OpenBackupEventLog32A [ADVAPI32.105]
*/
HANDLE WINAPI
OpenBackupEventLogA( LPCSTR lpUNCServerName, LPCSTR lpFileName )
{
FIXME("stub\n");
return TRUE;
}
/******************************************************************************
* OpenBackupEventLog32W [ADVAPI32.106]
*
* PARAMS
* lpUNCServerName []
* lpFileName []
*/
HANDLE WINAPI
OpenBackupEventLogW( LPCWSTR lpUNCServerName, LPCWSTR lpFileName )
{
FIXME("stub\n");
return TRUE;
}
/******************************************************************************
* OpenEventLog32A [ADVAPI32.107]
*/
HANDLE WINAPI OpenEventLogA(LPCSTR uncname,LPCSTR source)
{
FIXME("(%s,%s),stub!\n",uncname,source);
return 0xcafe4242;
}
/******************************************************************************
* OpenEventLog32W [ADVAPI32.108]
*
* PARAMS
* uncname []
* source []
*/
HANDLE WINAPI
OpenEventLogW( LPCWSTR uncname, LPCWSTR source )
{
FIXME("stub\n");
return TRUE;
}
/******************************************************************************
* ReadEventLog32A [ADVAPI32.124]
*/
BOOL WINAPI ReadEventLogA( HANDLE hEventLog, DWORD dwReadFlags, DWORD dwRecordOffset,
LPVOID lpBuffer, DWORD nNumberOfBytesToRead, DWORD *pnBytesRead, DWORD *pnMinNumberOfBytesNeeded )
{
FIXME("stub\n");
return TRUE;
}
/******************************************************************************
* ReadEventLog32W [ADVAPI32.125]
*
* PARAMS
* hEventLog []
* dwReadFlags []
* dwRecordOffset []
* lpBuffer []
* nNumberOfBytesToRead []
* pnBytesRead []
* pnMinNumberOfBytesNeeded []
*/
BOOL WINAPI
ReadEventLogW( HANDLE hEventLog, DWORD dwReadFlags, DWORD dwRecordOffset,
LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
DWORD *pnBytesRead, DWORD *pnMinNumberOfBytesNeeded )
{
FIXME("stub\n");
return TRUE;
}
/******************************************************************************
* RegisterEventSource32A [ADVAPI32.174]
*/
HANDLE WINAPI RegisterEventSourceA( LPCSTR lpUNCServerName, LPCSTR lpSourceName )
{
LPWSTR lpUNCServerNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpUNCServerName);
LPWSTR lpSourceNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpSourceName);
HANDLE ret = RegisterEventSourceW(lpUNCServerNameW,lpSourceNameW);
HeapFree(GetProcessHeap(),0,lpSourceNameW);
HeapFree(GetProcessHeap(),0,lpUNCServerNameW);
return ret;
}
/******************************************************************************
* RegisterEventSource32W [ADVAPI32.175]
* Returns a registered handle to an event log
*
* PARAMS
* lpUNCServerName [I] Server name for source
* lpSourceName [I] Source name for registered handle
*
* RETURNS
* Success: Handle
* Failure: NULL
*/
HANDLE WINAPI
RegisterEventSourceW( LPCWSTR lpUNCServerName, LPCWSTR lpSourceName )
{
FIXME("(%s,%s): stub\n", debugstr_w(lpUNCServerName),
debugstr_w(lpSourceName));
return 1;
}
/******************************************************************************
* ReportEvent32A [ADVAPI32.178]
*/
BOOL WINAPI ReportEventA ( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD dwEventID,
PSID lpUserSid, WORD wNumStrings, DWORD dwDataSize, LPCSTR *lpStrings, LPVOID lpRawData)
{
FIXME("stub\n");
return TRUE;
}
/******************************************************************************
* ReportEvent32W [ADVAPI32.179]
*
* PARAMS
* hEventLog []
* wType []
* wCategory []
* dwEventID []
* lpUserSid []
* wNumStrings []
* dwDataSize []
* lpStrings []
* lpRawData []
*/
BOOL WINAPI
ReportEventW( HANDLE hEventLog, WORD wType, WORD wCategory,
DWORD dwEventID, PSID lpUserSid, WORD wNumStrings,
DWORD dwDataSize, LPCWSTR *lpStrings, LPVOID lpRawData )
{
FIXME("stub\n");
return TRUE;
}
wine-990704/dlls/advapi32/security.c 100644 771 771 51217 6737637401 17102 0 ustar julliard julliard /*
* dlls/advapi32/security.c
* FIXME: for all functions thunking down to Rtl* functions: implement SetLastError()
*/
#include <string.h>
#include "windef.h"
#include "winerror.h"
#include "heap.h"
#include "ntddk.h"
#include "ntsecapi.h"
#include "debugtools.h"
DECLARE_DEBUG_CHANNEL(advapi)
DECLARE_DEBUG_CHANNEL(security)
#define CallWin32ToNt(func) \
{ NTSTATUS ret; \
ret = (func); \
if (ret !=STATUS_SUCCESS) \
{ SetLastError (RtlNtStatusToDosError(ret)); return FALSE; } \
return TRUE; \
}
/* ##############################
###### TOKEN FUNCTIONS ######
##############################
*/
/******************************************************************************
* OpenProcessToken [ADVAPI32.109]
* Opens the access token associated with a process
*
* PARAMS
* ProcessHandle [I] Handle to process
* DesiredAccess [I] Desired access to process
* TokenHandle [O] Pointer to handle of open access token
*
* RETURNS STD
*/
BOOL WINAPI
OpenProcessToken( HANDLE ProcessHandle, DWORD DesiredAccess,
HANDLE *TokenHandle )
{
CallWin32ToNt(NtOpenProcessToken( ProcessHandle, DesiredAccess, TokenHandle ));
}
/******************************************************************************
* OpenThreadToken [ADVAPI32.114]
*
* PARAMS
* thread []
* desiredaccess []
* openasself []
* thandle []
*/
BOOL WINAPI
OpenThreadToken( HANDLE ThreadHandle, DWORD DesiredAccess,
BOOL OpenAsSelf, HANDLE *TokenHandle)
{
CallWin32ToNt (NtOpenThreadToken(ThreadHandle, DesiredAccess, OpenAsSelf, TokenHandle));
}
/******************************************************************************
* AdjustTokenPrivileges [ADVAPI32.10]
*
* PARAMS
* TokenHandle []
* DisableAllPrivileges []
* NewState []
* BufferLength []
* PreviousState []
* ReturnLength []
*/
BOOL WINAPI
AdjustTokenPrivileges( HANDLE TokenHandle, BOOL DisableAllPrivileges,
LPVOID NewState, DWORD BufferLength,
LPVOID PreviousState, LPDWORD ReturnLength )
{
CallWin32ToNt(NtAdjustPrivilegesToken(TokenHandle, DisableAllPrivileges, NewState, BufferLength, PreviousState, ReturnLength));
}
/******************************************************************************
* GetTokenInformation [ADVAPI32.66]
*
* PARAMS
* token []
* tokeninfoclass []
* tokeninfo []
* tokeninfolength []
* retlen []
*
*/
BOOL WINAPI
GetTokenInformation( HANDLE token, TOKEN_INFORMATION_CLASS tokeninfoclass,
LPVOID tokeninfo, DWORD tokeninfolength, LPDWORD retlen )
{
CallWin32ToNt (NtQueryInformationToken( token, tokeninfoclass, tokeninfo, tokeninfolength, retlen));
}
/* ##############################
###### SID FUNCTIONS ######
##############################
*/
/******************************************************************************
* AllocateAndInitializeSid [ADVAPI32.11]
*
* PARAMS
* pIdentifierAuthority []
* nSubAuthorityCount []
* nSubAuthority0 []
* nSubAuthority1 []
* nSubAuthority2 []
* nSubAuthority3 []
* nSubAuthority4 []
* nSubAuthority5 []
* nSubAuthority6 []
* nSubAuthority7 []
* pSid []
*/
BOOL WINAPI
AllocateAndInitializeSid( PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
BYTE nSubAuthorityCount,
DWORD nSubAuthority0, DWORD nSubAuthority1,
DWORD nSubAuthority2, DWORD nSubAuthority3,
DWORD nSubAuthority4, DWORD nSubAuthority5,
DWORD nSubAuthority6, DWORD nSubAuthority7,
PSID *pSid )
{
if (!(*pSid = HeapAlloc( GetProcessHeap(), 0,
GetSidLengthRequired(nSubAuthorityCount))))
return FALSE;
(*pSid)->Revision = SID_REVISION;
if (pIdentifierAuthority)
memcpy(&(*pSid)->IdentifierAuthority, pIdentifierAuthority,
sizeof (SID_IDENTIFIER_AUTHORITY));
*GetSidSubAuthorityCount(*pSid) = nSubAuthorityCount;
if (nSubAuthorityCount > 0)
*GetSidSubAuthority(*pSid, 0) = nSubAuthority0;
if (nSubAuthorityCount > 1)
*GetSidSubAuthority(*pSid, 1) = nSubAuthority1;
if (nSubAuthorityCount > 2)
*GetSidSubAuthority(*pSid, 2) = nSubAuthority2;
if (nSubAuthorityCount > 3)
*GetSidSubAuthority(*pSid, 3) = nSubAuthority3;
if (nSubAuthorityCount > 4)
*GetSidSubAuthority(*pSid, 4) = nSubAuthority4;
if (nSubAuthorityCount > 5)
*GetSidSubAuthority(*pSid, 5) = nSubAuthority5;
if (nSubAuthorityCount > 6)
*GetSidSubAuthority(*pSid, 6) = nSubAuthority6;
if (nSubAuthorityCount > 7)
*GetSidSubAuthority(*pSid, 7) = nSubAuthority7;
return TRUE;
}
/******************************************************************************
* FreeSid [ADVAPI32.42]
*
* PARAMS
* pSid []
*/
PVOID WINAPI
FreeSid( PSID pSid )
{
HeapFree( GetProcessHeap(), 0, pSid );
return NULL;
}
/******************************************************************************
* CopySid [ADVAPI32.24]
*
* PARAMS
* nDestinationSidLength []
* pDestinationSid []
* pSourceSid []
*/
BOOL WINAPI
CopySid( DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid )
{
if (!IsValidSid(pSourceSid))
return FALSE;
if (nDestinationSidLength < GetLengthSid(pSourceSid))
return FALSE;
memcpy(pDestinationSid, pSourceSid, GetLengthSid(pSourceSid));
return TRUE;
}
/******************************************************************************
* IsValidSid [ADVAPI32.80]
*
* PARAMS
* pSid []
*/
BOOL WINAPI
IsValidSid( PSID pSid )
{
if (!pSid || pSid->Revision != SID_REVISION)
return FALSE;
return TRUE;
}
/******************************************************************************
* EqualSid [ADVAPI32.40]
*
* PARAMS
* pSid1 []
* pSid2 []
*/
BOOL WINAPI
EqualSid( PSID pSid1, PSID pSid2 )
{
if (!IsValidSid(pSid1) || !IsValidSid(pSid2))
return FALSE;
if (*GetSidSubAuthorityCount(pSid1) != *GetSidSubAuthorityCount(pSid2))
return FALSE;
if (memcmp(pSid1, pSid2, GetLengthSid(pSid1)) != 0)
return FALSE;
return TRUE;
}
/******************************************************************************
* EqualPrefixSid [ADVAPI32.39]
*/
BOOL WINAPI EqualPrefixSid (PSID pSid1, PSID pSid2) {
if (!IsValidSid(pSid1) || !IsValidSid(pSid2))
return FALSE;
if (*GetSidSubAuthorityCount(pSid1) != *GetSidSubAuthorityCount(pSid2))
return FALSE;
if (memcmp(pSid1, pSid2, GetSidLengthRequired(pSid1->SubAuthorityCount - 1))
!= 0)
return FALSE;
return TRUE;
}
/******************************************************************************
* GetSidLengthRequired [ADVAPI32.63]
*
* PARAMS
* nSubAuthorityCount []
*/
DWORD WINAPI
GetSidLengthRequired( BYTE nSubAuthorityCount )
{
return sizeof (SID) + (nSubAuthorityCount - 1) * sizeof (DWORD);
}
/******************************************************************************
* InitializeSid [ADVAPI32.74]
*
* PARAMS
* pIdentifierAuthority []
*/
BOOL WINAPI
InitializeSid (PSID pSid, PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
BYTE nSubAuthorityCount)
{
int i;
pSid->Revision = SID_REVISION;
if (pIdentifierAuthority)
memcpy(&pSid->IdentifierAuthority, pIdentifierAuthority,
sizeof (SID_IDENTIFIER_AUTHORITY));
*GetSidSubAuthorityCount(pSid) = nSubAuthorityCount;
for (i = 0; i < nSubAuthorityCount; i++)
*GetSidSubAuthority(pSid, i) = 0;
return TRUE;
}
/******************************************************************************
* GetSidIdentifierAuthority [ADVAPI32.62]
*
* PARAMS
* pSid []
*/
PSID_IDENTIFIER_AUTHORITY WINAPI
GetSidIdentifierAuthority( PSID pSid )
{
return &pSid->IdentifierAuthority;
}
/******************************************************************************
* GetSidSubAuthority [ADVAPI32.64]
*
* PARAMS
* pSid []
* nSubAuthority []
*/
PDWORD WINAPI
GetSidSubAuthority( PSID pSid, DWORD nSubAuthority )
{
return &pSid->SubAuthority[nSubAuthority];
}
/******************************************************************************
* GetSidSubAuthorityCount [ADVAPI32.65]
*
* PARAMS
* pSid []
*/
PUCHAR WINAPI
GetSidSubAuthorityCount (PSID pSid)
{
return &pSid->SubAuthorityCount;
}
/******************************************************************************
* GetLengthSid [ADVAPI32.48]
*
* PARAMS
* pSid []
*/
DWORD WINAPI
GetLengthSid (PSID pSid)
{
return GetSidLengthRequired( * GetSidSubAuthorityCount(pSid) );
}
/* ##############################################
###### SECURITY DESCRIPTOR FUNCTIONS ######
##############################################
*/
/******************************************************************************
* InitializeSecurityDescriptor [ADVAPI32.73]
*
* PARAMS
* pDescr []
* revision []
*/
BOOL WINAPI
InitializeSecurityDescriptor( SECURITY_DESCRIPTOR *pDescr, DWORD revision )
{
CallWin32ToNt (RtlCreateSecurityDescriptor(pDescr, revision ));
}
/******************************************************************************
* GetSecurityDescriptorLength [ADVAPI32.55]
*/
DWORD WINAPI GetSecurityDescriptorLength( SECURITY_DESCRIPTOR *pDescr)
{
return (RtlLengthSecurityDescriptor(pDescr));
}
/******************************************************************************
* GetSecurityDescriptorOwner [ADVAPI32.56]
*
* PARAMS
* pOwner []
* lpbOwnerDefaulted []
*/
BOOL WINAPI
GetSecurityDescriptorOwner( SECURITY_DESCRIPTOR *pDescr, PSID *pOwner,
LPBOOL lpbOwnerDefaulted )
{
CallWin32ToNt (RtlGetOwnerSecurityDescriptor( pDescr, pOwner, (PBOOLEAN)lpbOwnerDefaulted ));
}
/******************************************************************************
* SetSecurityDescriptorOwner [ADVAPI32]
*
* PARAMS
*/
BOOL WINAPI SetSecurityDescriptorOwner( PSECURITY_DESCRIPTOR pSecurityDescriptor,
PSID pOwner, BOOL bOwnerDefaulted)
{
CallWin32ToNt (RtlSetOwnerSecurityDescriptor(pSecurityDescriptor, pOwner, bOwnerDefaulted));
}
/******************************************************************************
* GetSecurityDescriptorGroup [ADVAPI32.54]
*/
BOOL WINAPI GetSecurityDescriptorGroup(
PSECURITY_DESCRIPTOR SecurityDescriptor,
PSID *Group,
LPBOOL GroupDefaulted)
{
CallWin32ToNt (RtlGetGroupSecurityDescriptor(SecurityDescriptor, Group, (PBOOLEAN)GroupDefaulted));
}
/******************************************************************************
* SetSecurityDescriptorGroup
*/
BOOL WINAPI SetSecurityDescriptorGroup ( PSECURITY_DESCRIPTOR SecurityDescriptor,
PSID Group, BOOL GroupDefaulted)
{
CallWin32ToNt (RtlSetGroupSecurityDescriptor( SecurityDescriptor, Group, GroupDefaulted));
}
/******************************************************************************
* IsValidSecurityDescriptor [ADVAPI32.79]
*
* PARAMS
* lpsecdesc []
*/
BOOL WINAPI
IsValidSecurityDescriptor( PSECURITY_DESCRIPTOR SecurityDescriptor )
{
CallWin32ToNt (RtlValidSecurityDescriptor(SecurityDescriptor));
}
/******************************************************************************
* GetSecurityDescriptorDacl [ADVAPI.91]
*/
BOOL WINAPI GetSecurityDescriptorDacl(
IN PSECURITY_DESCRIPTOR pSecurityDescriptor,
OUT LPBOOL lpbDaclPresent,
OUT PACL *pDacl,
OUT LPBOOL lpbDaclDefaulted)
{
CallWin32ToNt (RtlGetDaclSecurityDescriptor(pSecurityDescriptor, (PBOOLEAN)lpbDaclPresent,
pDacl, (PBOOLEAN)lpbDaclDefaulted));
}
/******************************************************************************
* SetSecurityDescriptorDacl [ADVAPI.224]
*/
BOOL WINAPI
SetSecurityDescriptorDacl (
PSECURITY_DESCRIPTOR lpsd,
BOOL daclpresent,
PACL dacl,
BOOL dacldefaulted )
{
CallWin32ToNt (RtlSetDaclSecurityDescriptor (lpsd, daclpresent, dacl, dacldefaulted ));
}
/******************************************************************************
* GetSecurityDescriptorSacl [ADVAPI.]
*/
BOOL WINAPI GetSecurityDescriptorSacl(
IN PSECURITY_DESCRIPTOR lpsd,
OUT LPBOOL lpbSaclPresent,
OUT PACL *pSacl,
OUT LPBOOL lpbSaclDefaulted)
{
CallWin32ToNt (RtlGetSaclSecurityDescriptor(lpsd, (PBOOLEAN)lpbSaclPresent,
pSacl, (PBOOLEAN)lpbSaclDefaulted));
}
/**************************************************************************
* SetSecurityDescriptorSacl [NTDLL.488]
*/
BOOL WINAPI SetSecurityDescriptorSacl (
PSECURITY_DESCRIPTOR lpsd,
BOOL saclpresent,
PACL lpsacl,
BOOL sacldefaulted)
{
CallWin32ToNt (RtlSetSaclSecurityDescriptor(lpsd, saclpresent, lpsacl, sacldefaulted));
}
/******************************************************************************
* MakeSelfRelativeSD [ADVAPI32.95]
*
* PARAMS
* lpabssecdesc []
* lpselfsecdesc []
* lpbuflen []
*/
BOOL WINAPI
MakeSelfRelativeSD( PSECURITY_DESCRIPTOR lpabssecdesc,
PSECURITY_DESCRIPTOR lpselfsecdesc, LPDWORD lpbuflen )
{
FIXME_(advapi)("(%p,%p,%p),stub!\n",lpabssecdesc,lpselfsecdesc,lpbuflen);
return TRUE;
}
/******************************************************************************
* GetSecurityDescriptorControl32 [ADVAPI32]
*/
BOOL WINAPI GetSecurityDescriptorControl ( PSECURITY_DESCRIPTOR pSecurityDescriptor,
PSECURITY_DESCRIPTOR_CONTROL pControl, LPDWORD lpdwRevision)
{ FIXME_(advapi)("(%p,%p,%p),stub!\n",pSecurityDescriptor,pControl,lpdwRevision);
return 1;
}
/* ##############################
###### MISC FUNCTIONS ######
##############################
*/
/******************************************************************************
* LookupPrivilegeValue32W [ADVAPI32.93]
* Retrieves LUID used on a system to represent the privilege name.
*
* NOTES
* lpLuid should be PLUID
*
* PARAMS
* lpSystemName [I] Address of string specifying the system
* lpName [I] Address of string specifying the privilege
* lpLuid [I] Address of locally unique identifier
*
* RETURNS STD
*/
BOOL WINAPI
LookupPrivilegeValueW( LPCWSTR lpSystemName, LPCWSTR lpName, LPVOID lpLuid )
{
FIXME_(advapi)("(%s,%s,%p): stub\n",debugstr_w(lpSystemName),
debugstr_w(lpName), lpLuid);
return TRUE;
}
/******************************************************************************
* LookupPrivilegeValue32A [ADVAPI32.92]
*/
BOOL WINAPI
LookupPrivilegeValueA( LPCSTR lpSystemName, LPCSTR lpName, LPVOID lpLuid )
{
LPWSTR lpSystemNameW = HEAP_strdupAtoW(GetProcessHeap(), 0, lpSystemName);
LPWSTR lpNameW = HEAP_strdupAtoW(GetProcessHeap(), 0, lpName);
BOOL ret = LookupPrivilegeValueW( lpSystemNameW, lpNameW, lpLuid);
HeapFree(GetProcessHeap(), 0, lpNameW);
HeapFree(GetProcessHeap(), 0, lpSystemNameW);
return ret;
}
/******************************************************************************
* GetFileSecurity32A [ADVAPI32.45]
*
* Obtains Specified information about the security of a file or directory
* The information obtained is constrained by the callers access rights and
* privileges
*/
BOOL WINAPI
GetFileSecurityA( LPCSTR lpFileName,
SECURITY_INFORMATION RequestedInformation,
PSECURITY_DESCRIPTOR pSecurityDescriptor,
DWORD nLength, LPDWORD lpnLengthNeeded )
{
FIXME_(advapi)("(%s) : stub\n", debugstr_a(lpFileName));
return TRUE;
}
/******************************************************************************
* GetFileSecurity32W [ADVAPI32.46]
*
* Obtains Specified information about the security of a file or directory
* The information obtained is constrained by the callers access rights and
* privileges
*
* PARAMS
* lpFileName []
* RequestedInformation []
* pSecurityDescriptor []
* nLength []
* lpnLengthNeeded []
*/
BOOL WINAPI
GetFileSecurityW( LPCWSTR lpFileName,
SECURITY_INFORMATION RequestedInformation,
PSECURITY_DESCRIPTOR pSecurityDescriptor,
DWORD nLength, LPDWORD lpnLengthNeeded )
{
FIXME_(advapi)("(%s) : stub\n", debugstr_w(lpFileName) );
return TRUE;
}
/******************************************************************************
* LookupAccountSid32A [ADVAPI32.86]
*/
BOOL WINAPI
LookupAccountSidA( LPCSTR system, PSID sid, LPCSTR account,
LPDWORD accountSize, LPCSTR domain, LPDWORD domainSize,
PSID_NAME_USE name_use )
{
FIXME_(security)("(%s,%p,%p,%p,%p,%p,%p): stub\n",
system,sid,account,accountSize,domain,domainSize,name_use);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/******************************************************************************
* LookupAccountSid32W [ADVAPI32.87]
*
* PARAMS
* system []
* sid []
* account []
* accountSize []
* domain []
* domainSize []
* name_use []
*/
BOOL WINAPI
LookupAccountSidW( LPCWSTR system, PSID sid, LPCWSTR account,
LPDWORD accountSize, LPCWSTR domain, LPDWORD domainSize,
PSID_NAME_USE name_use )
{
FIXME_(security)("(%p,%p,%p,%p,%p,%p,%p): stub\n",
system,sid,account,accountSize,domain,domainSize,name_use);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/******************************************************************************
* SetFileSecurity32A [ADVAPI32.182]
* Sets the security of a file or directory
*/
BOOL WINAPI SetFileSecurityA( LPCSTR lpFileName,
SECURITY_INFORMATION RequestedInformation,
PSECURITY_DESCRIPTOR pSecurityDescriptor)
{
FIXME_(advapi)("(%s) : stub\n", debugstr_a(lpFileName));
return TRUE;
}
/******************************************************************************
* SetFileSecurity32W [ADVAPI32.183]
* Sets the security of a file or directory
*
* PARAMS
* lpFileName []
* RequestedInformation []
* pSecurityDescriptor []
*/
BOOL WINAPI
SetFileSecurityW( LPCWSTR lpFileName,
SECURITY_INFORMATION RequestedInformation,
PSECURITY_DESCRIPTOR pSecurityDescriptor )
{
FIXME_(advapi)("(%s) : stub\n", debugstr_w(lpFileName) );
return TRUE;
}
/******************************************************************************
* QueryWindows31FilesMigration [ADVAPI32.266]
*
* PARAMS
* x1 []
*/
BOOL WINAPI
QueryWindows31FilesMigration( DWORD x1 )
{
FIXME_(advapi)("(%ld):stub\n",x1);
return TRUE;
}
/******************************************************************************
* SynchronizeWindows31FilesAndWindowsNTRegistry [ADVAPI32.265]
*
* PARAMS
* x1 []
* x2 []
* x3 []
* x4 []
*/
BOOL WINAPI
SynchronizeWindows31FilesAndWindowsNTRegistry( DWORD x1, DWORD x2, DWORD x3,
DWORD x4 )
{
FIXME_(advapi)("(0x%08lx,0x%08lx,0x%08lx,0x%08lx):stub\n",x1,x2,x3,x4);
return TRUE;
}
/******************************************************************************
* LsaOpenPolicy [ADVAPI32.200]
*
* PARAMS
* x1 []
* x2 []
* x3 []
* x4 []
*/
NTSTATUS WINAPI
LsaOpenPolicy(PLSA_UNICODE_STRING SystemName,
PLSA_OBJECT_ATTRIBUTES ObjectAttributes,
ACCESS_MASK DesiredAccess,
PLSA_HANDLE PolicyHandle)
{
FIXME_(advapi)("(%p,%p,0x%08lx,%p):stub\n",
SystemName, ObjectAttributes,
DesiredAccess, PolicyHandle);
return 0xc0000000; /* generic error */
}
/******************************************************************************
* NotifyBootConfigStatus [ADVAPI32.97]
*
* PARAMS
* x1 []
*/
BOOL WINAPI
NotifyBootConfigStatus( DWORD x1 )
{
FIXME_(advapi)("(0x%08lx):stub\n",x1);
return 1;
}
/******************************************************************************
* RevertToSelf [ADVAPI32.180]
*
* PARAMS
* void []
*/
BOOL WINAPI
RevertToSelf( void )
{
FIXME_(advapi)("(), stub\n");
return TRUE;
}
/******************************************************************************
* ImpersonateSelf [ADVAPI32.71]
*/
BOOL WINAPI
ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
{
FIXME_(advapi)("(%08x), stub\n", ImpersonationLevel);
return TRUE;
}
/******************************************************************************
* AccessCheck32 [ADVAPI32.71]
*/
BOOL WINAPI
AccessCheck(PSECURITY_DESCRIPTOR pSecurityDescriptor, HANDLE ClientToken,
DWORD DesiredAccess, PGENERIC_MAPPING GenericMapping, PPRIVILEGE_SET PrivilegeSet,
LPDWORD PrivilegeSetLength, LPDWORD GrantedAccess, LPBOOL AccessStatus)
{
FIXME_(advapi)("(%p, %04x, %08lx, %p, %p, %p, %p, %p), stub\n",
pSecurityDescriptor, ClientToken, DesiredAccess, GenericMapping,
PrivilegeSet, PrivilegeSetLength, GrantedAccess, AccessStatus);
*AccessStatus = TRUE;
return TRUE;
}
wine-990704/dlls/advapi32/service.c 100644 771 771 21546 6737637401 16675 0 ustar julliard julliard /*
* Win32 advapi functions
*
* Copyright 1995 Sven Verdoolaege
*/
#include <time.h>
#include "windef.h"
#include "winsvc.h"
#include "winerror.h"
#include "heap.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(advapi)
/******************************************************************************
* EnumServicesStatus32A [ADVAPI32.38]
*/
BOOL WINAPI
EnumServicesStatusA( SC_HANDLE hSCManager, DWORD dwServiceType,
DWORD dwServiceState, LPENUM_SERVICE_STATUSA lpServices,
DWORD cbBufSize, LPDWORD pcbBytesNeeded,
LPDWORD lpServicesReturned, LPDWORD lpResumeHandle )
{ FIXME("%x type=%lx state=%lx %p %lx %p %p %p\n", hSCManager,
dwServiceType, dwServiceState, lpServices, cbBufSize,
pcbBytesNeeded, lpServicesReturned, lpResumeHandle);
SetLastError (ERROR_ACCESS_DENIED);
return 0;
}
/******************************************************************************
* StartServiceCtrlDispatcher32A [ADVAPI32.196]
*/
BOOL WINAPI
StartServiceCtrlDispatcherA( LPSERVICE_TABLE_ENTRYA servent )
{ LPSERVICE_TABLE_ENTRYA ptr = servent;
while (ptr->lpServiceName)
{ FIXME("%s at %p\n", ptr->lpServiceName, ptr);
ptr++;
}
return TRUE;
}
/******************************************************************************
* StartServiceCtrlDispatcher32W [ADVAPI32.197]
*
* PARAMS
* servent []
*/
BOOL WINAPI
StartServiceCtrlDispatcherW( LPSERVICE_TABLE_ENTRYW servent )
{ LPSERVICE_TABLE_ENTRYW ptr = servent;
LPSERVICE_MAIN_FUNCTIONW fpMain;
while (ptr->lpServiceName)
{ FIXME("%s at %p): STUB.\n", debugstr_w(ptr->lpServiceName),ptr);
fpMain = ptr->lpServiceProc;
fpMain(0,NULL); /* try to start the service */
ptr++;
}
return TRUE;
}
/******************************************************************************
* RegisterServiceCtrlHandlerA [ADVAPI32.176]
*/
SERVICE_STATUS_HANDLE WINAPI
RegisterServiceCtrlHandlerA( LPCSTR lpServiceName,
LPHANDLER_FUNCTION lpfHandler )
{ FIXME("%s %p\n", lpServiceName, lpfHandler);
return 0xcacacafe;
}
/******************************************************************************
* RegisterServiceCtrlHandlerW [ADVAPI32.177]
*
* PARAMS
* lpServiceName []
* lpfHandler []
*/
SERVICE_STATUS_HANDLE WINAPI
RegisterServiceCtrlHandlerW( LPCWSTR lpServiceName,
LPHANDLER_FUNCTION lpfHandler )
{ FIXME("%s %p\n", debugstr_w(lpServiceName), lpfHandler);
return 0xcacacafe;
}
/******************************************************************************
* SetServiceStatus [ADVAPI32.192]
*
* PARAMS
* hService []
* lpStatus []
*/
BOOL WINAPI
SetServiceStatus( SERVICE_STATUS_HANDLE hService, LPSERVICE_STATUS lpStatus )
{ FIXME("%lx %p\n",hService, lpStatus);
TRACE("\tType:%lx\n",lpStatus->dwServiceType);
TRACE("\tState:%lx\n",lpStatus->dwCurrentState);
TRACE("\tControlAccepted:%lx\n",lpStatus->dwControlsAccepted);
TRACE("\tExitCode:%lx\n",lpStatus->dwWin32ExitCode);
TRACE("\tServiceExitCode:%lx\n",lpStatus->dwServiceSpecificExitCode);
TRACE("\tCheckPoint:%lx\n",lpStatus->dwCheckPoint);
TRACE("\tWaitHint:%lx\n",lpStatus->dwWaitHint);
return TRUE;
}
/******************************************************************************
* OpenSCManager32A [ADVAPI32.110]
*/
SC_HANDLE WINAPI
OpenSCManagerA( LPCSTR lpMachineName, LPCSTR lpDatabaseName,
DWORD dwDesiredAccess )
{
LPWSTR lpMachineNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpMachineName);
LPWSTR lpDatabaseNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpDatabaseName);
DWORD ret = OpenSCManagerW(lpMachineNameW,lpDatabaseNameW,
dwDesiredAccess);
HeapFree(GetProcessHeap(),0,lpDatabaseNameW);
HeapFree(GetProcessHeap(),0,lpMachineNameW);
return ret;
}
/******************************************************************************
* OpenSCManager32W [ADVAPI32.111]
* Establishes a connection to the service control manager and opens database
*
* NOTES
* This should return a SC_HANDLE
*
* PARAMS
* lpMachineName [I] Pointer to machine name string
* lpDatabaseName [I] Pointer to database name string
* dwDesiredAccess [I] Type of access
*
* RETURNS
* Success: Handle to service control manager database
* Failure: NULL
*/
SC_HANDLE WINAPI
OpenSCManagerW( LPCWSTR lpMachineName, LPCWSTR lpDatabaseName,
DWORD dwDesiredAccess )
{
FIXME("(%s,%s,0x%08lx): stub\n", debugstr_w(lpMachineName),
debugstr_w(lpDatabaseName), dwDesiredAccess);
return 1;
}
/******************************************************************************
* AllocateLocallyUniqueId [ADVAPI32.12]
*
* PARAMS
* lpluid []
*/
BOOL WINAPI
AllocateLocallyUniqueId( PLUID lpluid )
{
lpluid->LowPart = time(NULL);
lpluid->HighPart = 0;
return TRUE;
}
/******************************************************************************
* ControlService [ADVAPI32.23]
* Sends a control code to a Win32-based service.
*
* PARAMS
* hService []
* dwControl []
* lpServiceStatus []
*
* RETURNS STD
*/
BOOL WINAPI
ControlService( SC_HANDLE hService, DWORD dwControl,
LPSERVICE_STATUS lpServiceStatus )
{
FIXME("(%d,%ld,%p): stub\n",hService,dwControl,lpServiceStatus);
return TRUE;
}
/******************************************************************************
* CloseServiceHandle [ADVAPI32.22]
* Close handle to service or service control manager
*
* PARAMS
* hSCObject [I] Handle to service or service control manager database
*
* RETURNS STD
*/
BOOL WINAPI
CloseServiceHandle( SC_HANDLE hSCObject )
{
FIXME("(%d): stub\n", hSCObject);
return TRUE;
}
/******************************************************************************
* OpenService32A [ADVAPI32.112]
*/
SC_HANDLE WINAPI
OpenServiceA( SC_HANDLE hSCManager, LPCSTR lpServiceName,
DWORD dwDesiredAccess )
{
LPWSTR lpServiceNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpServiceName);
DWORD ret = OpenServiceW( hSCManager, lpServiceNameW, dwDesiredAccess);
HeapFree(GetProcessHeap(),0,lpServiceNameW);
return ret;
}
/******************************************************************************
* OpenService32W [ADVAPI32.113]
* Opens a handle to an existing service
*
* PARAMS
* hSCManager []
* lpServiceName []
* dwDesiredAccess []
*
* RETURNS
* Success: Handle to the service
* Failure: NULL
*/
SC_HANDLE WINAPI
OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName,
DWORD dwDesiredAccess)
{
FIXME("(%d,%p,%ld): stub\n",hSCManager, lpServiceName,
dwDesiredAccess);
return 1;
}
/******************************************************************************
* CreateService32A [ADVAPI32.29]
*/
SC_HANDLE WINAPI
CreateServiceA( DWORD hSCManager, LPCSTR lpServiceName,
LPCSTR lpDisplayName, DWORD dwDesiredAccess,
DWORD dwServiceType, DWORD dwStartType,
DWORD dwErrorControl, LPCSTR lpBinaryPathName,
LPCSTR lpLoadOrderGroup, LPDWORD lpdwTagId,
LPCSTR lpDependencies, LPCSTR lpServiceStartName,
LPCSTR lpPassword )
{
FIXME("(%ld,%s,%s,...): stub\n",
hSCManager, debugstr_a(lpServiceName), debugstr_a(lpDisplayName));
return 1;
}
/******************************************************************************
* DeleteService [ADVAPI32.31]
*
* PARAMS
* hService [I] Handle to service
*
* RETURNS STD
*
*/
BOOL WINAPI
DeleteService( SC_HANDLE hService )
{
FIXME("(%d): stub\n",hService);
return TRUE;
}
/******************************************************************************
* StartService32A [ADVAPI32.195]
*
* NOTES
* How do we convert lpServiceArgVectors to use the 32W version?
*/
BOOL WINAPI
StartServiceA( SC_HANDLE hService, DWORD dwNumServiceArgs,
LPCSTR *lpServiceArgVectors )
{
FIXME("(%d,%ld,%p): stub\n",hService,dwNumServiceArgs,lpServiceArgVectors);
return TRUE;
}
/******************************************************************************
* StartService32W [ADVAPI32.198]
* Starts a service
*
* PARAMS
* hService [I] Handle of service
* dwNumServiceArgs [I] Number of arguments
* lpServiceArgVectors [I] Address of array of argument string pointers
*
* RETURNS STD
*
*/
BOOL WINAPI
StartServiceW( SC_HANDLE hService, DWORD dwNumServiceArgs,
LPCWSTR *lpServiceArgVectors )
{
FIXME("(%d,%ld,%p): stub\n",hService,dwNumServiceArgs,
lpServiceArgVectors);
return TRUE;
}
/******************************************************************************
* QueryServiceStatus [ADVAPI32.123]
*
* PARAMS
* hService []
* lpservicestatus []
*
*/
BOOL WINAPI
QueryServiceStatus( SC_HANDLE hService, LPSERVICE_STATUS lpservicestatus )
{
FIXME("(%d,%p),stub!\n",hService,lpservicestatus);
return TRUE;
}
wine-990704/dlls/avifil32/ 40755 771 771 0 6737705664 14761 5 ustar julliard julliard wine-990704/dlls/avifil32/.cvsignore 100644 771 771 11 6672524561 16777 0 ustar julliard julliard Makefile
wine-990704/dlls/avifil32/Makefile.in 100644 771 771 327 6672524561 17076 0 ustar julliard julliard DEFS = @DLLFLAGS@ -D__WINE__
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = avifil32
C_SRCS = \
avifile.c
all: $(MODULE).o
@MAKE_RULES@
### Dependencies:
wine-990704/dlls/avifil32/avifile.c 100644 771 771 37155 6737431746 16671 0 ustar julliard julliard /*
* Copyright 1999 Marcus Meissner
*/
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "winbase.h"
#include "vfw.h"
#include "wine/winestring.h"
#include "driver.h"
#include "mmsystem.h"
#include "winerror.h"
#include "debugstr.h"
#include "debugtools.h"
DECLARE_DEBUG_CHANNEL(avifile)
DECLARE_DEBUG_CHANNEL(msvideo)
DECLARE_DEBUG_CHANNEL(relay)
typedef struct IAVIStreamImpl {
/* IUnknown stuff */
ICOM_VTABLE(IAVIStream)* lpvtbl;
DWORD ref;
/* IAVIStream stuff */
LPVOID lpInputFormat;
DWORD inputformatsize;
BOOL iscompressing;
DWORD curframe;
/* Compressor stuff */
HIC hic;
LPVOID lpCompressFormat;
ICINFO icinfo;
DWORD compbufsize;
LPVOID compbuffer;
DWORD decompbufsize;
LPVOID decompbuffer;
LPVOID decompformat;
AVICOMPRESSOPTIONS aco;
LPVOID lpPrev; /* pointer to decompressed frame later */
LPVOID lpPrevFormat; /* pointer to decompressed info later */
} IAVIStreamImpl;
void WINAPI
AVIFileInit(void) {
FIXME_(avifile)("(),stub!\n");
}
typedef struct IAVIFileImpl {
/* IUnknown stuff */
ICOM_VTABLE(IAVIFile)* lpvtbl;
DWORD ref;
/* IAVIFile stuff... */
} IAVIFileImpl;
struct ICOM_VTABLE(IAVIStream) iavist;
static HRESULT WINAPI IAVIFile_fnQueryInterface(IAVIFile* iface,REFIID refiid,LPVOID *obj) {
ICOM_THIS(IAVIFileImpl,iface);
char xrefiid[50];
WINE_StringFromCLSID((LPCLSID)refiid,xrefiid);
TRACE_(relay)("(%p)->QueryInterface(%s,%p)\n",This,xrefiid,obj);
if ( !memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown)) ||
!memcmp(&IID_IAVIFile,refiid,sizeof(IID_IAVIFile))
) {
*obj = iface;
return S_OK;
}
return OLE_E_ENUM_NOMORE;
}
static ULONG WINAPI IAVIFile_fnAddRef(IAVIFile* iface) {
ICOM_THIS(IAVIFileImpl,iface);
FIXME_(relay)("(%p)->AddRef()\n",iface);
return ++(This->ref);
}
static ULONG WINAPI IAVIFile_fnRelease(IAVIFile* iface) {
ICOM_THIS(IAVIFileImpl,iface);
FIXME_(relay)("(%p)->Release()\n",iface);
if (!--(This->ref)) {
HeapFree(GetProcessHeap(),0,iface);
return 0;
}
return This->ref;
}
static HRESULT WINAPI IAVIFile_fnInfo(IAVIFile*iface,AVIFILEINFOW*afi,LONG size) {
FIXME_(avifile)("(%p)->Info(%p,%ld)\n",iface,afi,size);
/* FIXME: fill out struct? */
return E_FAIL;
}
static HRESULT WINAPI IAVIFile_fnGetStream(IAVIFile*iface,PAVISTREAM*avis,DWORD fccType,LONG lParam) {
FIXME_(avifile)("(%p)->GetStream(%p,0x%08lx,%ld)\n",iface,avis,fccType,lParam);
/* FIXME: create interface etc. */
return E_FAIL;
}
static HRESULT WINAPI IAVIFile_fnCreateStream(IAVIFile*iface,PAVISTREAM*avis,AVISTREAMINFOW*asi) {
ICOM_THIS(IAVIStreamImpl,iface);
char fcc[5];
IAVIStreamImpl *istream;
FIXME_(avifile)("(%p,%p,%p)\n",This,avis,asi);
istream = (IAVIStreamImpl*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IAVIStreamImpl));
istream->ref = 1;
istream->lpvtbl = &iavist;
fcc[4]='\0';
memcpy(fcc,(char*)&(asi->fccType),4);
FIXME_(avifile)("\tfccType '%s'\n",fcc);
memcpy(fcc,(char*)&(asi->fccHandler),4);
FIXME_(avifile)("\tfccHandler '%s'\n",fcc);
FIXME_(avifile)("\tdwFlags 0x%08lx\n",asi->dwFlags);
FIXME_(avifile)("\tdwCaps 0x%08lx\n",asi->dwCaps);
FIXME_(avifile)("\tname '%s'\n",debugstr_w(asi->szName));
istream->curframe = 0;
*avis = (PAVISTREAM)istream;
return S_OK;
}
static HRESULT WINAPI IAVIFile_fnWriteData(IAVIFile*iface,DWORD ckid,LPVOID lpData,LONG size) {
FIXME_(avifile)("(%p)->WriteData(0x%08lx,%p,%ld)\n",iface,ckid,lpData,size);
/* FIXME: write data to file */
return E_FAIL;
}
static HRESULT WINAPI IAVIFile_fnReadData(IAVIFile*iface,DWORD ckid,LPVOID lpData,LONG *size) {
FIXME_(avifile)("(%p)->ReadData(0x%08lx,%p,%p)\n",iface,ckid,lpData,size);
/* FIXME: read at most size bytes from file */
return E_FAIL;
}
static HRESULT WINAPI IAVIFile_fnEndRecord(IAVIFile*iface) {
FIXME_(avifile)("(%p)->EndRecord()\n",iface);
/* FIXME: end record? */
return E_FAIL;
}
static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile*iface,DWORD fccType,LONG lParam) {
FIXME_(avifile)("(%p)->DeleteStream(0x%08lx,%ld)\n",iface,fccType,lParam);
/* FIXME: delete stream? */
return E_FAIL;
}
struct ICOM_VTABLE(IAVIFile) iavift = {
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
IAVIFile_fnQueryInterface,
IAVIFile_fnAddRef,
IAVIFile_fnRelease,
IAVIFile_fnInfo,
IAVIFile_fnGetStream,
IAVIFile_fnCreateStream,
IAVIFile_fnWriteData,
IAVIFile_fnReadData,
IAVIFile_fnEndRecord,
IAVIFile_fnDeleteStream
};
HRESULT WINAPI AVIFileOpenA(
PAVIFILE * ppfile,LPCSTR szFile,UINT uMode,LPCLSID lpHandler
) {
char buf[80];
IAVIFileImpl *iavi;
if (HIWORD(lpHandler))
WINE_StringFromCLSID(lpHandler,buf);
else
sprintf(buf,"<clsid-0x%04lx>",(DWORD)lpHandler);
FIXME_(avifile)("(%p,%s,0x%08lx,%s),stub!\n",ppfile,szFile,(DWORD)uMode,buf);
iavi = (IAVIFileImpl*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IAVIFileImpl));
iavi->ref = 1;
iavi->lpvtbl = &iavift;
*ppfile = (LPVOID)iavi;
return S_OK;
}
static HRESULT WINAPI IAVIStream_fnQueryInterface(IAVIStream*iface,REFIID refiid,LPVOID *obj) {
ICOM_THIS(IAVIStreamImpl,iface);
char xrefiid[50];
WINE_StringFromCLSID((LPCLSID)refiid,xrefiid);
TRACE_(relay)("(%p)->QueryInterface(%s,%p)\n",This,xrefiid,obj);
if ( !memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown)) ||
!memcmp(&IID_IAVIStream,refiid,sizeof(IID_IAVIStream))
) {
*obj = This;
return S_OK;
}
/* can return IGetFrame interface too */
return OLE_E_ENUM_NOMORE;
}
static ULONG WINAPI IAVIStream_fnAddRef(IAVIStream*iface) {
ICOM_THIS(IAVIStreamImpl,iface);
FIXME_(relay)("(%p)->AddRef()\n",iface);
return ++(This->ref);
}
static ULONG WINAPI IAVIStream_fnRelease(IAVIStream* iface) {
ICOM_THIS(IAVIStreamImpl,iface);
FIXME_(relay)("(%p)->Release()\n",iface);
if (!--(This->ref)) {
HeapFree(GetProcessHeap(),0,This);
return 0;
}
return This->ref;
}
HRESULT WINAPI IAVIStream_fnCreate(IAVIStream*iface,LPARAM lParam1,LPARAM lParam2) {
FIXME_(avifile)("(%p)->Create(0x%08lx,0x%08lx)\n",iface,lParam1,lParam2);
return E_FAIL;
}
HRESULT WINAPI IAVIStream_fnInfo(IAVIStream*iface,AVISTREAMINFOW *psi,LONG size) {
FIXME_(avifile)("(%p)->Info(%p,%ld)\n",iface,psi,size);
return E_FAIL;
}
LONG WINAPI IAVIStream_fnFindSample(IAVIStream*iface,LONG pos,LONG flags) {
FIXME_(avifile)("(%p)->FindSample(%ld,0x%08lx)\n",iface,pos,flags);
return E_FAIL;
}
HRESULT WINAPI IAVIStream_fnReadFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG *formatsize) {
FIXME_(avifile)("(%p)->ReadFormat(%ld,%p,%p)\n",iface,pos,format,formatsize);
return E_FAIL;
}
/*****************************************************************************
* [IAVIStream::SetFormat]
*/
HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG formatsize) {
IAVIStreamImpl *as = (IAVIStreamImpl*)iface;
FIXME_(avifile)("(%p)->SetFormat(%ld,%p,%ld)\n",iface,pos,format,formatsize);
if (as->lpInputFormat) HeapFree(GetProcessHeap(),0,as->lpInputFormat);
as->inputformatsize = formatsize;
as->lpInputFormat = HeapAlloc(GetProcessHeap(),0,formatsize);
memcpy(as->lpInputFormat,format,formatsize);
if (as->iscompressing) {
int xsize;
/* Set up the Compressor part */
xsize = ICCompressGetFormatSize(as->hic,as->lpInputFormat);
as->lpCompressFormat = HeapAlloc(GetProcessHeap(),0,xsize);
ICCompressGetFormat(as->hic,as->lpInputFormat,as->lpCompressFormat);
ICCompressBegin(as->hic,as->lpInputFormat,as->lpCompressFormat);
as->compbufsize = ICCompressGetSize(as->hic,as->lpInputFormat,as->lpCompressFormat);
as->compbuffer = HeapAlloc(GetProcessHeap(),0,as->compbufsize);
/* Set up the Decompressor part (for prev frames?) */
xsize=ICDecompressGetFormatSize(as->hic,as->lpCompressFormat);
as->decompformat = HeapAlloc(GetProcessHeap(),0,xsize);
ICDecompressGetFormat(as->hic,as->lpCompressFormat,as->decompformat);
as->decompbufsize=((LPBITMAPINFOHEADER)as->decompbuffer)->biSizeImage;
as->decompbuffer = HeapReAlloc(GetProcessHeap(),0,as->decompbuffer,as->decompbufsize);
memset(as->decompbuffer,0xff,as->decompbufsize);
assert(HeapValidate(GetProcessHeap(),0,NULL));
ICDecompressGetFormat(as->hic,as->lpCompressFormat,as->decompformat);
ICDecompressBegin(as->hic,as->lpCompressFormat,as->decompformat);
as->lpPrev = as->lpPrevFormat = NULL;
}
return S_OK;
}
HRESULT WINAPI IAVIStream_fnRead(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread) {
FIXME_(avifile)("(%p)->Read(%ld,%ld,%p,%ld,%p,%p)\n",iface,start,samples,buffer,buffersize,bytesread,samplesread);
return E_FAIL;
}
HRESULT WINAPI IAVIStream_fnWrite(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,DWORD flags,LONG *sampwritten,LONG *byteswritten) {
IAVIStreamImpl *as = (IAVIStreamImpl*)iface;
DWORD ckid,xflags;
FIXME_(avifile)("(%p)->Write(%ld,%ld,%p,%ld,0x%08lx,%p,%p)\n",iface,start,samples,buffer,buffersize,flags,sampwritten,byteswritten);
ICCompress(
as->hic,flags,
as->lpCompressFormat,
as->compbuffer,
as->lpInputFormat,buffer,
&ckid,&xflags,
as->curframe,0xffffff/*framesize*/,as->aco.dwQuality,
as->lpPrevFormat,as->lpPrev
);
ICDecompress(
as->hic,
flags, /* FIXME: check */
as->lpCompressFormat,
as->compbuffer,
as->decompformat,
as->decompbuffer
);
/* We now have a prev format for the next compress ... */
as->lpPrevFormat = as->decompformat;
as->lpPrev = as->decompbuffer;
return S_OK;
}
HRESULT WINAPI IAVIStream_fnDelete(IAVIStream*iface,LONG start,LONG samples) {
FIXME_(avifile)("(%p)->Delete(%ld,%ld)\n",iface,start,samples);
return E_FAIL;
}
HRESULT WINAPI IAVIStream_fnReadData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG *lpread) {
FIXME_(avifile)("(%p)->ReadData(0x%08lx,%p,%p)\n",iface,fcc,lp,lpread);
return E_FAIL;
}
HRESULT WINAPI IAVIStream_fnWriteData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG size) {
FIXME_(avifile)("(%p)->WriteData(0x%08lx,%p,%ld)\n",iface,fcc,lp,size);
return E_FAIL;
}
HRESULT WINAPI IAVIStream_fnSetInfo(IAVIStream*iface,AVISTREAMINFOW*info,LONG infolen) {
FIXME_(avifile)("(%p)->SetInfo(%p,%ld)\n",iface,info,infolen);
return E_FAIL;
}
struct ICOM_VTABLE(IAVIStream) iavist = {
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
IAVIStream_fnQueryInterface,
IAVIStream_fnAddRef,
IAVIStream_fnRelease,
IAVIStream_fnCreate,
IAVIStream_fnInfo,
IAVIStream_fnFindSample,
IAVIStream_fnReadFormat,
IAVIStream_fnSetFormat,
IAVIStream_fnRead,
IAVIStream_fnWrite,
IAVIStream_fnDelete,
IAVIStream_fnReadData,
IAVIStream_fnWriteData,
IAVIStream_fnSetInfo
};
HRESULT WINAPI AVIFileCreateStreamA(PAVIFILE iface,PAVISTREAM *ppavi,AVISTREAMINFOA * psi) {
AVISTREAMINFOW psiw;
/* Only the szName at the end is different */
memcpy(&psiw,psi,sizeof(*psi)-sizeof(psi->szName));
lstrcpynAtoW(psiw.szName,psi->szName,sizeof(psi->szName));
return iface->lpvtbl->fnCreateStream(iface,ppavi,&psiw);
}
HRESULT WINAPI AVIFileCreateStreamW(IAVIFile*iface,PAVISTREAM*avis,AVISTREAMINFOW*asi) {
return iface->lpvtbl->fnCreateStream(iface,avis,asi);
}
HRESULT WINAPI AVIFileGetStream(IAVIFile*iface,PAVISTREAM*avis,DWORD fccType,LONG lParam) {
return iface->lpvtbl->fnGetStream(iface,avis,fccType,lParam);
}
HRESULT WINAPI AVIFileInfoA(PAVIFILE iface,LPAVIFILEINFOA afi,LONG size) {
AVIFILEINFOW afiw;
HRESULT hres;
if (size < sizeof(AVIFILEINFOA))
return AVIERR_BADSIZE;
hres = iface->lpvtbl->fnInfo(iface,&afiw,sizeof(afiw));
memcpy(afi,&afiw,sizeof(*afi)-sizeof(afi->szFileType));
lstrcpynWtoA(afi->szFileType,afiw.szFileType,sizeof(afi->szFileType));
return hres;
}
HRESULT WINAPI AVIStreamInfoW(PAVISTREAM iface,AVISTREAMINFOW *asi,LONG
size) {
return iface->lpvtbl->fnInfo(iface,asi,size);
}
HRESULT WINAPI AVIStreamInfoA(PAVISTREAM iface,AVISTREAMINFOA *asi,LONG
size) {
AVISTREAMINFOW asiw;
HRESULT hres;
if (size<sizeof(AVISTREAMINFOA))
return AVIERR_BADSIZE;
hres = iface->lpvtbl->fnInfo(iface,&asiw,sizeof(asiw));
memcpy(asi,&asiw,sizeof(asiw)-sizeof(asiw.szName));
lstrcpynWtoA(asi->szName,asiw.szName,sizeof(asi->szName));
return hres;
}
HRESULT WINAPI AVIFileInfoW(PAVIFILE iface,LPAVIFILEINFOW afi,LONG size) {
return iface->lpvtbl->fnInfo(iface,afi,size);
}
HRESULT WINAPI AVIMakeCompressedStream(PAVISTREAM *ppsCompressed,PAVISTREAM ppsSource,AVICOMPRESSOPTIONS *aco,CLSID *pclsidHandler) {
char fcc[5];
IAVIStreamImpl *as;
FIXME_(avifile)("(%p,%p,%p,%p)\n",ppsCompressed,ppsSource,aco,pclsidHandler);
fcc[4]='\0';
memcpy(fcc,&(aco->fccType),4);
FIXME_(avifile)("\tfccType: '%s'\n",fcc);
memcpy(fcc,&(aco->fccHandler),4);
FIXME_(avifile)("\tfccHandler: '%s'\n",fcc);
FIXME_(avifile)("\tdwFlags: 0x%08lx\n",aco->dwFlags);
/* we just create a duplicate for now */
((IUnknown*)ppsSource)->lpvtbl->fnAddRef((IUnknown*)ppsSource);
*ppsCompressed = ppsSource;
as = (IAVIStreamImpl*)ppsSource;
/* this is where the fun begins. Open a compressor and prepare it. */
as->hic = ICOpen(aco->fccType,aco->fccHandler,ICMODE_COMPRESS);
/* May happen. for instance if the codec is not able to compress */
if (!as->hic)
return AVIERR_UNSUPPORTED;
ICGetInfo(as->hic,&(as->icinfo),sizeof(ICINFO));
FIXME_(avifile)("Opened compressor: '%s' '%s'\n",debugstr_w(as->icinfo.szName),debugstr_w(as->icinfo.szDescription));
as->iscompressing = TRUE;
memcpy(&(as->aco),aco,sizeof(*aco));
if (as->icinfo.dwFlags & VIDCF_COMPRESSFRAMES) {
ICCOMPRESSFRAMES icf;
/* now what to fill in there ... Hmm */
memset(&icf,0,sizeof(icf));
icf.lDataRate = aco->dwBytesPerSecond;
icf.lQuality = aco->dwQuality;
icf.lKeyRate = aco->dwKeyFrameEvery;
icf.GetData = (LONG (*)(LPARAM,LONG,LPVOID,LONG)) 0xdead4242;
icf.PutData = (LONG (*)(LPARAM,LONG,LPVOID,LONG)) 0xdead4243;
ICSendMessage(as->hic,ICM_COMPRESS_FRAMES_INFO,(LPARAM)&icf,sizeof(icf));
}
return S_OK;
}
HRESULT WINAPI AVIStreamSetFormat(PAVISTREAM iface,LONG pos,LPVOID format,LONG formatsize) {
return iface->lpvtbl->fnSetFormat(iface,pos,format,formatsize);
}
HRESULT WINAPI AVIStreamReadFormat(PAVISTREAM iface,LONG pos,LPVOID format,LONG *formatsize) {
return iface->lpvtbl->fnReadFormat(iface,pos,format,formatsize);
}
HRESULT WINAPI AVIStreamWrite(PAVISTREAM iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,DWORD flags,LONG *sampwritten,LONG *byteswritten) {
return iface->lpvtbl->fnWrite(iface,start,samples,buffer,buffersize,flags,sampwritten,byteswritten);
}
HRESULT WINAPI AVIStreamRead(PAVISTREAM iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread) {
return iface->lpvtbl->fnRead(iface,start,samples,buffer,buffersize,bytesread,samplesread);
}
HRESULT WINAPI AVIStreamWriteData(PAVISTREAM iface,DWORD fcc,LPVOID lp,LONG size) {
return iface->lpvtbl->fnWriteData(iface,fcc,lp,size);
}
HRESULT WINAPI AVIStreamReadData(PAVISTREAM iface,DWORD fcc,LPVOID lp,LONG *lpread) {
return iface->lpvtbl->fnReadData(iface,fcc,lp,lpread);
}
LONG WINAPI AVIStreamStart(PAVISTREAM iface) {
AVISTREAMINFOW si;
iface->lpvtbl->fnInfo(iface,&si,sizeof(si));
return si.dwStart;
}
LONG WINAPI AVIStreamLength(PAVISTREAM iface) {
AVISTREAMINFOW si;
HRESULT ret;
ret = iface->lpvtbl->fnInfo(iface,&si,sizeof(si));
if (ret) /* error */
return 1;
return si.dwLength;
}
ULONG WINAPI AVIStreamRelease(PAVISTREAM iface) {
return ((LPUNKNOWN)iface)->lpvtbl->fnRelease((LPUNKNOWN)iface);
}
PGETFRAME WINAPI AVIStreamGetFrameOpen(PAVISTREAM iface,LPBITMAPINFOHEADER bmi) {
FIXME_(msvideo)("(%p)->(%p),stub!\n",iface,bmi);
return NULL;
}
LPVOID WINAPI AVIStreamGetFrame(PGETFRAME pg,LONG pos) {
return pg->lpvtbl->fnGetFrame(pg,pos);
}
HRESULT WINAPI AVIStreamGetFrameClose(PGETFRAME pg) {
if (pg) ((LPUNKNOWN)pg)->lpvtbl->fnRelease((LPUNKNOWN)pg);
return 0;
}
ULONG WINAPI AVIFileRelease(PAVIFILE iface) {
return ((LPUNKNOWN)iface)->lpvtbl->fnRelease((LPUNKNOWN)iface);
}
void WINAPI AVIFileExit(void) {
FIXME_(avifile)("(), stub.\n");
}
wine-990704/dlls/comctl32/ 40755 771 771 0 6737705664 14770 5 ustar julliard julliard wine-990704/dlls/comctl32/.cvsignore 100644 771 771 20 6710660424 16776 0 ustar julliard julliard Makefile
rsrc.s
wine-990704/dlls/comctl32/Makefile.in 100644 771 771 1156 6710660424 17116 0 ustar julliard julliard DEFS = @DLLFLAGS@ -D__WINE__
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = comctl32
WRCEXTRA = -s -p$(MODULE)
C_SRCS = \
animate.c \
comboex.c \
comctl32undoc.c \
commctrl.c \
datetime.c \
draglist.c \
flatsb.c \
header.c \
hotkey.c \
imagelist.c \
ipaddress.c \
listview.c \
monthcal.c \
nativefont.c \
pager.c \
progress.c \
propsheet.c \
rebar.c \
status.c \
tab.c \
toolbar.c \
tooltips.c \
trackbar.c \
treeview.c \
updown.c
RC_SRCS= \
rsrc.rc
all: check_wrc $(MODULE).o
@MAKE_RULES@
$(RC_SRCS:.rc=.s): $(WRC)
### Dependencies:
wine-990704/dlls/comctl32/animate.c 100644 771 771 14336 6735165221 16661 0 ustar julliard julliard /*
* Animation control
*
* Copyright 1998, 1999 Eric Kohl
*
* NOTES
* This is just a dummy control. An author is needed! Any volunteers?
* I will only improve this control once in a while.
* Eric <ekohl@abo.rhein-zeitung.de>
*
* TODO:
* - All messages.
* - All notifications.
*/
#include "winbase.h"
#include "commctrl.h"
#include "animate.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(animate)
#define ANIMATE_GetInfoPtr(hwnd) ((ANIMATE_INFO *)GetWindowLongA (hwnd, 0))
static BOOL
ANIMATE_LoadResA (ANIMATE_INFO *infoPtr, HINSTANCE hInst, LPSTR lpName)
{
HRSRC hrsrc;
HGLOBAL handle;
hrsrc = FindResourceA (hInst, lpName, "AVI");
if (!hrsrc)
return FALSE;
handle = LoadResource (hInst, hrsrc);
if (!handle)
return FALSE;
infoPtr->lpAvi = LockResource (handle);
if (!infoPtr->lpAvi)
return FALSE;
return TRUE;
}
static BOOL
ANIMATE_LoadFileA (ANIMATE_INFO *infoPtr, LPSTR lpName)
{
HANDLE handle;
infoPtr->hFile =
CreateFileA (lpName, GENERIC_READ, 0, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, 0);
if (!infoPtr->hFile)
return FALSE;
handle =
CreateFileMappingA (infoPtr->hFile, NULL, PAGE_READONLY | SEC_COMMIT,
0, 0, NULL);
if (!handle) {
CloseHandle (infoPtr->hFile);
infoPtr->hFile = 0;
return FALSE;
}
infoPtr->lpAvi = MapViewOfFile (handle, FILE_MAP_READ, 0, 0, 0);
if (!infoPtr->lpAvi) {
CloseHandle (infoPtr->hFile);
infoPtr->hFile = 0;
return FALSE;
}
return TRUE;
}
static VOID
ANIMATE_Free (ANIMATE_INFO *infoPtr)
{
if (infoPtr->hFile) {
UnmapViewOfFile (infoPtr->lpAvi);
CloseHandle (infoPtr->hFile);
infoPtr->lpAvi = NULL;
}
else {
GlobalFree ((HGLOBAL)infoPtr->lpAvi);
infoPtr->lpAvi = NULL;
}
}
static VOID
ANIMATE_GetAviInfo (ANIMATE_INFO *infoPtr)
{
}
static LRESULT
ANIMATE_OpenA (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hwnd);
HINSTANCE hInstance = (HINSTANCE)wParam;
ANIMATE_Free (infoPtr);
if (!lParam) {
TRACE("closing avi!\n");
return TRUE;
}
if (HIWORD(lParam)) {
FIXME("(\"%s\") empty stub!\n", (LPSTR)lParam);
if (ANIMATE_LoadResA (infoPtr, hInstance, (LPSTR)lParam)) {
FIXME("AVI resource found!\n");
}
else {
FIXME("No AVI resource found!\n");
if (ANIMATE_LoadFileA (infoPtr, (LPSTR)lParam)) {
FIXME("AVI file found!\n");
}
else {
FIXME("No AVI file found!\n");
return FALSE;
}
}
}
else {
FIXME("(%u) empty stub!\n", (WORD)LOWORD(lParam));
if (ANIMATE_LoadResA (infoPtr, hInstance,
MAKEINTRESOURCEA((INT)lParam))) {
FIXME("AVI resource found!\n");
}
else {
FIXME("No AVI resource found!\n");
return FALSE;
}
}
ANIMATE_GetAviInfo (infoPtr);
return TRUE;
}
/* << ANIMATE_Open32W >> */
static LRESULT
ANIMATE_Play (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
/* ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hwnd); */
INT nFrom = (INT)LOWORD(lParam);
INT nTo = (INT)HIWORD(lParam);
INT nRepeat = (INT)wParam;
#if 0
/* nothing opened */
if (...)
return FALSE;
#endif
if (nRepeat == -1) {
FIXME("(loop from=%d to=%d) empty stub!\n",
nFrom, nTo);
}
else {
FIXME("(repeat=%d from=%d to=%d) empty stub!\n",
nRepeat, nFrom, nTo);
}
return TRUE;
}
static LRESULT
ANIMATE_Stop (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
/* ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hwnd); */
#if 0
/* nothing opened */
if (...)
return FALSE;
#endif
return TRUE;
}
static LRESULT
ANIMATE_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
ANIMATE_INFO *infoPtr;
/* allocate memory for info structure */
infoPtr = (ANIMATE_INFO *)COMCTL32_Alloc (sizeof(ANIMATE_INFO));
if (!infoPtr) {
ERR("could not allocate info memory!\n");
return 0;
}
/* store pointer to info structure */
SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
/* set default settings */
return 0;
}
static LRESULT
ANIMATE_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hwnd);
/* free avi data */
ANIMATE_Free (infoPtr);
/* free animate info data */
COMCTL32_Free (infoPtr);
return 0;
}
#if 0
static LRESULT
ANIMATE_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hwnd);
/*
HBRUSH32 hBrush = CreateSolidBrush32 (infoPtr->clrBk);
RECT32 rect;
GetClientRect32 (wndPtr->hwndSelf, &rect);
FillRect32 ((HDC32)wParam, &rect, hBrush);
DeleteObject32 (hBrush);
*/
return TRUE;
}
#endif
LRESULT WINAPI
ANIMATE_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case ACM_OPENA:
return ANIMATE_OpenA (hwnd, wParam, lParam);
/* case ACM_OPEN32W: */
/* return ANIMATE_Open32W (hwnd, wParam, lParam); */
case ACM_PLAY:
return ANIMATE_Play (hwnd, wParam, lParam);
case ACM_STOP:
return ANIMATE_Stop (hwnd, wParam, lParam);
case WM_CREATE:
return ANIMATE_Create (hwnd, wParam, lParam);
case WM_DESTROY:
return ANIMATE_Destroy (hwnd, wParam, lParam);
/* case WM_ERASEBKGND: */
/* return ANIMATE_EraseBackground (hwnd, wParam, lParam); */
/* case WM_NCCREATE: */
/* case WM_NCHITTEST: */
/* case WM_PAINT: */
/* case WM_SIZE: */
/* case WM_STYLECHANGED: */
/* case WM_TIMER: */
default:
if (uMsg >= WM_USER)
ERR("unknown msg %04x wp=%08x lp=%08lx\n",
uMsg, wParam, lParam);
return DefWindowProcA (hwnd, uMsg, wParam, lParam);
}
return 0;
}
VOID
ANIMATE_Register (void)
{
WNDCLASSA wndClass;
if (GlobalFindAtomA (ANIMATE_CLASSA)) return;
ZeroMemory (&wndClass, sizeof(WNDCLASSA));
wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
wndClass.lpfnWndProc = (WNDPROC)ANIMATE_WindowProc;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = sizeof(ANIMATE_INFO *);
wndClass.hCursor = LoadCursorA (0, IDC_ARROWA);
wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
wndClass.lpszClassName = ANIMATE_CLASSA;
RegisterClassA (&wndClass);
}
VOID
ANIMATE_Unregister (void)
{
if (GlobalFindAtomA (ANIMATE_CLASSA))
UnregisterClassA (ANIMATE_CLASSA, (HINSTANCE)NULL);
}
wine-990704/dlls/comctl32/comboex.c 100644 771 771 15745 6730500266 16701 0 ustar julliard julliard /*
* ComboBoxEx control
*
* Copyright 1998, 1999 Eric Kohl
*
* NOTES
* This is just a dummy control. An author is needed! Any volunteers?
* I will only improve this control once in a while.
* Eric <ekohl@abo.rhein-zeitung.de>
*
* TODO:
* - All messages.
* - All notifications.
*
* FIXME:
* - should include "combo.h"
*/
#include "winbase.h"
#include "commctrl.h"
#include "comboex.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(comboex)
#define ID_CB_EDIT 1001
#define COMBOEX_GetInfoPtr(wndPtr) ((COMBOEX_INFO *)GetWindowLongA (hwnd, 0))
/* << COMBOEX_DeleteItem >> */
inline static LRESULT
COMBOEX_GetComboControl (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
TRACE("\n");
return (LRESULT)infoPtr->hwndCombo;
}
inline static LRESULT
COMBOEX_GetEditControl (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
if ((GetWindowLongA (hwnd, GWL_STYLE) & CBS_DROPDOWNLIST) != CBS_DROPDOWN)
return 0;
TRACE("-- 0x%x\n", GetDlgItem (infoPtr->hwndCombo, ID_CB_EDIT));
return (LRESULT)GetDlgItem (infoPtr->hwndCombo, ID_CB_EDIT);
}
inline static LRESULT
COMBOEX_GetExtendedStyle (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
return (LRESULT)infoPtr->dwExtStyle;
}
inline static LRESULT
COMBOEX_GetImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
TRACE("(0x%08x 0x%08lx)\n", wParam, lParam);
return (LRESULT)infoPtr->himl;
}
static LRESULT
COMBOEX_InsertItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
/* COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); */
FIXME("(0x%08x 0x%08lx)\n", wParam, lParam);
return -1;
}
static LRESULT
COMBOEX_SetExtendedStyle (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
DWORD dwTemp;
TRACE("(0x%08x 0x%08lx)\n", wParam, lParam);
dwTemp = infoPtr->dwExtStyle;
if ((DWORD)wParam) {
infoPtr->dwExtStyle = (infoPtr->dwExtStyle & ~(DWORD)wParam) | (DWORD)lParam;
}
else
infoPtr->dwExtStyle = (DWORD)lParam;
/* FIXME: repaint?? */
return (LRESULT)dwTemp;
}
inline static LRESULT
COMBOEX_SetImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
HIMAGELIST himlTemp;
TRACE("(0x%08x 0x%08lx)\n", wParam, lParam);
himlTemp = infoPtr->himl;
infoPtr->himl = (HIMAGELIST)lParam;
return (LRESULT)himlTemp;
}
static LRESULT
COMBOEX_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
/* COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); */
FIXME("(%p): stub\n", (LPVOID)lParam);
return TRUE;
}
/* << COMBOEX_SetItem32W >> */
inline static LRESULT
COMBOEX_Forward (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
FIXME("(0x%x 0x%x 0x%lx): stub\n", uMsg, wParam, lParam);
if (infoPtr->hwndCombo)
return SendMessageA (infoPtr->hwndCombo, uMsg, wParam, lParam);
return 0;
}
static LRESULT
COMBOEX_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
COMBOEX_INFO *infoPtr;
DWORD dwComboStyle;
/* allocate memory for info structure */
infoPtr = (COMBOEX_INFO *)COMCTL32_Alloc (sizeof(COMBOEX_INFO));
if (infoPtr == NULL) {
ERR("could not allocate info memory!\n");
return 0;
}
SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
/* initialize info structure */
/* create combo box */
dwComboStyle = GetWindowLongA (hwnd, GWL_STYLE) &
(CBS_SIMPLE|CBS_DROPDOWN|CBS_DROPDOWNLIST|WS_CHILD);
infoPtr->hwndCombo = CreateWindowA ("ComboBox", "",
WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED | dwComboStyle,
0, 0, 0, 0, hwnd, (HMENU)1,
GetWindowLongA (hwnd, GWL_HINSTANCE), NULL);
return 0;
}
static LRESULT
COMBOEX_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
if (infoPtr->hwndCombo)
DestroyWindow (infoPtr->hwndCombo);
/* free comboex info data */
COMCTL32_Free (infoPtr);
return 0;
}
static LRESULT
COMBOEX_Size (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
RECT rect;
GetClientRect (hwnd, &rect);
MoveWindow (infoPtr->hwndCombo, 0, 0, rect.right -rect.left,
rect.bottom - rect.top, TRUE);
return 0;
}
LRESULT WINAPI
COMBOEX_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
/* case CBEM_DELETEITEM: */
case CBEM_GETCOMBOCONTROL:
return COMBOEX_GetComboControl (hwnd, wParam, lParam);
case CBEM_GETEDITCONTROL:
return COMBOEX_GetEditControl (hwnd, wParam, lParam);
case CBEM_GETEXTENDEDSTYLE:
return COMBOEX_GetExtendedStyle (hwnd, wParam, lParam);
case CBEM_GETIMAGELIST:
return COMBOEX_GetImageList (hwnd, wParam, lParam);
/* case CBEM_GETITEM32A:
case CBEM_GETITEM32W:
case CBEM_GETUNICODEFORMAT:
case CBEM_HASEDITCHANGED:
*/
case CBEM_INSERTITEMA:
return COMBOEX_InsertItemA (hwnd, wParam, lParam);
/* case CBEM_INSERTITEM32W: */
case CBEM_SETEXTENDEDSTYLE:
return COMBOEX_SetExtendedStyle (hwnd, wParam, lParam);
case CBEM_SETIMAGELIST:
return COMBOEX_SetImageList (hwnd, wParam, lParam);
case CBEM_SETITEMA:
return COMBOEX_SetItemA (hwnd, wParam, lParam);
/* case CBEM_SETITEM32W:
case CBEM_SETUNICODEFORMAT:
*/
case CB_DELETESTRING:
case CB_FINDSTRINGEXACT:
case CB_GETCOUNT:
case CB_GETCURSEL:
case CB_GETDROPPEDCONTROLRECT:
case CB_GETDROPPEDSTATE:
case CB_GETITEMDATA:
case CB_GETITEMHEIGHT:
case CB_GETLBTEXT:
case CB_GETLBTEXTLEN:
case CB_GETEXTENDEDUI:
case CB_LIMITTEXT:
case CB_RESETCONTENT:
case CB_SELECTSTRING:
case CB_SETCURSEL:
case CB_SETDROPPEDWIDTH:
case CB_SETEXTENDEDUI:
case CB_SETITEMDATA:
case CB_SETITEMHEIGHT:
case CB_SHOWDROPDOWN:
return COMBOEX_Forward (hwnd, uMsg, wParam, lParam);
case WM_CREATE:
return COMBOEX_Create (hwnd, wParam, lParam);
case WM_DESTROY:
return COMBOEX_Destroy (hwnd, wParam, lParam);
case WM_SIZE:
return COMBOEX_Size (hwnd, wParam, lParam);
default:
if (uMsg >= WM_USER)
ERR("unknown msg %04x wp=%08x lp=%08lx\n",
uMsg, wParam, lParam);
return DefWindowProcA (hwnd, uMsg, wParam, lParam);
}
return 0;
}
VOID
COMBOEX_Register (void)
{
WNDCLASSA wndClass;
if (GlobalFindAtomA (WC_COMBOBOXEXA)) return;
ZeroMemory (&wndClass, sizeof(WNDCLASSA));
wndClass.style = CS_GLOBALCLASS;
wndClass.lpfnWndProc = (WNDPROC)COMBOEX_WindowProc;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = sizeof(COMBOEX_INFO *);
wndClass.hCursor = LoadCursorA (0, IDC_ARROWA);
wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wndClass.lpszClassName = WC_COMBOBOXEXA;
RegisterClassA (&wndClass);
}
VOID
COMBOEX_Unregister (void)
{
if (GlobalFindAtomA (WC_COMBOBOXEXA))
UnregisterClassA (WC_COMBOBOXEXA, (HINSTANCE)NULL);
}
wine-990704/dlls/comctl32/comctl32.h 100644 771 771 1257 6721506157 16656 0 ustar julliard julliard /******************************************************************************
*
* Common definitions (resource ids and global variables)
*
* Copyright 1999 Thuy Nguyen
* Copyright 1999 Eric Kohl
*
*/
extern HMODULE COMCTL32_hModule;
/* Property sheet / Wizard */
#define IDD_PROPSHEET 1006
#define IDD_WIZARD 1020
#define IDC_TABCONTROL 12320
#define IDC_APPLY_BUTTON 12321
/* Toolbar customization dialog */
#define IDD_TBCUSTOMIZE 200
#define IDC_AVAILBTN_LBOX 201
#define IDC_RESET_BTN 202
#define IDC_TOOLBARBTN_LBOX 203
#define IDC_REMOVE_BTN 204
#define IDC_HELP_BTN 205
#define IDC_MOVEUP_BTN 206
#define IDC_MOVEDN_BTN 207
wine-990704/dlls/comctl32/comctl32undoc.c 100644 771 771 130023 6735140020 17720 0 ustar julliard julliard /*
* Undocumented functions from COMCTL32.DLL
*
* Copyright 1998 Eric Kohl <ekohl@abo.rhein-zeitung.de>
* 1998 Juergen Schmied <j.schmied@metronet.de>
* NOTES
* All of these functions are UNDOCUMENTED!! And I mean UNDOCUMENTED!!!!
* Do NOT rely on names or contents of undocumented structures and types!!!
* These functions are used by EXPLORER.EXE, IEXPLORE.EXE and
* COMCTL32.DLL (internally).
*
* TODO
* - Add more functions.
* - Write some documentation.
*/
#include <string.h>
#include <stdlib.h> /* atoi */
#include <ctype.h>
#include "winbase.h"
#include "winerror.h"
#include "objbase.h"
#include "commctrl.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(commctrl)
extern HANDLE COMCTL32_hHeap; /* handle to the private heap */
/*
* We put some function prototypes here that don't seem to belong in
* any header file. When they find their place, we can remove them.
*/
extern LPWSTR __cdecl CRTDLL_wcschr(LPCWSTR, WCHAR);
extern LPSTR WINAPI lstrrchr(LPCSTR, LPCSTR, WORD);
extern LPWSTR WINAPI lstrrchrw(LPCWSTR, LPCWSTR, WORD);
extern LPWSTR WINAPI strstrw(LPCWSTR, LPCWSTR);
typedef struct _STREAMDATA
{
DWORD dwSize;
DWORD dwData2;
DWORD dwItems;
} STREAMDATA, *PSTREAMDATA;
typedef struct _LOADDATA
{
INT nCount;
PVOID ptr;
} LOADDATA, *LPLOADDATA;
typedef HRESULT(CALLBACK *DPALOADPROC)(LPLOADDATA,IStream*,LPARAM);
/**************************************************************************
* DPA_LoadStream [COMCTL32.9]
*
* Loads a dynamic pointer array from a stream
*
* PARAMS
* phDpa [O] pointer to a handle to a dynamic pointer array
* loadProc [I] pointer to a callback function
* pStream [I] pointer to a stream
* lParam [I] application specific value
*
* NOTES
* No more information available yet!
*/
HRESULT WINAPI
DPA_LoadStream (HDPA *phDpa, DPALOADPROC loadProc, IStream *pStream, LPARAM lParam)
{
HRESULT errCode;
LARGE_INTEGER position;
ULARGE_INTEGER newPosition;
STREAMDATA streamData;
LOADDATA loadData;
ULONG ulRead;
HDPA hDpa;
PVOID *ptr;
FIXME ("phDpa=%p loadProc=%p pStream=%p lParam=%lx\n",
phDpa, loadProc, pStream, lParam);
if (!phDpa || !loadProc || !pStream)
return E_INVALIDARG;
*phDpa = (HDPA)NULL;
position.LowPart = 0;
position.HighPart = 0;
errCode = IStream_Seek (pStream, position, STREAM_SEEK_CUR, &newPosition);
if (errCode != S_OK)
return errCode;
errCode = IStream_Read (pStream, &streamData, sizeof(STREAMDATA), &ulRead);
if (errCode != S_OK)
return errCode;
FIXME ("dwSize=%lu dwData2=%lu dwItems=%lu\n",
streamData.dwSize, streamData.dwData2, streamData.dwItems);
if (lParam < sizeof(STREAMDATA) ||
streamData.dwSize < sizeof(STREAMDATA) ||
streamData.dwData2 < 1) {
errCode = E_FAIL;
}
/* create the dpa */
hDpa = DPA_Create (streamData.dwItems);
if (!hDpa)
return E_OUTOFMEMORY;
if (!DPA_Grow (hDpa, streamData.dwItems))
return E_OUTOFMEMORY;
/* load data from the stream into the dpa */
ptr = hDpa->ptrs;
for (loadData.nCount = 0; loadData.nCount < streamData.dwItems; loadData.nCount++) {
errCode = (loadProc)(&loadData, pStream, lParam);
if (errCode != S_OK) {
errCode = S_FALSE;
break;
}
*ptr = loadData.ptr;
ptr++;
}
/* set the number of items */
hDpa->nItemCount = loadData.nCount;
/* store the handle to the dpa */
*phDpa = hDpa;
FIXME ("new hDpa=%p\n", hDpa);
return errCode;
}
/**************************************************************************
* DPA_SaveStream [COMCTL32.10]
*
* Saves a dynamic pointer array to a stream
*
* PARAMS
* hDpa [I] handle to a dynamic pointer array
* loadProc [I] pointer to a callback function
* pStream [I] pointer to a stream
* lParam [I] application specific value
*
* NOTES
* No more information available yet!
*/
HRESULT WINAPI
DPA_SaveStream (const HDPA hDpa, DPALOADPROC loadProc, IStream *pStream, LPARAM lParam)
{
FIXME ("hDpa=%p loadProc=%p pStream=%p lParam=%lx\n",
hDpa, loadProc, pStream, lParam);
return E_FAIL;
}
/**************************************************************************
* DPA_Merge [COMCTL32.11]
*
* PARAMS
* hdpa1 [I] handle to a dynamic pointer array
* hdpa2 [I] handle to a dynamic pointer array
* dwFlags [I] flags
* pfnSort [I] pointer to sort function
* pfnMerge [I] pointer to merge function
* lParam [I] application specific value
*
* NOTES
* No more information available yet!
*/
BOOL WINAPI
DPA_Merge (const HDPA hdpa1, const HDPA hdpa2, DWORD dwFlags,
PFNDPACOMPARE pfnCompare, PFNDPAMERGE pfnMerge, LPARAM lParam)
{
LPVOID pWork1, pWork2;
INT nResult;
INT nCount, nIndex;
INT nNewItems;
TRACE("(%p %p %08lx %p %p %08lx): semi stub!\n",
hdpa1, hdpa2, dwFlags, pfnCompare, pfnMerge, lParam);
if (IsBadWritePtr (hdpa1, sizeof(DPA)))
return FALSE;
if (IsBadWritePtr (hdpa2, sizeof(DPA)))
return FALSE;
if (IsBadCodePtr ((FARPROC)pfnCompare))
return FALSE;
if (IsBadCodePtr ((FARPROC)pfnMerge))
return FALSE;
if (dwFlags & DPAM_SORT) {
TRACE("sorting dpa's!\n");
if (hdpa1->nItemCount > 0)
DPA_Sort (hdpa1, pfnCompare, lParam);
TRACE ("dpa 1 sorted!\n");
if (hdpa2->nItemCount > 0)
DPA_Sort (hdpa2, pfnCompare, lParam);
TRACE ("dpa 2 sorted!\n");
}
if (hdpa2->nItemCount < 1)
return TRUE;
TRACE("hdpa1->nItemCount=%d hdpa2->nItemCount=%d\n",
hdpa1->nItemCount, hdpa2->nItemCount);
/* preliminary hack - simply append the pointer list hdpa2 to hdpa1*/
for (nCount = 0; nCount < hdpa2->nItemCount; nCount++)
DPA_InsertPtr (hdpa1, hdpa1->nItemCount + 1, hdpa2->ptrs[nCount]);
#if 0
/* incomplete implementation */
pWork1 = &(hdpa1->ptrs[hdpa1->nItemCount - 1]);
pWork2 = &(hdpa2->ptrs[hdpa2->nItemCount - 1]);
nIndex = hdpa1->nItemCount - 1;
nCount = hdpa2->nItemCount - 1;
do
{
nResult = (pfnCompare)(pWork1, pWork2, lParam);
if (nResult == 0)
{
PVOID ptr;
ptr = (pfnMerge)(1, pWork1, pWork2, lParam);
if (!ptr)
return FALSE;
nCount--;
pWork2--;
pWork1 = ptr;
}
else if (nResult < 0)
{
if (!dwFlags & 8)
{
PVOID ptr;
ptr = DPA_DeletePtr (hdpa1, hdpa1->nItemCount - 1);
(pfnMerge)(2, ptr, NULL, lParam);
}
}
else
{
if (!dwFlags & 4)
{
PVOID ptr;
ptr = (pfnMerge)(3, pWork2, NULL, lParam);
if (!ptr)
return FALSE;
DPA_InsertPtr (hdpa1, nIndex, ptr);
}
nCount--;
pWork2--;
}
nIndex--;
pWork1--;
}
while (nCount >= 0);
#endif
return TRUE;
}
/**************************************************************************
* Alloc [COMCTL32.71]
*
* Allocates memory block from the dll's private heap
*
* PARAMS
* dwSize [I] size of the allocated memory block
*
* RETURNS
* Success: pointer to allocated memory block
* Failure: NULL
*/
LPVOID WINAPI
COMCTL32_Alloc (DWORD dwSize)
{
LPVOID lpPtr;
TRACE("(0x%lx)\n", dwSize);
lpPtr = HeapAlloc (COMCTL32_hHeap, HEAP_ZERO_MEMORY, dwSize);
TRACE("-- ret=%p\n", lpPtr);
return lpPtr;
}
/**************************************************************************
* ReAlloc [COMCTL32.72]
*
* Changes the size of an allocated memory block or allocates a memory
* block using the dll's private heap.
*
* PARAMS
* lpSrc [I] pointer to memory block which will be resized
* dwSize [I] new size of the memory block.
*
* RETURNS
* Success: pointer to the resized memory block
* Failure: NULL
*
* NOTES
* If lpSrc is a NULL-pointer, then COMCTL32_ReAlloc allocates a memory
* block like COMCTL32_Alloc.
*/
LPVOID WINAPI
COMCTL32_ReAlloc (LPVOID lpSrc, DWORD dwSize)
{
LPVOID lpDest;
TRACE("(%p 0x%08lx)\n", lpSrc, dwSize);
if (lpSrc)
lpDest = HeapReAlloc (COMCTL32_hHeap, HEAP_ZERO_MEMORY, lpSrc, dwSize);
else
lpDest = HeapAlloc (COMCTL32_hHeap, HEAP_ZERO_MEMORY, dwSize);
TRACE("-- ret=%p\n", lpDest);
return lpDest;
}
/**************************************************************************
* Free [COMCTL32.73]
*
* Frees an allocated memory block from the dll's private heap.
*
* PARAMS
* lpMem [I] pointer to memory block which will be freed
*
* RETURNS
* Success: TRUE
* Failure: FALSE
*/
BOOL WINAPI
COMCTL32_Free (LPVOID lpMem)
{
TRACE("(%p)\n", lpMem);
return HeapFree (COMCTL32_hHeap, 0, lpMem);
}
/**************************************************************************
* GetSize [COMCTL32.74]
*
* Retrieves the size of the specified memory block from the dll's
* private heap.
*
* PARAMS
* lpMem [I] pointer to an allocated memory block
*
* RETURNS
* Success: size of the specified memory block
* Failure: 0
*/
DWORD WINAPI
COMCTL32_GetSize (LPVOID lpMem)
{
TRACE("(%p)\n", lpMem);
return HeapSize (COMCTL32_hHeap, 0, lpMem);
}
/**************************************************************************
* The MRU-API is a set of functions to manipulate MRU(Most Recently Used)
* lists.
*
*
*/
typedef struct tagMRUINFO
{
DWORD dwParam1;
DWORD dwParam2;
DWORD dwParam3;
HKEY hkeyMain;
LPCSTR lpszSubKey;
DWORD dwParam6;
} MRUINFO, *LPMRUINFO;
typedef struct tagMRU
{
DWORD dwParam1; /* some kind of flag */
DWORD dwParam2;
DWORD dwParam3;
HKEY hkeyMRU;
LPCSTR lpszSubKey;
DWORD dwParam6;
} MRU, *HMRU;
LPVOID WINAPI
CreateMRUListLazyA (LPMRUINFO lpmi, DWORD dwParam2,
DWORD dwParam3, DWORD dwParam4);
/**************************************************************************
* CreateMRUListA [COMCTL32.151]
*
* PARAMS
* dwParam
*
* RETURNS
*/
LPVOID WINAPI
CreateMRUListA (LPMRUINFO lpmi)
{
return CreateMRUListLazyA (lpmi, 0, 0, 0);
}
DWORD WINAPI
FreeMRUListA (HMRU hmru)
{
FIXME("(%p) empty stub!\n", hmru);
#if 0
if (!(hmru->dwParam1 & 1001)) {
RegSetValueExA (hmru->hKeyMRU, "MRUList", 0, REG_SZ,
hmru->lpszMRUString,
lstrlenA (hmru->lpszMRUString));
}
RegClosKey (hmru->hkeyMRU
COMCTL32_Free32 (hmru->lpszMRUString);
#endif
return COMCTL32_Free (hmru);
}
DWORD WINAPI
AddMRUData (DWORD dwParam1, DWORD dwParam2, DWORD dwParam3)
{
FIXME("(%lx %lx %lx) empty stub!\n",
dwParam1, dwParam2, dwParam3);
return 0;
}
DWORD WINAPI
FindMRUData (DWORD dwParam1, DWORD dwParam2, DWORD dwParam3, DWORD dwParam4)
{
FIXME("(%lx %lx %lx %lx) empty stub!\n",
dwParam1, dwParam2, dwParam3, dwParam4);
return TRUE;
}
LPVOID WINAPI
CreateMRUListLazyA (LPMRUINFO lpmi, DWORD dwParam2, DWORD dwParam3, DWORD dwParam4)
{
/* DWORD dwLocal1; *
* HKEY hkeyResult; *
* DWORD dwLocal3; *
* LPVOID lMRU; *
* DWORD dwLocal5; *
* DWORD dwLocal6; *
* DWORD dwLocal7; *
* DWORD dwDisposition; */
/* internal variables */
LPVOID ptr;
FIXME("(%p) empty stub!\n", lpmi);
if (lpmi) {
FIXME("(%lx %lx %lx %lx \"%s\" %lx)\n",
lpmi->dwParam1, lpmi->dwParam2, lpmi->dwParam3,
(DWORD)lpmi->hkeyMain, lpmi->lpszSubKey, lpmi->dwParam6);
}
/* dummy pointer creation */
ptr = COMCTL32_Alloc (32);
FIXME("-- ret = %p\n", ptr);
return ptr;
}
/**************************************************************************
* Str_GetPtrA [COMCTL32.233]
*
* PARAMS
* lpSrc [I]
* lpDest [O]
* nMaxLen [I]
*
* RETURNS
*/
INT WINAPI
Str_GetPtrA (LPCSTR lpSrc, LPSTR lpDest, INT nMaxLen)
{
INT len;
TRACE("(%p %p %d)\n", lpSrc, lpDest, nMaxLen);
if (!lpDest && lpSrc)
return lstrlenA (lpSrc);
if (nMaxLen == 0)
return 0;
if (lpSrc == NULL) {
lpDest[0] = '\0';
return 0;
}
len = lstrlenA (lpSrc);
if (len >= nMaxLen)
len = nMaxLen - 1;
RtlMoveMemory (lpDest, lpSrc, len);
lpDest[len] = '\0';
return len;
}
/**************************************************************************
* Str_SetPtrA [COMCTL32.234]
*
* PARAMS
* lppDest [O]
* lpSrc [I]
*
* RETURNS
*/
BOOL WINAPI
Str_SetPtrA (LPSTR *lppDest, LPCSTR lpSrc)
{
TRACE("(%p %p)\n", lppDest, lpSrc);
if (lpSrc) {
LPSTR ptr = COMCTL32_ReAlloc (*lppDest, lstrlenA (lpSrc) + 1);
if (!ptr)
return FALSE;
lstrcpyA (ptr, lpSrc);
*lppDest = ptr;
}
else {
if (*lppDest) {
COMCTL32_Free (*lppDest);
*lppDest = NULL;
}
}
return TRUE;
}
/**************************************************************************
* Str_GetPtrW [COMCTL32.235]
*
* PARAMS
* lpSrc [I]
* lpDest [O]
* nMaxLen [I]
*
* RETURNS
*/
INT WINAPI
Str_GetPtrW (LPCWSTR lpSrc, LPWSTR lpDest, INT nMaxLen)
{
INT len;
TRACE("(%p %p %d)\n", lpSrc, lpDest, nMaxLen);
if (!lpDest && lpSrc)
return lstrlenW (lpSrc);
if (nMaxLen == 0)
return 0;
if (lpSrc == NULL) {
lpDest[0] = L'\0';
return 0;
}
len = lstrlenW (lpSrc);
if (len >= nMaxLen)
len = nMaxLen - 1;
RtlMoveMemory (lpDest, lpSrc, len*sizeof(WCHAR));
lpDest[len] = L'\0';
return len;
}
/**************************************************************************
* Str_SetPtrW [COMCTL32.236]
*
* PARAMS
* lpDest [O]
* lpSrc [I]
*
* RETURNS
*/
BOOL WINAPI
Str_SetPtrW (LPWSTR *lppDest, LPCWSTR lpSrc)
{
TRACE("(%p %p)\n", lppDest, lpSrc);
if (lpSrc) {
INT len = lstrlenW (lpSrc) + 1;
LPWSTR ptr = COMCTL32_ReAlloc (*lppDest, len * sizeof(WCHAR));
if (!ptr)
return FALSE;
lstrcpyW (ptr, lpSrc);
*lppDest = ptr;
}
else {
if (*lppDest) {
COMCTL32_Free (*lppDest);
*lppDest = NULL;
}
}
return TRUE;
}
/**************************************************************************
* The DSA-API is a set of functions to create and manipulate arrays of
* fix sized memory blocks. These arrays can store any kind of data
* (strings, icons...).
*/
/**************************************************************************
* DSA_Create [COMCTL32.320] Creates a dynamic storage array
*
* PARAMS
* nSize [I] size of the array elements
* nGrow [I] number of elements by which the array grows when it is filled
*
* RETURNS
* Success: pointer to a array control structure. use this like a handle.
* Failure: NULL
*/
HDSA WINAPI
DSA_Create (INT nSize, INT nGrow)
{
HDSA hdsa;
TRACE("(size=%d grow=%d)\n", nSize, nGrow);
hdsa = (HDSA)COMCTL32_Alloc (sizeof(DSA));
if (hdsa)
{
hdsa->nItemCount = 0;
hdsa->pData = NULL;
hdsa->nMaxCount = 0;
hdsa->nItemSize = nSize;
hdsa->nGrow = MAX(1, nGrow);
}
return hdsa;
}
/**************************************************************************
* DSA_Destroy [COMCTL32.321] Destroys a dynamic storage array
*
* PARAMS
* hdsa [I] pointer to the array control structure
*
* RETURNS
* Success: TRUE
* Failure: FALSE
*/
BOOL WINAPI
DSA_Destroy (const HDSA hdsa)
{
TRACE("(%p)\n", hdsa);
if (!hdsa)
return FALSE;
if (hdsa->pData && (!COMCTL32_Free (hdsa->pData)))
return FALSE;
return COMCTL32_Free (hdsa);
}
/**************************************************************************
* DSA_GetItem [COMCTL32.322]
*
* PARAMS
* hdsa [I] pointer to the array control structure
* nIndex [I] number of the Item to get
* pDest [O] destination buffer. Has to be >= dwElementSize.
*
* RETURNS
* Success: TRUE
* Failure: FALSE
*/
BOOL WINAPI
DSA_GetItem (const HDSA hdsa, INT nIndex, LPVOID pDest)
{
LPVOID pSrc;
TRACE("(%p %d %p)\n", hdsa, nIndex, pDest);
if (!hdsa)
return FALSE;
if ((nIndex < 0) || (nIndex >= hdsa->nItemCount))
return FALSE;
pSrc = (char *) hdsa->pData + (hdsa->nItemSize * nIndex);
memmove (pDest, pSrc, hdsa->nItemSize);
return TRUE;
}
/**************************************************************************
* DSA_GetItemPtr [COMCTL32.323]
*
* Retrieves a pointer to the specified item.
*
* PARAMS
* hdsa [I] pointer to the array control structure
* nIndex [I] index of the desired item
*
* RETURNS
* Success: pointer to an item
* Failure: NULL
*/
LPVOID WINAPI
DSA_GetItemPtr (const HDSA hdsa, INT nIndex)
{
LPVOID pSrc;
TRACE("(%p %d)\n", hdsa, nIndex);
if (!hdsa)
return NULL;
if ((nIndex < 0) || (nIndex >= hdsa->nItemCount))
return NULL;
pSrc = (char *) hdsa->pData + (hdsa->nItemSize * nIndex);
TRACE("-- ret=%p\n", pSrc);
return pSrc;
}
/**************************************************************************
* DSA_SetItem [COMCTL32.325]
*
* Sets the contents of an item in the array.
*
* PARAMS
* hdsa [I] pointer to the array control structure
* nIndex [I] index for the item
* pSrc [I] pointer to the new item data
*
* RETURNS
* Success: TRUE
* Failure: FALSE
*/
BOOL WINAPI
DSA_SetItem (const HDSA hdsa, INT nIndex, LPVOID pSrc)
{
INT nSize, nNewItems;
LPVOID pDest, lpTemp;
TRACE("(%p %d %p)\n", hdsa, nIndex, pSrc);
if ((!hdsa) || nIndex < 0)
return FALSE;
if (hdsa->nItemCount <= nIndex) {
/* within the old array */
if (hdsa->nMaxCount > nIndex) {
/* within the allocated space, set a new boundary */
hdsa->nItemCount = nIndex + 1;
}
else {
/* resize the block of memory */
nNewItems =
hdsa->nGrow * ((INT)((nIndex - 1) / hdsa->nGrow) + 1);
nSize = hdsa->nItemSize * nNewItems;
lpTemp = (LPVOID)COMCTL32_ReAlloc (hdsa->pData, nSize);
if (!lpTemp)
return FALSE;
hdsa->nMaxCount = nNewItems;
hdsa->nItemCount = nIndex + 1;
hdsa->pData = lpTemp;
}
}
/* put the new entry in */
pDest = (char *) hdsa->pData + (hdsa->nItemSize * nIndex);
TRACE("-- move dest=%p src=%p size=%d\n",
pDest, pSrc, hdsa->nItemSize);
memmove (pDest, pSrc, hdsa->nItemSize);
return TRUE;
}
/**************************************************************************
* DSA_InsertItem [COMCTL32.325]
*
* PARAMS
* hdsa [I] pointer to the array control structure
* nIndex [I] index for the new item
* pSrc [I] pointer to the element
*
* RETURNS
* Success: position of the new item
* Failure: -1
*/
INT WINAPI
DSA_InsertItem (const HDSA hdsa, INT nIndex, LPVOID pSrc)
{
INT nNewItems, nSize, i;
LPVOID lpTemp, lpDest;
LPDWORD p;
TRACE("(%p %d %p)\n", hdsa, nIndex, pSrc);
if ((!hdsa) || nIndex < 0)
return -1;
for (i = 0; i < hdsa->nItemSize; i += 4) {
p = *(DWORD**)((char *) pSrc + i);
if (IsBadStringPtrA ((char*)p, 256))
TRACE("-- %d=%p\n", i, (DWORD*)p);
else
TRACE("-- %d=%p [%s]\n", i, p, debugstr_a((char*)p));
}
/* when nIndex > nItemCount then append */
if (nIndex >= hdsa->nItemCount)
nIndex = hdsa->nItemCount;
/* do we need to resize ? */
if (hdsa->nItemCount >= hdsa->nMaxCount) {
nNewItems = hdsa->nMaxCount + hdsa->nGrow;
nSize = hdsa->nItemSize * nNewItems;
lpTemp = (LPVOID)COMCTL32_ReAlloc (hdsa->pData, nSize);
if (!lpTemp)
return -1;
hdsa->nMaxCount = nNewItems;
hdsa->pData = lpTemp;
}
/* do we need to move elements ? */
if (nIndex < hdsa->nItemCount) {
lpTemp = (char *) hdsa->pData + (hdsa->nItemSize * nIndex);
lpDest = (char *) lpTemp + hdsa->nItemSize;
nSize = (hdsa->nItemCount - nIndex) * hdsa->nItemSize;
TRACE("-- move dest=%p src=%p size=%d\n",
lpDest, lpTemp, nSize);
memmove (lpDest, lpTemp, nSize);
}
/* ok, we can put the new Item in */
hdsa->nItemCount++;
lpDest = (char *) hdsa->pData + (hdsa->nItemSize * nIndex);
TRACE("-- move dest=%p src=%p size=%d\n",
lpDest, pSrc, hdsa->nItemSize);
memmove (lpDest, pSrc, hdsa->nItemSize);
return hdsa->nItemCount;
}
/**************************************************************************
* DSA_DeleteItem [COMCTL32.326]
*
* PARAMS
* hdsa [I] pointer to the array control structure
* nIndex [I] index for the element to delete
*
* RETURNS
* Success: number of the deleted element
* Failure: -1
*/
INT WINAPI
DSA_DeleteItem (const HDSA hdsa, INT nIndex)
{
LPVOID lpDest,lpSrc;
INT nSize;
TRACE("(%p %d)\n", hdsa, nIndex);
if (!hdsa)
return -1;
if (nIndex < 0 || nIndex >= hdsa->nItemCount)
return -1;
/* do we need to move ? */
if (nIndex < hdsa->nItemCount - 1) {
lpDest = (char *) hdsa->pData + (hdsa->nItemSize * nIndex);
lpSrc = (char *) lpDest + hdsa->nItemSize;
nSize = hdsa->nItemSize * (hdsa->nItemCount - nIndex - 1);
TRACE("-- move dest=%p src=%p size=%d\n",
lpDest, lpSrc, nSize);
memmove (lpDest, lpSrc, nSize);
}
hdsa->nItemCount--;
/* free memory ? */
if ((hdsa->nMaxCount - hdsa->nItemCount) >= hdsa->nGrow) {
nSize = hdsa->nItemSize * hdsa->nItemCount;
lpDest = (LPVOID)COMCTL32_ReAlloc (hdsa->pData, nSize);
if (!lpDest)
return -1;
hdsa->nMaxCount = hdsa->nItemCount;
hdsa->pData = lpDest;
}
return nIndex;
}
/**************************************************************************
* DSA_DeleteAllItems [COMCTL32.326]
*
* Removes all items and reinitializes the array.
*
* PARAMS
* hdsa [I] pointer to the array control structure
*
* RETURNS
* Success: TRUE
* Failure: FALSE
*/
BOOL WINAPI
DSA_DeleteAllItems (const HDSA hdsa)
{
TRACE("(%p)\n", hdsa);
if (!hdsa)
return FALSE;
if (hdsa->pData && (!COMCTL32_Free (hdsa->pData)))
return FALSE;
hdsa->nItemCount = 0;
hdsa->pData = NULL;
hdsa->nMaxCount = 0;
return TRUE;
}
/**************************************************************************
* The DPA-API is a set of functions to create and manipulate arrays of
* pointers.
*/
/**************************************************************************
* DPA_Create [COMCTL32.328] Creates a dynamic pointer array
*
* PARAMS
* nGrow [I] number of items by which the array grows when it is filled
*
* RETURNS
* Success: handle (pointer) to the pointer array.
* Failure: NULL
*/
HDPA WINAPI
DPA_Create (INT nGrow)
{
HDPA hdpa;
TRACE("(%d)\n", nGrow);
hdpa = (HDPA)COMCTL32_Alloc (sizeof(DPA));
if (hdpa) {
hdpa->nGrow = MAX(8, nGrow);
hdpa->hHeap = COMCTL32_hHeap;
hdpa->nMaxCount = hdpa->nGrow * 2;
hdpa->ptrs =
(LPVOID*)COMCTL32_Alloc (hdpa->nMaxCount * sizeof(LPVOID));
}
TRACE("-- %p\n", hdpa);
return hdpa;
}
/**************************************************************************
* DPA_Destroy [COMCTL32.329] Destroys a dynamic pointer array
*
* PARAMS
* hdpa [I] handle (pointer) to the pointer array
*
* RETURNS
* Success: TRUE
* Failure: FALSE
*/
BOOL WINAPI
DPA_Destroy (const HDPA hdpa)
{
TRACE("(%p)\n", hdpa);
if (!hdpa)
return FALSE;
if (hdpa->ptrs && (!HeapFree (hdpa->hHeap, 0, hdpa->ptrs)))
return FALSE;
return HeapFree (hdpa->hHeap, 0, hdpa);
}
/**************************************************************************
* DPA_Grow [COMCTL32.330]
*
* Sets the growth amount.
*
* PARAMS
* hdpa [I] handle (pointer) to the existing (source) pointer array
* nGrow [I] number of items, the array grows, when it's too small
*
* RETURNS
* Success: TRUE
* Failure: FALSE
*/
BOOL WINAPI
DPA_Grow (const HDPA hdpa, INT nGrow)
{
TRACE("(%p %d)\n", hdpa, nGrow);
if (!hdpa)
return FALSE;
hdpa->nGrow = MAX(8, nGrow);
return TRUE;
}
/**************************************************************************
* DPA_Clone [COMCTL32.331]
*
* Copies a pointer array to an other one or creates a copy
*
* PARAMS
* hdpa [I] handle (pointer) to the existing (source) pointer array
* hdpaNew [O] handle (pointer) to the destination pointer array
*
* RETURNS
* Success: pointer to the destination pointer array.
* Failure: NULL
*
* NOTES
* - If the 'hdpaNew' is a NULL-Pointer, a copy of the source pointer
* array will be created and it's handle (pointer) is returned.
* - If 'hdpa' is a NULL-Pointer, the original implementation crashes,
* this implementation just returns NULL.
*/
HDPA WINAPI
DPA_Clone (const HDPA hdpa, const HDPA hdpaNew)
{
INT nNewItems, nSize;
HDPA hdpaTemp;
if (!hdpa)
return NULL;
TRACE("(%p %p)\n", hdpa, hdpaNew);
if (!hdpaNew) {
/* create a new DPA */
hdpaTemp = (HDPA)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,
sizeof(DPA));
hdpaTemp->hHeap = hdpa->hHeap;
hdpaTemp->nGrow = hdpa->nGrow;
}
else
hdpaTemp = hdpaNew;
if (hdpaTemp->ptrs) {
/* remove old pointer array */
HeapFree (hdpaTemp->hHeap, 0, hdpaTemp->ptrs);
hdpaTemp->ptrs = NULL;
hdpaTemp->nItemCount = 0;
hdpaTemp->nMaxCount = 0;
}
/* create a new pointer array */
nNewItems = hdpaTemp->nGrow *
((INT)((hdpa->nItemCount - 1) / hdpaTemp->nGrow) + 1);
nSize = nNewItems * sizeof(LPVOID);
hdpaTemp->ptrs =
(LPVOID*)HeapAlloc (hdpaTemp->hHeap, HEAP_ZERO_MEMORY, nSize);
hdpaTemp->nMaxCount = nNewItems;
/* clone the pointer array */
hdpaTemp->nItemCount = hdpa->nItemCount;
memmove (hdpaTemp->ptrs, hdpa->ptrs,
hdpaTemp->nItemCount * sizeof(LPVOID));
return hdpaTemp;
}
/**************************************************************************
* DPA_GetPtr [COMCTL32.332]
*
* Retrieves a pointer from a dynamic pointer array
*
* PARAMS
* hdpa [I] handle (pointer) to the pointer array
* nIndex [I] array index of the desired pointer
*
* RETURNS
* Success: pointer
* Failure: NULL
*/
LPVOID WINAPI
DPA_GetPtr (const HDPA hdpa, INT i)
{
TRACE("(%p %d)\n", hdpa, i);
if (!hdpa)
return NULL;
if (!hdpa->ptrs)
return NULL;
if ((i < 0) || (i >= hdpa->nItemCount))
return NULL;
TRACE("-- %p\n", hdpa->ptrs[i]);
return hdpa->ptrs[i];
}
/**************************************************************************
* DPA_GetPtrIndex [COMCTL32.333]
*
* Retrieves the index of the specified pointer
*
* PARAMS
* hdpa [I] handle (pointer) to the pointer array
* p [I] pointer
*
* RETURNS
* Success: index of the specified pointer
* Failure: -1
*/
INT WINAPI
DPA_GetPtrIndex (const HDPA hdpa, LPVOID p)
{
INT i;
if (!hdpa->ptrs)
return -1;
for (i = 0; i < hdpa->nItemCount; i++) {
if (hdpa->ptrs[i] == p)
return i;
}
return -1;
}
/******