Changeset 6712
- Timestamp:
- Sep 15, 2001, 11:47:44 AM (24 years ago)
- Location:
- trunk/src
- Files:
-
- 53 edited
-
NTDLL/initterm.cpp (modified) (3 diffs)
-
NTDLL/rtlstr.c (modified) (34 diffs)
-
NTDLL/unknown.cpp (modified) (2 diffs)
-
NTDLL/wcstring.c (modified) (3 diffs)
-
avifil32/api.c (modified) (2 diffs)
-
avifil32/comentry.c (modified) (4 diffs)
-
avifil32/guid.c (modified) (1 diff)
-
avifil32/iafile.c (modified) (8 diffs)
-
avifil32/iastream.c (modified) (5 diffs)
-
avifil32/igframe.c (modified) (6 diffs)
-
avifil32/main.c (modified) (2 diffs)
-
avifil32/string.c (modified) (2 diffs)
-
crtdll/crtdll.cpp (modified) (58 diffs)
-
crtdll/crtdll_main.c (modified) (35 diffs)
-
crtdll/dir.c (modified) (18 diffs)
-
crtdll/exit.c (modified) (13 diffs)
-
crtdll/file.c (modified) (51 diffs)
-
crtdll/initterm.cpp (modified) (3 diffs)
-
crtdll/memory.c (modified) (8 diffs)
-
crtdll/spawn.c (modified) (5 diffs)
-
msacm32/driver.c (modified) (14 diffs)
-
msacm32/filter.c (modified) (18 diffs)
-
msacm32/format.c (modified) (27 diffs)
-
msacm32/initterm.cpp (modified) (3 diffs)
-
msacm32/internal.c (modified) (7 diffs)
-
msacm32/msacm32_main.c (modified) (7 diffs)
-
msacm32/pcmconverter.c (modified) (31 diffs)
-
msacm32/stream.c (modified) (17 diffs)
-
msacm32/wineacm.h (modified) (1 diff)
-
msvfw32/drawdib.c (modified) (10 diffs)
-
msvfw32/msvideo_main.c (modified) (7 diffs)
-
setupapi/devinst.c (modified) (2 diffs)
-
setupapi/infparse.c (modified) (8 diffs)
-
setupapi/setupx_main.c (modified) (51 diffs)
-
setupapi/stubs.c (modified) (4 diffs)
-
shdocvw/classinfo.c (modified) (3 diffs)
-
shdocvw/events.c (modified) (3 diffs)
-
shdocvw/factory.c (modified) (2 diffs)
-
shdocvw/misc.c (modified) (2 diffs)
-
shdocvw/oleobject.c (modified) (4 diffs)
-
shdocvw/persist.c (modified) (3 diffs)
-
shdocvw/shdocvw_main.c (modified) (3 diffs)
-
shdocvw/webbrowser.c (modified) (2 diffs)
-
shlwapi/ordinal.c (modified) (48 diffs)
-
shlwapi/path.c (modified) (27 diffs)
-
shlwapi/reg.c (modified) (17 diffs)
-
shlwapi/regstream.c (modified) (6 diffs)
-
shlwapi/shlwapiguid.c (modified) (1 diff)
-
shlwapi/string.c (modified) (23 diffs)
-
shlwapi/url.c (modified) (16 diffs)
-
wininet/http.c (modified) (1 diff)
-
wininet/wininet_main.c (modified) (2 diffs)
-
winmm/driver.c (modified) (29 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/NTDLL/initterm.cpp
r6648 r6712 1 /* $Id: initterm.cpp,v 1.13 2001-09-05 13:14:08 bird Exp $ 2 * 1 /* 3 2 * DLL entry point 4 3 * … … 54 53 case DLL_THREAD_ATTACH: 55 54 case DLL_THREAD_DETACH: 56 return NTDLL_LibMain(hinstDLL, fdwReason, fImpLoad);55 return NTDLL_LibMain(hinstDLL, fdwReason, fImpLoad); 57 56 58 57 case DLL_PROCESS_DETACH: 59 NTDLL_LibMain(hinstDLL, fdwReason, fImpLoad);60 ctordtorTerm();61 return TRUE;58 NTDLL_LibMain(hinstDLL, fdwReason, fImpLoad); 59 ctordtorTerm(); 60 return TRUE; 62 61 } 63 62 return FALSE; … … 89 88 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/ 90 89 91 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab);92 if(dllHandle == 0) 93 return 0UL;90 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab); 91 if(dllHandle == 0) 92 return 0UL; 94 93 95 94 break; 96 95 case 1 : 97 96 if(dllHandle) { 98 UnregisterLxDll(dllHandle);97 UnregisterLxDll(dllHandle); 99 98 } 100 99 break; -
trunk/src/NTDLL/rtlstr.c
r6648 r6712 1 /* $Id: rtlstr.c,v 1.4 2001-09-05 13:14:08 bird Exp $ */2 1 /* 3 2 * Rtl string functions … … 24 23 25 24 /************************************************************************** 26 * RtlInitAnsiString (NTDLL.@)25 * RtlInitAnsiString (NTDLL.@) 27 26 */ 28 27 void WINAPI RtlInitAnsiString( PSTRING target, LPCSTR source) … … 38 37 39 38 /************************************************************************** 40 * RtlInitString (NTDLL.@)39 * RtlInitString (NTDLL.@) 41 40 */ 42 41 void WINAPI RtlInitString( PSTRING target, LPCSTR source ) … … 47 46 48 47 /************************************************************************** 49 * RtlFreeAnsiString (NTDLL.@)48 * RtlFreeAnsiString (NTDLL.@) 50 49 */ 51 50 void WINAPI RtlFreeAnsiString( PSTRING str ) … … 56 55 57 56 /************************************************************************** 58 * RtlFreeOemString (NTDLL.@)57 * RtlFreeOemString (NTDLL.@) 59 58 */ 60 59 void WINAPI RtlFreeOemString( PSTRING str ) … … 65 64 66 65 /************************************************************************** 67 * RtlCopyString (NTDLL.@)66 * RtlCopyString (NTDLL.@) 68 67 */ 69 68 void WINAPI RtlCopyString( STRING *dst, const STRING *src ) … … 80 79 81 80 /************************************************************************** 82 * RtlInitUnicodeString (NTDLL.@)81 * RtlInitUnicodeString (NTDLL.@) 83 82 */ 84 83 void WINAPI RtlInitUnicodeString( PUNICODE_STRING target, LPCWSTR source ) … … 94 93 95 94 /************************************************************************** 96 * RtlCreateUnicodeString (NTDLL.@)95 * RtlCreateUnicodeString (NTDLL.@) 97 96 */ 98 97 BOOLEAN WINAPI RtlCreateUnicodeString( PUNICODE_STRING target, LPCWSTR src ) … … 108 107 109 108 /************************************************************************** 110 * RtlCreateUnicodeStringFromAsciiz (NTDLL.@)109 * RtlCreateUnicodeStringFromAsciiz (NTDLL.@) 111 110 */ 112 111 BOOLEAN WINAPI RtlCreateUnicodeStringFromAsciiz( PUNICODE_STRING target, LPCSTR src ) … … 119 118 120 119 /************************************************************************** 121 * RtlFreeUnicodeString (NTDLL.@)120 * RtlFreeUnicodeString (NTDLL.@) 122 121 */ 123 122 void WINAPI RtlFreeUnicodeString( PUNICODE_STRING str ) … … 128 127 129 128 /************************************************************************** 130 * RtlCopyUnicodeString (NTDLL.@)129 * RtlCopyUnicodeString (NTDLL.@) 131 130 */ 132 131 void WINAPI RtlCopyUnicodeString( UNICODE_STRING *dst, const UNICODE_STRING *src ) … … 145 144 146 145 /************************************************************************** 147 * RtlEraseUnicodeString (NTDLL.@)146 * RtlEraseUnicodeString (NTDLL.@) 148 147 */ 149 148 void WINAPI RtlEraseUnicodeString( UNICODE_STRING *str ) … … 161 160 162 161 /****************************************************************************** 163 * RtlCompareString (NTDLL.@)162 * RtlCompareString (NTDLL.@) 164 163 */ 165 164 LONG WINAPI RtlCompareString( const STRING *s1, const STRING *s2, BOOLEAN CaseInsensitive ) … … 187 186 188 187 /****************************************************************************** 189 * RtlCompareUnicodeString (NTDLL.@)188 * RtlCompareUnicodeString (NTDLL.@) 190 189 */ 191 190 LONG WINAPI RtlCompareUnicodeString( const UNICODE_STRING *s1, const UNICODE_STRING *s2, … … 214 213 215 214 /************************************************************************** 216 * RtlEqualString (NTDLL.@)215 * RtlEqualString (NTDLL.@) 217 216 */ 218 217 BOOLEAN WINAPI RtlEqualString( const STRING *s1, const STRING *s2, BOOLEAN CaseInsensitive ) … … 224 223 225 224 /************************************************************************** 226 * RtlEqualUnicodeString (NTDLL.@)225 * RtlEqualUnicodeString (NTDLL.@) 227 226 */ 228 227 BOOLEAN WINAPI RtlEqualUnicodeString( const UNICODE_STRING *s1, const UNICODE_STRING *s2, … … 235 234 236 235 /************************************************************************** 237 * RtlPrefixString (NTDLL.@)236 * RtlPrefixString (NTDLL.@) 238 237 * 239 238 * Test if s1 is a prefix in s2 … … 259 258 260 259 /************************************************************************** 261 * RtlPrefixUnicodeString (NTDLL.@)260 * RtlPrefixUnicodeString (NTDLL.@) 262 261 * 263 262 * Test if s1 is a prefix in s2 … … 285 284 286 285 /* 287 COPY BETWEEN ANSI_STRING or UNICODE_STRING288 there is no parameter checking, it just crashes286 COPY BETWEEN ANSI_STRING or UNICODE_STRING 287 there is no parameter checking, it just crashes 289 288 */ 290 289 291 290 292 291 /************************************************************************** 293 * RtlAnsiStringToUnicodeString (NTDLL.@)292 * RtlAnsiStringToUnicodeString (NTDLL.@) 294 293 * 295 294 * NOTES: … … 319 318 320 319 /************************************************************************** 321 * RtlOemStringToUnicodeString (NTDLL.@)320 * RtlOemStringToUnicodeString (NTDLL.@) 322 321 * 323 322 * NOTES … … 348 347 349 348 /************************************************************************** 350 * RtlUnicodeStringToAnsiString (NTDLL.@)349 * RtlUnicodeStringToAnsiString (NTDLL.@) 351 350 * 352 351 * NOTES … … 382 381 383 382 /************************************************************************** 384 * RtlUnicodeStringToOemString (NTDLL.@)383 * RtlUnicodeStringToOemString (NTDLL.@) 385 384 * 386 385 * NOTES … … 416 415 417 416 /************************************************************************** 418 * RtlMultiByteToUnicodeN (NTDLL.@)417 * RtlMultiByteToUnicodeN (NTDLL.@) 419 418 * 420 419 * NOTES … … 432 431 433 432 /************************************************************************** 434 * RtlOemToUnicodeN (NTDLL.@)433 * RtlOemToUnicodeN (NTDLL.@) 435 434 */ 436 435 NTSTATUS WINAPI RtlOemToUnicodeN( LPWSTR dst, DWORD dstlen, LPDWORD reslen, … … 445 444 446 445 /************************************************************************** 447 * RtlUnicodeToMultiByteN (NTDLL.@)446 * RtlUnicodeToMultiByteN (NTDLL.@) 448 447 */ 449 448 NTSTATUS WINAPI RtlUnicodeToMultiByteN( LPSTR dst, DWORD dstlen, LPDWORD reslen, … … 459 458 460 459 /************************************************************************** 461 * RtlUnicodeToOemN (NTDLL.@)460 * RtlUnicodeToOemN (NTDLL.@) 462 461 */ 463 462 NTSTATUS WINAPI RtlUnicodeToOemN( LPSTR dst, DWORD dstlen, LPDWORD reslen, … … 477 476 478 477 /************************************************************************** 479 * RtlUpperString (NTDLL.@)478 * RtlUpperString (NTDLL.@) 480 479 */ 481 480 void WINAPI RtlUpperString( STRING *dst, const STRING *src ) … … 489 488 490 489 /************************************************************************** 491 * RtlUpcaseUnicodeString (NTDLL.@)490 * RtlUpcaseUnicodeString (NTDLL.@) 492 491 * 493 492 * NOTES: … … 516 515 517 516 /************************************************************************** 518 * RtlUpcaseUnicodeStringToAnsiString (NTDLL.@)517 * RtlUpcaseUnicodeStringToAnsiString (NTDLL.@) 519 518 * 520 519 * NOTES … … 538 537 539 538 /************************************************************************** 540 * RtlUpcaseUnicodeStringToOemString (NTDLL.@)539 * RtlUpcaseUnicodeStringToOemString (NTDLL.@) 541 540 * 542 541 * NOTES … … 560 559 561 560 /************************************************************************** 562 * RtlUpcaseUnicodeToMultiByteN (NTDLL.@)561 * RtlUpcaseUnicodeToMultiByteN (NTDLL.@) 563 562 */ 564 563 NTSTATUS WINAPI RtlUpcaseUnicodeToMultiByteN( LPSTR dst, DWORD dstlen, LPDWORD reslen, … … 578 577 579 578 /************************************************************************** 580 * RtlUpcaseUnicodeToOemN (NTDLL.@)579 * RtlUpcaseUnicodeToOemN (NTDLL.@) 581 580 */ 582 581 NTSTATUS WINAPI RtlUpcaseUnicodeToOemN( LPSTR dst, DWORD dstlen, LPDWORD reslen, … … 596 595 597 596 /* 598 STRING SIZE597 STRING SIZE 599 598 */ 600 599 … … 742 741 743 742 /* 744 MISC743 MISC 745 744 */ 746 745 747 746 /************************************************************************** 748 * RtlIsTextUnicode749 * 750 * Apply various feeble heuristics to guess whether751 * the text buffer contains Unicode.752 * FIXME: should implement more tests.747 * RtlIsTextUnicode 748 * 749 * Apply various feeble heuristics to guess whether 750 * the text buffer contains Unicode. 751 * FIXME: should implement more tests. 753 752 */ 754 753 DWORD WINAPI RtlIsTextUnicode( 755 LPVOID buf,756 DWORD len,757 DWORD *pf)758 { 759 LPWSTR s = buf;760 DWORD flags = -1, out_flags = 0;761 762 if (!len)763 goto out;764 if (pf)765 flags = *pf;766 /*767 * Apply various tests to the text string. According to the768 * docs, each test "passed" sets the corresponding flag in769 * the output flags. But some of the tests are mutually770 * exclusive, so I don't see how you could pass all tests ...771 */772 773 /* Check for an odd length ... pass if even. */774 if (!(len & 1))775 out_flags |= IS_TEXT_UNICODE_ODD_LENGTH;776 777 /* Check for the special unicode marker byte. */778 if (*s == 0xFEFF)779 out_flags |= IS_TEXT_UNICODE_SIGNATURE;780 781 /*782 * Check whether the string passed all of the tests.783 */784 flags &= ITU_IMPLEMENTED_TESTS;785 if ((out_flags & flags) != flags)786 len = 0;754 LPVOID buf, 755 DWORD len, 756 DWORD *pf) 757 { 758 LPWSTR s = buf; 759 DWORD flags = -1, out_flags = 0; 760 761 if (!len) 762 goto out; 763 if (pf) 764 flags = *pf; 765 /* 766 * Apply various tests to the text string. According to the 767 * docs, each test "passed" sets the corresponding flag in 768 * the output flags. But some of the tests are mutually 769 * exclusive, so I don't see how you could pass all tests ... 770 */ 771 772 /* Check for an odd length ... pass if even. */ 773 if (!(len & 1)) 774 out_flags |= IS_TEXT_UNICODE_ODD_LENGTH; 775 776 /* Check for the special unicode marker byte. */ 777 if (*s == 0xFEFF) 778 out_flags |= IS_TEXT_UNICODE_SIGNATURE; 779 780 /* 781 * Check whether the string passed all of the tests. 782 */ 783 flags &= ITU_IMPLEMENTED_TESTS; 784 if ((out_flags & flags) != flags) 785 len = 0; 787 786 out: 788 if (pf)789 *pf = out_flags;790 return len;791 } 787 if (pf) 788 *pf = out_flags; 789 return len; 790 } -
trunk/src/NTDLL/unknown.cpp
r6647 r6712 1 /* $Id: unknown.cpp,v 1. 9 2001-09-05 13:14:30 birdExp $ */1 /* $Id: unknown.cpp,v 1.10 2001-09-15 09:36:50 sandervl Exp $ */ 2 2 3 3 /* … … 425 425 * Opens a thread... 426 426 * @returns Error code? 427 * @param p hThreadHandle427 * @param pThreadHandle 428 428 * @param dwFlags 429 * @param p AttribsPointer to some attribute structure.429 * @param pvAttribs Pointer to some attribute structure. 430 430 * @param padwOpenThreadParam Pointer to array of dword it seems. 2 entries? 431 431 * @status stub -
trunk/src/NTDLL/wcstring.c
r6648 r6712 1 /* $Id: wcstring.c,v 1.2 2001-09-05 13:14:08 bird Exp $ */2 1 /* 3 2 * NTDLL wide-char functions … … 287 286 { 288 287 LPSTR sA = HEAP_strdupWtoA(GetProcessHeap(),0,s),endA; 289 INT ret = strtol(sA,&endA,base);288 INT ret = strtol(sA,&endA,base); 290 289 291 290 HeapFree(GetProcessHeap(),0,sA); … … 326 325 327 326 if (radix > 36 || radix <= 1) 328 return 0;327 return 0; 329 328 330 329 while (v || tp == tmp) 331 330 { 332 i = v % radix;333 v = v / radix;334 if (i < 10)335 *tp++ = i + '0';336 else337 *tp++ = i + 'a' - 10;331 i = v % radix; 332 v = v / radix; 333 if (i < 10) 334 *tp++ = i + '0'; 335 else 336 *tp++ = i + 'a' - 10; 338 337 } 339 338 340 339 sp = string; 341 340 while (tp > tmp) 342 *sp++ = *--tp;341 *sp++ = *--tp; 343 342 *sp = 0; 344 343 return string; -
trunk/src/avifil32/api.c
r6644 r6712 1 /* $Id: api.c,v 1.2 2001-09-05 12:00:53 bird Exp $ 2 * 1 /* 3 2 * Copyright 1999 Marcus Meissner 4 3 * Copyright 2001 Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp> … … 23 22 24 23 /*********************************************************************** 25 * AVIFileInit (AVIFILE.100)26 * AVIFileInit (AVIFIL32.@)24 * AVIFileInit (AVIFILE.100) 25 * AVIFileInit (AVIFIL32.@) 27 26 */ 28 27 void WINAPI AVIFileInit(void) 29 28 { 30 TRACE("()\n");31 if ( AVIFILE_data.dwAVIFileRef == 0 )32 {33 if ( FAILED(CoInitialize(NULL)) )34 AVIFILE_data.fInitCOM = FALSE;35 else36 AVIFILE_data.fInitCOM = TRUE;37 }38 AVIFILE_data.dwAVIFileRef ++;39 } 40 41 /*********************************************************************** 42 * AVIFileExit (AVIFILE.101)43 * AVIFileExit (AVIFIL32.@)29 TRACE("()\n"); 30 if ( AVIFILE_data.dwAVIFileRef == 0 ) 31 { 32 if ( FAILED(CoInitialize(NULL)) ) 33 AVIFILE_data.fInitCOM = FALSE; 34 else 35 AVIFILE_data.fInitCOM = TRUE; 36 } 37 AVIFILE_data.dwAVIFileRef ++; 38 } 39 40 /*********************************************************************** 41 * AVIFileExit (AVIFILE.101) 42 * AVIFileExit (AVIFIL32.@) 44 43 */ 45 44 void WINAPI AVIFileExit(void) 46 45 { 47 TRACE("()\n");48 if ( AVIFILE_data.dwAVIFileRef == 0 )49 {50 ERR( "unexpected AVIFileExit()\n" );51 return;52 }53 54 AVIFILE_data.dwAVIFileRef --;55 if ( AVIFILE_data.dwAVIFileRef == 0 )56 {57 if ( AVIFILE_data.fInitCOM )58 {59 CoUninitialize();60 AVIFILE_data.fInitCOM = FALSE;61 }62 }63 } 64 65 /*********************************************************************** 66 * AVIFileAddRef (AVIFIL32.@)46 TRACE("()\n"); 47 if ( AVIFILE_data.dwAVIFileRef == 0 ) 48 { 49 ERR( "unexpected AVIFileExit()\n" ); 50 return; 51 } 52 53 AVIFILE_data.dwAVIFileRef --; 54 if ( AVIFILE_data.dwAVIFileRef == 0 ) 55 { 56 if ( AVIFILE_data.fInitCOM ) 57 { 58 CoUninitialize(); 59 AVIFILE_data.fInitCOM = FALSE; 60 } 61 } 62 } 63 64 /*********************************************************************** 65 * AVIFileAddRef (AVIFIL32.@) 67 66 */ 68 67 ULONG WINAPI AVIFileAddRef(PAVIFILE pfile) 69 68 { 70 return IAVIFile_AddRef( pfile );71 } 72 73 /*********************************************************************** 74 * AVIFileRelease (AVIFILE.141)75 * AVIFileRelease (AVIFIL32.@)69 return IAVIFile_AddRef( pfile ); 70 } 71 72 /*********************************************************************** 73 * AVIFileRelease (AVIFILE.141) 74 * AVIFileRelease (AVIFIL32.@) 76 75 */ 77 76 ULONG WINAPI AVIFileRelease(PAVIFILE pfile) 78 77 { 79 return IAVIFile_Release( pfile );80 } 81 82 /*********************************************************************** 83 * AVIFileOpen (AVIFILE.102)84 * AVIFileOpenA (AVIFIL32.@)78 return IAVIFile_Release( pfile ); 79 } 80 81 /*********************************************************************** 82 * AVIFileOpen (AVIFILE.102) 83 * AVIFileOpenA (AVIFIL32.@) 85 84 */ 86 85 HRESULT WINAPI AVIFileOpenA( 87 PAVIFILE* ppfile,LPCSTR szFile,UINT uMode,LPCLSID lpHandler )88 { 89 WCHAR*pwsz;90 HRESULThr;91 92 TRACE("(%p,%p,%u,%p)\n",ppfile,szFile,uMode,lpHandler);93 pwsz = AVIFILE_strdupAtoW( szFile );94 if ( pwsz == NULL )95 return AVIERR_MEMORY;96 hr = AVIFileOpenW(ppfile,pwsz,uMode,lpHandler);97 HeapFree( AVIFILE_data.hHeap, 0, pwsz );98 return hr;99 } 100 101 /*********************************************************************** 102 * AVIFileOpenW (AVIFIL32.@)86 PAVIFILE* ppfile,LPCSTR szFile,UINT uMode,LPCLSID lpHandler ) 87 { 88 WCHAR* pwsz; 89 HRESULT hr; 90 91 TRACE("(%p,%p,%u,%p)\n",ppfile,szFile,uMode,lpHandler); 92 pwsz = AVIFILE_strdupAtoW( szFile ); 93 if ( pwsz == NULL ) 94 return AVIERR_MEMORY; 95 hr = AVIFileOpenW(ppfile,pwsz,uMode,lpHandler); 96 HeapFree( AVIFILE_data.hHeap, 0, pwsz ); 97 return hr; 98 } 99 100 /*********************************************************************** 101 * AVIFileOpenW (AVIFIL32.@) 103 102 */ 104 103 HRESULT WINAPI AVIFileOpenW( 105 PAVIFILE* ppfile,LPCWSTR szFile,UINT uMode,LPCLSID lpHandler )106 { 107 HRESULThr;108 IClassFactory*pcf;109 CLSIDclsRIFF;110 111 TRACE("(%p,%p,%u,%p)\n",ppfile,szFile,uMode,lpHandler);112 *ppfile = (PAVIFILE)NULL;113 114 if ( lpHandler == NULL )115 {116 /* FIXME - check RIFF type and get a handler from registry117 * if IAVIFile::Open is worked...118 */119 memcpy( &clsRIFF, &CLSID_AVIFile, sizeof(CLSID) );120 lpHandler = &clsRIFF;121 }122 123 /*124 * FIXME - MS says IAVIFile::Open will be called,125 * but no such method in vfw.h... why????126 */127 if ( !IsEqualGUID( lpHandler, &CLSID_AVIFile ) )128 return REGDB_E_CLASSNOTREG;129 130 hr = AVIFILE_DllGetClassObject(&CLSID_AVIFile,131 &IID_IClassFactory,(void**)&pcf);132 if ( hr != S_OK )133 return hr;134 135 hr = IClassFactory_CreateInstance( pcf, NULL, &IID_IAVIFile,136 (void**)ppfile );137 IClassFactory_Release( pcf );138 139 if ( hr == S_OK )140 {141 /* FIXME??? */142 hr = AVIFILE_IAVIFile_Open( *ppfile, szFile, uMode );143 if ( hr != S_OK )144 {145 IAVIFile_Release( (*ppfile) );146 *ppfile = NULL;147 }148 }149 150 return hr;151 } 152 153 /*********************************************************************** 154 * AVIFileInfoW (AVIFIL32.@)104 PAVIFILE* ppfile,LPCWSTR szFile,UINT uMode,LPCLSID lpHandler ) 105 { 106 HRESULT hr; 107 IClassFactory* pcf; 108 CLSID clsRIFF; 109 110 TRACE("(%p,%p,%u,%p)\n",ppfile,szFile,uMode,lpHandler); 111 *ppfile = (PAVIFILE)NULL; 112 113 if ( lpHandler == NULL ) 114 { 115 /* FIXME - check RIFF type and get a handler from registry 116 * if IAVIFile::Open is worked... 117 */ 118 memcpy( &clsRIFF, &CLSID_AVIFile, sizeof(CLSID) ); 119 lpHandler = &clsRIFF; 120 } 121 122 /* 123 * FIXME - MS says IAVIFile::Open will be called, 124 * but no such method in vfw.h... why???? 125 */ 126 if ( !IsEqualGUID( lpHandler, &CLSID_AVIFile ) ) 127 return REGDB_E_CLASSNOTREG; 128 129 hr = AVIFILE_DllGetClassObject(&CLSID_AVIFile, 130 &IID_IClassFactory,(void**)&pcf); 131 if ( hr != S_OK ) 132 return hr; 133 134 hr = IClassFactory_CreateInstance( pcf, NULL, &IID_IAVIFile, 135 (void**)ppfile ); 136 IClassFactory_Release( pcf ); 137 138 if ( hr == S_OK ) 139 { 140 /* FIXME??? */ 141 hr = AVIFILE_IAVIFile_Open( *ppfile, szFile, uMode ); 142 if ( hr != S_OK ) 143 { 144 IAVIFile_Release( (*ppfile) ); 145 *ppfile = NULL; 146 } 147 } 148 149 return hr; 150 } 151 152 /*********************************************************************** 153 * AVIFileInfoW (AVIFIL32.@) 155 154 */ 156 155 HRESULT WINAPI AVIFileInfoW(PAVIFILE pfile,AVIFILEINFOW* pfi,LONG lSize) 157 156 { 158 return IAVIFile_Info( pfile, pfi, lSize );159 } 160 161 /*********************************************************************** 162 * AVIFileInfo (AVIFIL32.@)163 * AVIFileInfoA (AVIFIL32.@)157 return IAVIFile_Info( pfile, pfi, lSize ); 158 } 159 160 /*********************************************************************** 161 * AVIFileInfo (AVIFIL32.@) 162 * AVIFileInfoA (AVIFIL32.@) 164 163 */ 165 164 HRESULT WINAPI AVIFileInfoA(PAVIFILE pfile,AVIFILEINFOA* pfi,LONG lSize) 166 165 { 167 AVIFILEINFOWfiw;168 HRESULThr;169 170 if ( lSize < sizeof(AVIFILEINFOA) )171 return AVIERR_BADSIZE;172 hr = AVIFileInfoW( pfile, &fiw, sizeof(AVIFILEINFOW) );173 if ( hr != S_OK )174 return hr;175 memcpy( pfi,&fiw,sizeof(AVIFILEINFOA) );176 AVIFILE_strncpyWtoA( pfi->szFileType, fiw.szFileType,177 sizeof(pfi->szFileType) );178 pfi->szFileType[sizeof(pfi->szFileType)-1] = 0;179 180 return S_OK;181 } 182 183 /*********************************************************************** 184 * AVIFileGetStream (AVIFILE.143)185 * AVIFileGetStream (AVIFIL32.@)166 AVIFILEINFOW fiw; 167 HRESULT hr; 168 169 if ( lSize < sizeof(AVIFILEINFOA) ) 170 return AVIERR_BADSIZE; 171 hr = AVIFileInfoW( pfile, &fiw, sizeof(AVIFILEINFOW) ); 172 if ( hr != S_OK ) 173 return hr; 174 memcpy( pfi,&fiw,sizeof(AVIFILEINFOA) ); 175 AVIFILE_strncpyWtoA( pfi->szFileType, fiw.szFileType, 176 sizeof(pfi->szFileType) ); 177 pfi->szFileType[sizeof(pfi->szFileType)-1] = 0; 178 179 return S_OK; 180 } 181 182 /*********************************************************************** 183 * AVIFileGetStream (AVIFILE.143) 184 * AVIFileGetStream (AVIFIL32.@) 186 185 */ 187 186 HRESULT WINAPI AVIFileGetStream(PAVIFILE pfile,PAVISTREAM* pas,DWORD fccType,LONG lParam) 188 187 { 189 return IAVIFile_GetStream(pfile,pas,fccType,lParam);190 } 191 192 /*********************************************************************** 193 * AVIFileCreateStreamW (AVIFIL32.@)188 return IAVIFile_GetStream(pfile,pas,fccType,lParam); 189 } 190 191 /*********************************************************************** 192 * AVIFileCreateStreamW (AVIFIL32.@) 194 193 */ 195 194 HRESULT WINAPI AVIFileCreateStreamW(PAVIFILE pfile,PAVISTREAM* ppas,AVISTREAMINFOW* pasi) 196 195 { 197 return IAVIFile_CreateStream(pfile,ppas,pasi);198 } 199 200 /*********************************************************************** 201 * AVIFileCreateStreamA (AVIFIL32.@)196 return IAVIFile_CreateStream(pfile,ppas,pasi); 197 } 198 199 /*********************************************************************** 200 * AVIFileCreateStreamA (AVIFIL32.@) 202 201 */ 203 202 HRESULT WINAPI AVIFileCreateStreamA(PAVIFILE pfile,PAVISTREAM* ppas,AVISTREAMINFOA* pasi) 204 203 { 205 AVISTREAMINFOWsiw;206 HRESULThr;207 208 memcpy( &siw,pasi,sizeof(AVISTREAMINFOA) );209 AVIFILE_strncpyAtoW( siw.szName, pasi->szName,210 sizeof(siw.szName)/sizeof(siw.szName[0]) );211 siw.szName[sizeof(siw.szName)/sizeof(siw.szName[0])-1] = 0;212 213 hr = AVIFileCreateStreamW(pfile,ppas,&siw);214 215 return hr;216 } 217 218 /*********************************************************************** 219 * AVIFileWriteData (AVIFIL32.@)204 AVISTREAMINFOW siw; 205 HRESULT hr; 206 207 memcpy( &siw,pasi,sizeof(AVISTREAMINFOA) ); 208 AVIFILE_strncpyAtoW( siw.szName, pasi->szName, 209 sizeof(siw.szName)/sizeof(siw.szName[0]) ); 210 siw.szName[sizeof(siw.szName)/sizeof(siw.szName[0])-1] = 0; 211 212 hr = AVIFileCreateStreamW(pfile,ppas,&siw); 213 214 return hr; 215 } 216 217 /*********************************************************************** 218 * AVIFileWriteData (AVIFIL32.@) 220 219 */ 221 220 HRESULT WINAPI AVIFileWriteData( 222 PAVIFILE pfile,DWORD dwChunkId,LPVOID lpvData,LONG cbData )223 { 224 return IAVIFile_WriteData( pfile,dwChunkId,lpvData,cbData );225 } 226 227 /*********************************************************************** 228 * AVIFileReadData (AVIFIL32.@)221 PAVIFILE pfile,DWORD dwChunkId,LPVOID lpvData,LONG cbData ) 222 { 223 return IAVIFile_WriteData( pfile,dwChunkId,lpvData,cbData ); 224 } 225 226 /*********************************************************************** 227 * AVIFileReadData (AVIFIL32.@) 229 228 */ 230 229 HRESULT WINAPI AVIFileReadData( 231 PAVIFILE pfile,DWORD dwChunkId,LPVOID lpvData,LPLONG pcbData )232 { 233 return IAVIFile_ReadData( pfile,dwChunkId,lpvData,pcbData );234 } 235 236 /*********************************************************************** 237 * AVIFileEndRecord (AVIFIL32.@)230 PAVIFILE pfile,DWORD dwChunkId,LPVOID lpvData,LPLONG pcbData ) 231 { 232 return IAVIFile_ReadData( pfile,dwChunkId,lpvData,pcbData ); 233 } 234 235 /*********************************************************************** 236 * AVIFileEndRecord (AVIFIL32.@) 238 237 */ 239 238 HRESULT WINAPI AVIFileEndRecord( PAVIFILE pfile ) 240 239 { 241 return IAVIFile_EndRecord( pfile );242 } 243 244 /*********************************************************************** 245 * AVIStreamAddRef (AVIFIL32.@)240 return IAVIFile_EndRecord( pfile ); 241 } 242 243 /*********************************************************************** 244 * AVIStreamAddRef (AVIFIL32.@) 246 245 */ 247 246 ULONG WINAPI AVIStreamAddRef(PAVISTREAM pas) 248 247 { 249 return IAVIStream_Release(pas);250 } 251 252 /*********************************************************************** 253 * AVIStreamRelease (AVIFIL32.@)248 return IAVIStream_Release(pas); 249 } 250 251 /*********************************************************************** 252 * AVIStreamRelease (AVIFIL32.@) 254 253 */ 255 254 ULONG WINAPI AVIStreamRelease(PAVISTREAM pas) 256 255 { 257 return IAVIStream_Release(pas);258 } 259 260 /*********************************************************************** 261 * AVIStreamInfoW (AVIFIL32.@)256 return IAVIStream_Release(pas); 257 } 258 259 /*********************************************************************** 260 * AVIStreamInfoW (AVIFIL32.@) 262 261 */ 263 262 HRESULT WINAPI AVIStreamInfoW(PAVISTREAM pas,AVISTREAMINFOW* psi,LONG lSize) 264 263 { 265 return IAVIStream_Info(pas,psi,lSize);266 } 267 268 /*********************************************************************** 269 * AVIStreamInfo (AVIFIL32.@)270 * AVIStreamInfoA (AVIFIL32.@)264 return IAVIStream_Info(pas,psi,lSize); 265 } 266 267 /*********************************************************************** 268 * AVIStreamInfo (AVIFIL32.@) 269 * AVIStreamInfoA (AVIFIL32.@) 271 270 */ 272 271 HRESULT WINAPI AVIStreamInfoA(PAVISTREAM pas,AVISTREAMINFOA* psi,LONG lSize) 273 272 { 274 AVISTREAMINFOWsiw;275 HRESULThr;276 277 if (lSize < sizeof(AVISTREAMINFOA))278 return AVIERR_BADSIZE;279 hr = AVIStreamInfoW(pas,&siw,sizeof(AVISTREAMINFOW));280 if ( hr != S_OK )281 return hr;282 memcpy( psi,&siw,sizeof(AVIFILEINFOA) );283 AVIFILE_strncpyWtoA( psi->szName, siw.szName, sizeof(psi->szName) );284 psi->szName[sizeof(psi->szName)-1] = 0;285 286 return hr;287 } 288 289 /*********************************************************************** 290 * AVIStreamFindSample (AVIFIL32.@)273 AVISTREAMINFOW siw; 274 HRESULT hr; 275 276 if (lSize < sizeof(AVISTREAMINFOA)) 277 return AVIERR_BADSIZE; 278 hr = AVIStreamInfoW(pas,&siw,sizeof(AVISTREAMINFOW)); 279 if ( hr != S_OK ) 280 return hr; 281 memcpy( psi,&siw,sizeof(AVIFILEINFOA) ); 282 AVIFILE_strncpyWtoA( psi->szName, siw.szName, sizeof(psi->szName) ); 283 psi->szName[sizeof(psi->szName)-1] = 0; 284 285 return hr; 286 } 287 288 /*********************************************************************** 289 * AVIStreamFindSample (AVIFIL32.@) 291 290 */ 292 291 LONG WINAPI AVIStreamFindSample(PAVISTREAM pas,LONG lPos,LONG lFlags) 293 292 { 294 return IAVIStream_FindSample(pas,lPos,lFlags);295 } 296 297 /*********************************************************************** 298 * AVIStreamReadFormat (AVIFIL32.@)293 return IAVIStream_FindSample(pas,lPos,lFlags); 294 } 295 296 /*********************************************************************** 297 * AVIStreamReadFormat (AVIFIL32.@) 299 298 */ 300 299 HRESULT WINAPI AVIStreamReadFormat(PAVISTREAM pas,LONG pos,LPVOID format,LONG *formatsize) { 301 return IAVIStream_ReadFormat(pas,pos,format,formatsize);302 } 303 304 /*********************************************************************** 305 * AVIStreamSetFormat (AVIFIL32.@)300 return IAVIStream_ReadFormat(pas,pos,format,formatsize); 301 } 302 303 /*********************************************************************** 304 * AVIStreamSetFormat (AVIFIL32.@) 306 305 */ 307 306 HRESULT WINAPI AVIStreamSetFormat(PAVISTREAM pas,LONG pos,LPVOID format,LONG formatsize) { 308 return IAVIStream_SetFormat(pas,pos,format,formatsize);309 } 310 311 /*********************************************************************** 312 * AVIStreamReadData (AVIFIL32.@)307 return IAVIStream_SetFormat(pas,pos,format,formatsize); 308 } 309 310 /*********************************************************************** 311 * AVIStreamReadData (AVIFIL32.@) 313 312 */ 314 313 HRESULT WINAPI AVIStreamReadData(PAVISTREAM pas,DWORD fcc,LPVOID lp,LONG *lpread) { 315 return IAVIStream_ReadData(pas,fcc,lp,lpread);316 } 317 318 /*********************************************************************** 319 * AVIStreamWriteData (AVIFIL32.@)314 return IAVIStream_ReadData(pas,fcc,lp,lpread); 315 } 316 317 /*********************************************************************** 318 * AVIStreamWriteData (AVIFIL32.@) 320 319 */ 321 320 HRESULT WINAPI AVIStreamWriteData(PAVISTREAM pas,DWORD fcc,LPVOID lp,LONG size) { 322 return IAVIStream_WriteData(pas,fcc,lp,size);323 } 324 325 /*********************************************************************** 326 * AVIStreamRead (AVIFIL32.@)321 return IAVIStream_WriteData(pas,fcc,lp,size); 322 } 323 324 /*********************************************************************** 325 * AVIStreamRead (AVIFIL32.@) 327 326 */ 328 327 HRESULT WINAPI AVIStreamRead(PAVISTREAM pas,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread) 329 328 { 330 return IAVIStream_Read(pas,start,samples,buffer,buffersize,bytesread,samplesread);331 } 332 333 /*********************************************************************** 334 * AVIStreamWrite (AVIFIL32.@)329 return IAVIStream_Read(pas,start,samples,buffer,buffersize,bytesread,samplesread); 330 } 331 332 /*********************************************************************** 333 * AVIStreamWrite (AVIFIL32.@) 335 334 */ 336 335 HRESULT WINAPI AVIStreamWrite(PAVISTREAM pas,LONG start,LONG samples,LPVOID buffer,LONG buffersize,DWORD flags,LONG *sampwritten,LONG *byteswritten) { 337 return IAVIStream_Write(pas,start,samples,buffer,buffersize,flags,sampwritten,byteswritten);338 } 339 340 341 /*********************************************************************** 342 * AVIStreamStart (AVIFIL32.@)336 return IAVIStream_Write(pas,start,samples,buffer,buffersize,flags,sampwritten,byteswritten); 337 } 338 339 340 /*********************************************************************** 341 * AVIStreamStart (AVIFIL32.@) 343 342 */ 344 343 LONG WINAPI AVIStreamStart(PAVISTREAM pas) 345 344 { 346 AVISTREAMINFOWsi;347 HRESULThr;348 349 hr = IAVIStream_Info(pas,&si,sizeof(si));350 if (hr != S_OK)351 return -1;352 return (LONG)si.dwStart;353 } 354 355 /*********************************************************************** 356 * AVIStreamLength (AVIFIL32.@)345 AVISTREAMINFOW si; 346 HRESULT hr; 347 348 hr = IAVIStream_Info(pas,&si,sizeof(si)); 349 if (hr != S_OK) 350 return -1; 351 return (LONG)si.dwStart; 352 } 353 354 /*********************************************************************** 355 * AVIStreamLength (AVIFIL32.@) 357 356 */ 358 357 LONG WINAPI AVIStreamLength(PAVISTREAM pas) 359 358 { 360 AVISTREAMINFOWsi;361 HRESULThr;362 363 hr = IAVIStream_Info(pas,&si,sizeof(si));364 if (hr != S_OK)365 return -1;366 return (LONG)si.dwLength;367 } 368 369 /*********************************************************************** 370 * AVIStreamTimeToSample (AVIFIL32.@)359 AVISTREAMINFOW si; 360 HRESULT hr; 361 362 hr = IAVIStream_Info(pas,&si,sizeof(si)); 363 if (hr != S_OK) 364 return -1; 365 return (LONG)si.dwLength; 366 } 367 368 /*********************************************************************** 369 * AVIStreamTimeToSample (AVIFIL32.@) 371 370 */ 372 371 LONG WINAPI AVIStreamTimeToSample(PAVISTREAM pas,LONG lTime) 373 372 { 374 AVISTREAMINFOWsi;375 HRESULThr;376 377 hr = IAVIStream_Info(pas,&si,sizeof(si));378 if (hr != S_OK)379 return -1;380 381 /* I am too lazy... */382 FIXME("(%p,%ld)",pas,lTime);383 return (LONG)-1L;384 } 385 386 /*********************************************************************** 387 * AVIStreamSampleToTime (AVIFIL32.@)373 AVISTREAMINFOW si; 374 HRESULT hr; 375 376 hr = IAVIStream_Info(pas,&si,sizeof(si)); 377 if (hr != S_OK) 378 return -1; 379 380 /* I am too lazy... */ 381 FIXME("(%p,%ld)",pas,lTime); 382 return (LONG)-1L; 383 } 384 385 /*********************************************************************** 386 * AVIStreamSampleToTime (AVIFIL32.@) 388 387 */ 389 388 LONG WINAPI AVIStreamSampleToTime(PAVISTREAM pas,LONG lSample) 390 389 { 391 AVISTREAMINFOWsi;392 HRESULThr;393 394 hr = IAVIStream_Info(pas,&si,sizeof(si));395 if (hr != S_OK)396 return -1;397 398 /* I am too lazy... */399 FIXME("(%p,%ld)",pas,lSample);400 return (LONG)-1L;401 } 402 403 /*********************************************************************** 404 * AVIStreamBeginStreaming (AVIFIL32.@)390 AVISTREAMINFOW si; 391 HRESULT hr; 392 393 hr = IAVIStream_Info(pas,&si,sizeof(si)); 394 if (hr != S_OK) 395 return -1; 396 397 /* I am too lazy... */ 398 FIXME("(%p,%ld)",pas,lSample); 399 return (LONG)-1L; 400 } 401 402 /*********************************************************************** 403 * AVIStreamBeginStreaming (AVIFIL32.@) 405 404 */ 406 405 HRESULT WINAPI AVIStreamBeginStreaming(PAVISTREAM pas,LONG lStart,LONG lEnd,LONG lRate) 407 406 { 408 FIXME("(%p)->(%ld,%ld,%ld),stub!\n",pas,lStart,lEnd,lRate);409 return E_FAIL;410 } 411 412 /*********************************************************************** 413 * AVIStreamEndStreaming (AVIFIL32.@)407 FIXME("(%p)->(%ld,%ld,%ld),stub!\n",pas,lStart,lEnd,lRate); 408 return E_FAIL; 409 } 410 411 /*********************************************************************** 412 * AVIStreamEndStreaming (AVIFIL32.@) 414 413 */ 415 414 HRESULT WINAPI AVIStreamEndStreaming(PAVISTREAM pas) 416 415 { 417 FIXME("(%p)->(),stub!\n",pas);418 return E_FAIL;419 } 420 421 /*********************************************************************** 422 * AVIStreamGetFrameOpen (AVIFIL32.@)416 FIXME("(%p)->(),stub!\n",pas); 417 return E_FAIL; 418 } 419 420 /*********************************************************************** 421 * AVIStreamGetFrameOpen (AVIFIL32.@) 423 422 */ 424 423 PGETFRAME WINAPI AVIStreamGetFrameOpen(PAVISTREAM pas,LPBITMAPINFOHEADER pbi) 425 424 { 426 IGetFrame*pgf;427 HRESULThr;428 AVISTREAMINFOWsi;429 430 FIXME("(%p,%p)\n",pas,pbi);431 432 hr = IAVIStream_Info(pas,&si,sizeof(si));433 if (hr != S_OK)434 return NULL;435 436 hr = AVIFILE_CreateIGetFrame((void**)&pgf,pas,pbi);437 if ( hr != S_OK )438 return NULL;439 hr = IGetFrame_Begin( pgf, si.dwStart, si.dwLength, 1000 );440 if ( hr != S_OK )441 {442 IGetFrame_Release( pgf );443 return NULL;444 }445 446 return pgf;447 } 448 449 /*********************************************************************** 450 * AVIStreamGetFrame (AVIFIL32.@)425 IGetFrame* pgf; 426 HRESULT hr; 427 AVISTREAMINFOW si; 428 429 FIXME("(%p,%p)\n",pas,pbi); 430 431 hr = IAVIStream_Info(pas,&si,sizeof(si)); 432 if (hr != S_OK) 433 return NULL; 434 435 hr = AVIFILE_CreateIGetFrame((void**)&pgf,pas,pbi); 436 if ( hr != S_OK ) 437 return NULL; 438 hr = IGetFrame_Begin( pgf, si.dwStart, si.dwLength, 1000 ); 439 if ( hr != S_OK ) 440 { 441 IGetFrame_Release( pgf ); 442 return NULL; 443 } 444 445 return pgf; 446 } 447 448 /*********************************************************************** 449 * AVIStreamGetFrame (AVIFIL32.@) 451 450 */ 452 451 LPVOID WINAPI AVIStreamGetFrame(PGETFRAME pgf, LONG lPos) 453 452 { 454 return IGetFrame_GetFrame(pgf,lPos);455 } 456 457 /*********************************************************************** 458 * AVIStreamGetFrameClose (AVIFIL32.@)453 return IGetFrame_GetFrame(pgf,lPos); 454 } 455 456 /*********************************************************************** 457 * AVIStreamGetFrameClose (AVIFIL32.@) 459 458 */ 460 459 HRESULT WINAPI AVIStreamGetFrameClose(PGETFRAME pgf) 461 460 { 462 return IGetFrame_End(pgf);463 } 464 465 /*********************************************************************** 466 * AVIStreamOpenFromFileA (AVIFIL32.@)461 return IGetFrame_End(pgf); 462 } 463 464 /*********************************************************************** 465 * AVIStreamOpenFromFileA (AVIFIL32.@) 467 466 */ 468 467 HRESULT WINAPI AVIStreamOpenFromFileA(PAVISTREAM* ppas, LPCSTR szFile, DWORD fccType, LONG lParam, UINT uMode, CLSID* lpHandler) 469 468 { 470 WCHAR*pwsz;471 HRESULThr;472 473 pwsz = AVIFILE_strdupAtoW( szFile );474 if ( pwsz == NULL )475 return AVIERR_MEMORY;476 hr = AVIStreamOpenFromFileW(ppas,pwsz,fccType,lParam,uMode,lpHandler);477 HeapFree( AVIFILE_data.hHeap, 0, pwsz );478 return hr;479 } 480 481 /*********************************************************************** 482 * AVIStreamOpenFromFileW (AVIFIL32.@)469 WCHAR* pwsz; 470 HRESULT hr; 471 472 pwsz = AVIFILE_strdupAtoW( szFile ); 473 if ( pwsz == NULL ) 474 return AVIERR_MEMORY; 475 hr = AVIStreamOpenFromFileW(ppas,pwsz,fccType,lParam,uMode,lpHandler); 476 HeapFree( AVIFILE_data.hHeap, 0, pwsz ); 477 return hr; 478 } 479 480 /*********************************************************************** 481 * AVIStreamOpenFromFileW (AVIFIL32.@) 483 482 */ 484 483 HRESULT WINAPI AVIStreamOpenFromFileW(PAVISTREAM* ppas, LPCWSTR szFile, DWORD fccType, LONG lParam, UINT uMode, CLSID* lpHandler) 485 484 { 486 HRESULThr;487 PAVIFILEpaf;488 AVIFILEINFOWfi;489 490 *ppas = NULL;491 hr = AVIFileOpenW(&paf,szFile,uMode,lpHandler);492 if ( hr != S_OK )493 return hr;494 hr = AVIFileInfoW(paf,&fi,sizeof(AVIFILEINFOW));495 if ( hr == S_OK )496 hr = AVIFileGetStream(paf,ppas,fccType,lParam);497 498 IAVIFile_Release(paf);499 500 return hr;501 } 502 503 /*********************************************************************** 504 * AVIStreamCreate (AVIFIL32.@)485 HRESULT hr; 486 PAVIFILE paf; 487 AVIFILEINFOW fi; 488 489 *ppas = NULL; 490 hr = AVIFileOpenW(&paf,szFile,uMode,lpHandler); 491 if ( hr != S_OK ) 492 return hr; 493 hr = AVIFileInfoW(paf,&fi,sizeof(AVIFILEINFOW)); 494 if ( hr == S_OK ) 495 hr = AVIFileGetStream(paf,ppas,fccType,lParam); 496 497 IAVIFile_Release(paf); 498 499 return hr; 500 } 501 502 /*********************************************************************** 503 * AVIStreamCreate (AVIFIL32.@) 505 504 */ 506 505 HRESULT WINAPI AVIStreamCreate(PAVISTREAM* ppas, LONG lParam1, LONG lParam2, CLSID* lpHandler) 507 506 { 508 HRESULThr;509 IClassFactory*pcf;510 511 *ppas = NULL;512 513 if ( lpHandler == NULL )514 {515 hr = AVIFILE_DllGetClassObject(&CLSID_AVIFile,516 &IID_IClassFactory,(void**)&pcf);517 }518 else519 {520 if ( !AVIFILE_data.fInitCOM )521 return E_UNEXPECTED;522 hr = CoGetClassObject(lpHandler,CLSCTX_INPROC_SERVER,523 NULL,&IID_IClassFactory,(void**)&pcf);524 }525 if ( hr != S_OK )526 return hr;527 528 hr = IClassFactory_CreateInstance( pcf, NULL, &IID_IAVIStream,529 (void**)ppas );530 IClassFactory_Release( pcf );531 532 if ( hr == S_OK )533 {534 hr = IAVIStream_Create((*ppas),lParam1,lParam2);535 if ( hr != S_OK )536 {537 IAVIStream_Release((*ppas));538 *ppas = NULL;539 }540 }541 542 return hr;543 } 544 545 /*********************************************************************** 546 * AVIMakeCompressedStream (AVIFIL32.@)507 HRESULT hr; 508 IClassFactory* pcf; 509 510 *ppas = NULL; 511 512 if ( lpHandler == NULL ) 513 { 514 hr = AVIFILE_DllGetClassObject(&CLSID_AVIFile, 515 &IID_IClassFactory,(void**)&pcf); 516 } 517 else 518 { 519 if ( !AVIFILE_data.fInitCOM ) 520 return E_UNEXPECTED; 521 hr = CoGetClassObject(lpHandler,CLSCTX_INPROC_SERVER, 522 NULL,&IID_IClassFactory,(void**)&pcf); 523 } 524 if ( hr != S_OK ) 525 return hr; 526 527 hr = IClassFactory_CreateInstance( pcf, NULL, &IID_IAVIStream, 528 (void**)ppas ); 529 IClassFactory_Release( pcf ); 530 531 if ( hr == S_OK ) 532 { 533 hr = IAVIStream_Create((*ppas),lParam1,lParam2); 534 if ( hr != S_OK ) 535 { 536 IAVIStream_Release((*ppas)); 537 *ppas = NULL; 538 } 539 } 540 541 return hr; 542 } 543 544 /*********************************************************************** 545 * AVIMakeCompressedStream (AVIFIL32.@) 547 546 */ 548 547 HRESULT WINAPI AVIMakeCompressedStream(PAVISTREAM *ppsCompressed,PAVISTREAM ppsSource,AVICOMPRESSOPTIONS *aco,CLSID *pclsidHandler) 549 548 { 550 FIXME("(%p,%p,%p,%p)\n",ppsCompressed,ppsSource,aco,pclsidHandler);551 return E_FAIL;552 } 553 549 FIXME("(%p,%p,%p,%p)\n",ppsCompressed,ppsSource,aco,pclsidHandler); 550 return E_FAIL; 551 } 552 -
trunk/src/avifil32/comentry.c
r6644 r6712 1 /* $Id: comentry.c,v 1.2 2001-09-05 12:00:53 bird Exp $ 2 * 1 /* 3 2 * Copyright 2001 Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp> 4 3 */ … … 28 27 static ICOM_VTABLE(IClassFactory) iclassfact = 29 28 { 30 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE31 IClassFactory_fnQueryInterface,32 IClassFactory_fnAddRef,33 IClassFactory_fnRelease,34 IClassFactory_fnCreateInstance,35 IClassFactory_fnLockServer29 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 30 IClassFactory_fnQueryInterface, 31 IClassFactory_fnAddRef, 32 IClassFactory_fnRelease, 33 IClassFactory_fnCreateInstance, 34 IClassFactory_fnLockServer 36 35 }; 37 36 38 37 typedef struct 39 38 { 40 /* IUnknown fields */41 ICOM_VFIELD(IClassFactory);42 DWORDref;39 /* IUnknown fields */ 40 ICOM_VFIELD(IClassFactory); 41 DWORD ref; 43 42 } IClassFactoryImpl; 44 43 … … 50 49 IClassFactory_fnQueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) 51 50 { 52 ICOM_THIS(IClassFactoryImpl,iface);51 ICOM_THIS(IClassFactoryImpl,iface); 53 52 54 TRACE("(%p)->(%p,%p)\n",This,riid,ppobj);55 if ( ( IsEqualGUID( &IID_IUnknown, riid ) ) ||56 ( IsEqualGUID( &IID_IClassFactory, riid ) ) )57 {58 *ppobj = iface;59 IClassFactory_AddRef(iface);60 return S_OK;61 }53 TRACE("(%p)->(%p,%p)\n",This,riid,ppobj); 54 if ( ( IsEqualGUID( &IID_IUnknown, riid ) ) || 55 ( IsEqualGUID( &IID_IClassFactory, riid ) ) ) 56 { 57 *ppobj = iface; 58 IClassFactory_AddRef(iface); 59 return S_OK; 60 } 62 61 63 return E_NOINTERFACE;62 return E_NOINTERFACE; 64 63 } 65 64 66 65 static ULONG WINAPI IClassFactory_fnAddRef(LPCLASSFACTORY iface) 67 66 { 68 ICOM_THIS(IClassFactoryImpl,iface);67 ICOM_THIS(IClassFactoryImpl,iface); 69 68 70 TRACE("(%p)->()\n",This);71 if ( (This->ref) == 0 )72 AVIFILE_data.dwClassObjRef ++;69 TRACE("(%p)->()\n",This); 70 if ( (This->ref) == 0 ) 71 AVIFILE_data.dwClassObjRef ++; 73 72 74 return ++(This->ref);73 return ++(This->ref); 75 74 } 76 75 77 76 static ULONG WINAPI IClassFactory_fnRelease(LPCLASSFACTORY iface) 78 77 { 79 ICOM_THIS(IClassFactoryImpl,iface);78 ICOM_THIS(IClassFactoryImpl,iface); 80 79 81 TRACE("(%p)->()\n",This);82 if ( (--(This->ref)) > 0 )83 return This->ref;80 TRACE("(%p)->()\n",This); 81 if ( (--(This->ref)) > 0 ) 82 return This->ref; 84 83 85 AVIFILE_data.dwClassObjRef --;86 return 0;84 AVIFILE_data.dwClassObjRef --; 85 return 0; 87 86 } 88 87 … … 91 90 /*ICOM_THIS(IClassFactoryImpl,iface);*/ 92 91 93 *ppobj = NULL;94 if ( pOuter != NULL )95 return E_FAIL;92 *ppobj = NULL; 93 if ( pOuter != NULL ) 94 return E_FAIL; 96 95 97 if ( IsEqualGUID( &IID_IAVIFile, riid ) )98 return AVIFILE_CreateIAVIFile(ppobj);99 if ( IsEqualGUID( &IID_IAVIStream, riid ) )100 return AVIFILE_CreateIAVIStream(ppobj);96 if ( IsEqualGUID( &IID_IAVIFile, riid ) ) 97 return AVIFILE_CreateIAVIFile(ppobj); 98 if ( IsEqualGUID( &IID_IAVIStream, riid ) ) 99 return AVIFILE_CreateIAVIStream(ppobj); 101 100 102 return E_NOINTERFACE;101 return E_NOINTERFACE; 103 102 } 104 103 105 104 static HRESULT WINAPI IClassFactory_fnLockServer(LPCLASSFACTORY iface,BOOL dolock) 106 105 { 107 ICOM_THIS(IClassFactoryImpl,iface);108 HRESULThr;106 ICOM_THIS(IClassFactoryImpl,iface); 107 HRESULT hr; 109 108 110 FIXME("(%p)->(%d),stub!\n",This,dolock);111 if (dolock)112 hr = IClassFactory_AddRef(iface);113 else114 hr = IClassFactory_Release(iface);109 FIXME("(%p)->(%d),stub!\n",This,dolock); 110 if (dolock) 111 hr = IClassFactory_AddRef(iface); 112 else 113 hr = IClassFactory_Release(iface); 115 114 116 return hr;115 return hr; 117 116 } 118 117 119 118 120 119 /*********************************************************************** 121 * DllGetClassObject (AVIFIL32.@)120 * DllGetClassObject (AVIFIL32.@) 122 121 */ 123 122 HRESULT WINAPI AVIFILE_DllGetClassObject(const CLSID* pclsid,const IID* piid,void** ppv) 124 123 { 125 *ppv = NULL;126 if ( IsEqualCLSID( &IID_IClassFactory, piid ) )127 {128 *ppv = (LPVOID)&AVIFILE_GlobalCF;129 IClassFactory_AddRef((IClassFactory*)*ppv);130 return S_OK;131 }124 *ppv = NULL; 125 if ( IsEqualCLSID( &IID_IClassFactory, piid ) ) 126 { 127 *ppv = (LPVOID)&AVIFILE_GlobalCF; 128 IClassFactory_AddRef((IClassFactory*)*ppv); 129 return S_OK; 130 } 132 131 133 return CLASS_E_CLASSNOTAVAILABLE;132 return CLASS_E_CLASSNOTAVAILABLE; 134 133 } 135 134 136 135 /***************************************************************************** 137 * DllCanUnloadNow (AVIFIL32.@)136 * DllCanUnloadNow (AVIFIL32.@) 138 137 */ 139 138 DWORD WINAPI AVIFILE_DllCanUnloadNow(void) 140 139 { 141 return ( AVIFILE_data.dwClassObjRef == 0 ) ? S_OK : S_FALSE;140 return ( AVIFILE_data.dwClassObjRef == 0 ) ? S_OK : S_FALSE; 142 141 } 143 142 -
trunk/src/avifil32/guid.c
r6652 r6712 1 /* $Id: guid.c,v 1.2 2001-09-05 14:16:44 bird Exp $ */2 1 #define INITGUID 3 2 -
trunk/src/avifil32/iafile.c
r6652 r6712 1 /* $Id: iafile.c,v 1.2 2001-09-05 14:16:44 bird Exp $ */2 1 /* 3 2 * Copyright 1999 Marcus Meissner … … 21 20 DEFAULT_DEBUG_CHANNEL(avifile); 22 21 23 #define AVIFILE_STREAMS_MAX422 #define AVIFILE_STREAMS_MAX 4 24 23 25 24 … … 53 52 typedef struct IAVIFileImpl 54 53 { 55 ICOM_VFIELD(IAVIFile);56 /* IUnknown stuff */57 DWORDref;58 /* IAVIFile stuff */59 HANDLEhf;60 DWORDdwAVIFileCaps;61 DWORDdwAVIFileScale;62 DWORDdwAVIFileRate;63 DWORDdwAVIFileLength;64 DWORDdwAVIFileEditCount;65 MainAVIHeaderhdr;66 IAVIStream*pStreams[AVIFILE_STREAMS_MAX];67 AVIStreamHeaderstrhdrs[AVIFILE_STREAMS_MAX];68 DWORDdwMoviTop;69 DWORDdwCountOfIndexEntry;70 AVIINDEXENTRY*pIndexEntry;71 AVIINDEXENTRY*pStreamIndexEntry[AVIFILE_STREAMS_MAX+1];54 ICOM_VFIELD(IAVIFile); 55 /* IUnknown stuff */ 56 DWORD ref; 57 /* IAVIFile stuff */ 58 HANDLE hf; 59 DWORD dwAVIFileCaps; 60 DWORD dwAVIFileScale; 61 DWORD dwAVIFileRate; 62 DWORD dwAVIFileLength; 63 DWORD dwAVIFileEditCount; 64 MainAVIHeader hdr; 65 IAVIStream* pStreams[AVIFILE_STREAMS_MAX]; 66 AVIStreamHeader strhdrs[AVIFILE_STREAMS_MAX]; 67 DWORD dwMoviTop; 68 DWORD dwCountOfIndexEntry; 69 AVIINDEXENTRY* pIndexEntry; 70 AVIINDEXENTRY* pStreamIndexEntry[AVIFILE_STREAMS_MAX+1]; 72 71 } IAVIFileImpl; 73 72 … … 78 77 79 78 static HRESULT AVIFILE_IAVIFile_ReadNextChunkHeader( 80 IAVIFileImpl* This, FOURCC* pfcc, DWORD* pdwSize )81 { 82 BYTEbuf[8];83 DWORDdwRead;84 85 if ( ( !ReadFile( This->hf, buf, 8, &dwRead, NULL ) ) ||86 ( 8 != dwRead ) )87 return AVIERR_FILEREAD;88 *pfcc = mmioFOURCC(buf[0],buf[1],buf[2],buf[3]);89 *pdwSize = ( ((DWORD)buf[4]) ) |90 ( ((DWORD)buf[5]) << 8 ) |91 ( ((DWORD)buf[6]) << 16 ) |92 ( ((DWORD)buf[7]) << 24 );93 94 return S_OK;79 IAVIFileImpl* This, FOURCC* pfcc, DWORD* pdwSize ) 80 { 81 BYTE buf[8]; 82 DWORD dwRead; 83 84 if ( ( !ReadFile( This->hf, buf, 8, &dwRead, NULL ) ) || 85 ( 8 != dwRead ) ) 86 return AVIERR_FILEREAD; 87 *pfcc = mmioFOURCC(buf[0],buf[1],buf[2],buf[3]); 88 *pdwSize = ( ((DWORD)buf[4]) ) | 89 ( ((DWORD)buf[5]) << 8 ) | 90 ( ((DWORD)buf[6]) << 16 ) | 91 ( ((DWORD)buf[7]) << 24 ); 92 93 return S_OK; 95 94 } 96 95 97 96 static HRESULT AVIFILE_IAVIFile_SkipChunkData( 98 IAVIFileImpl* This, DWORD dwChunkSize )99 { 100 LONGlHigh = 0;101 DWORDdwRes;102 103 if ( dwChunkSize == 0 )104 return S_OK;105 106 SetLastError(NO_ERROR);107 dwRes = SetFilePointer( This->hf, (LONG)dwChunkSize,108 &lHigh, FILE_CURRENT );109 if ( dwRes == (DWORD)0xffffffff && GetLastError() != NO_ERROR )110 return AVIERR_FILEREAD;111 112 return S_OK;97 IAVIFileImpl* This, DWORD dwChunkSize ) 98 { 99 LONG lHigh = 0; 100 DWORD dwRes; 101 102 if ( dwChunkSize == 0 ) 103 return S_OK; 104 105 SetLastError(NO_ERROR); 106 dwRes = SetFilePointer( This->hf, (LONG)dwChunkSize, 107 &lHigh, FILE_CURRENT ); 108 if ( dwRes == (DWORD)0xffffffff && GetLastError() != NO_ERROR ) 109 return AVIERR_FILEREAD; 110 111 return S_OK; 113 112 } 114 113 115 114 static HRESULT AVIFILE_IAVIFile_ReadChunkData( 116 IAVIFileImpl* This, DWORD dwChunkSize,117 LPVOID lpvBuf, DWORD dwBufSize, LPDWORD lpdwRead )118 { 119 if ( dwBufSize > dwChunkSize )120 dwBufSize = dwChunkSize;121 if ( ( !ReadFile( This->hf, lpvBuf, dwBufSize, lpdwRead, NULL ) ) ||122 ( dwBufSize != *lpdwRead ) )123 return AVIERR_FILEREAD;124 125 return AVIFILE_IAVIFile_SkipChunkData( This, dwChunkSize - dwBufSize );115 IAVIFileImpl* This, DWORD dwChunkSize, 116 LPVOID lpvBuf, DWORD dwBufSize, LPDWORD lpdwRead ) 117 { 118 if ( dwBufSize > dwChunkSize ) 119 dwBufSize = dwChunkSize; 120 if ( ( !ReadFile( This->hf, lpvBuf, dwBufSize, lpdwRead, NULL ) ) || 121 ( dwBufSize != *lpdwRead ) ) 122 return AVIERR_FILEREAD; 123 124 return AVIFILE_IAVIFile_SkipChunkData( This, dwChunkSize - dwBufSize ); 126 125 } 127 126 128 127 static HRESULT AVIFILE_IAVIFile_SeekToSpecifiedChunk( 129 IAVIFileImpl* This, FOURCC fccType, DWORD* pdwLen )130 { 131 HRESULThr;132 FOURCCfcc;133 BYTEbuf[4];134 DWORDdwRead;135 136 while ( 1 )137 {138 hr = AVIFILE_IAVIFile_ReadNextChunkHeader(139 This, &fcc, pdwLen );140 if ( hr != S_OK )141 return hr;142 if ( fcc == fccType )143 return S_OK;144 145 if ( fcc == FOURCC_LIST )146 {147 if ( ( !ReadFile( This->hf, buf, 4, &dwRead, NULL ) ) ||148 ( 4 != dwRead ) )149 return AVIERR_FILEREAD;150 }151 else152 {153 hr = AVIFILE_IAVIFile_SkipChunkData(154 This, *pdwLen );155 if ( hr != S_OK )156 return hr;157 }158 }128 IAVIFileImpl* This, FOURCC fccType, DWORD* pdwLen ) 129 { 130 HRESULT hr; 131 FOURCC fcc; 132 BYTE buf[4]; 133 DWORD dwRead; 134 135 while ( 1 ) 136 { 137 hr = AVIFILE_IAVIFile_ReadNextChunkHeader( 138 This, &fcc, pdwLen ); 139 if ( hr != S_OK ) 140 return hr; 141 if ( fcc == fccType ) 142 return S_OK; 143 144 if ( fcc == FOURCC_LIST ) 145 { 146 if ( ( !ReadFile( This->hf, buf, 4, &dwRead, NULL ) ) || 147 ( 4 != dwRead ) ) 148 return AVIERR_FILEREAD; 149 } 150 else 151 { 152 hr = AVIFILE_IAVIFile_SkipChunkData( 153 This, *pdwLen ); 154 if ( hr != S_OK ) 155 return hr; 156 } 157 } 159 158 } 160 159 … … 162 161 WINE_AVISTREAM_DATA* AVIFILE_Alloc_IAVIStreamData( DWORD dwFmtLen ) 163 162 { 164 WINE_AVISTREAM_DATA*pData;165 166 pData = (WINE_AVISTREAM_DATA*)167 HeapAlloc( AVIFILE_data.hHeap,HEAP_ZERO_MEMORY,168 sizeof(WINE_AVISTREAM_DATA) );169 if ( pData == NULL )170 return NULL;171 if ( dwFmtLen > 0 )172 {173 pData->pbFmt = (BYTE*)174 HeapAlloc( AVIFILE_data.hHeap,HEAP_ZERO_MEMORY,175 sizeof(BYTE)*dwFmtLen );176 if ( pData->pbFmt == NULL )177 {178 AVIFILE_Free_IAVIStreamData( pData );179 return NULL;180 }181 }182 pData->dwFmtLen = dwFmtLen;183 184 return pData;163 WINE_AVISTREAM_DATA* pData; 164 165 pData = (WINE_AVISTREAM_DATA*) 166 HeapAlloc( AVIFILE_data.hHeap,HEAP_ZERO_MEMORY, 167 sizeof(WINE_AVISTREAM_DATA) ); 168 if ( pData == NULL ) 169 return NULL; 170 if ( dwFmtLen > 0 ) 171 { 172 pData->pbFmt = (BYTE*) 173 HeapAlloc( AVIFILE_data.hHeap,HEAP_ZERO_MEMORY, 174 sizeof(BYTE)*dwFmtLen ); 175 if ( pData->pbFmt == NULL ) 176 { 177 AVIFILE_Free_IAVIStreamData( pData ); 178 return NULL; 179 } 180 } 181 pData->dwFmtLen = dwFmtLen; 182 183 return pData; 185 184 } 186 185 187 186 void AVIFILE_Free_IAVIStreamData( WINE_AVISTREAM_DATA* pData ) 188 187 { 189 if ( pData != NULL )190 {191 if ( pData->pbFmt != NULL )192 HeapFree( AVIFILE_data.hHeap,0,pData->pbFmt );193 HeapFree( AVIFILE_data.hHeap,0,pData );194 }188 if ( pData != NULL ) 189 { 190 if ( pData->pbFmt != NULL ) 191 HeapFree( AVIFILE_data.hHeap,0,pData->pbFmt ); 192 HeapFree( AVIFILE_data.hHeap,0,pData ); 193 } 195 194 } 196 195 197 196 static void AVIFILE_IAVIFile_InitIndexTable( 198 IAVIFileImpl* This,199 AVIINDEXENTRY* pIndexBuf,200 AVIINDEXENTRY* pIndexData,201 DWORD dwCountOfIndexEntry )202 { 203 DWORDdwStreamIndex;204 DWORDdwIndex;205 FOURCCckid;206 207 dwStreamIndex = 0;208 for ( ; dwStreamIndex < (AVIFILE_STREAMS_MAX+1); dwStreamIndex ++ )209 This->pStreamIndexEntry[dwStreamIndex] = NULL;210 211 dwStreamIndex = 0;212 for ( ; dwStreamIndex < This->hdr.dwStreams; dwStreamIndex ++ )213 {214 ckid = mmioFOURCC('0','0'+dwStreamIndex,0,0);215 TRACE( "testing ckid %c%c%c%c\n",216 (int)(ckid>> 0)&0xff,217 (int)(ckid>> 8)&0xff,218 (int)(ckid>>16)&0xff,219 (int)(ckid>>24)&0xff );220 This->pStreamIndexEntry[dwStreamIndex] = pIndexBuf;221 FIXME( "pIndexBuf = %p\n", pIndexBuf );222 for ( dwIndex = 0; dwIndex < dwCountOfIndexEntry; dwIndex++ )223 {224 TRACE( "ckid %c%c%c%c\n",225 (int)(pIndexData[dwIndex].ckid>> 0)&0xff,197 IAVIFileImpl* This, 198 AVIINDEXENTRY* pIndexBuf, 199 AVIINDEXENTRY* pIndexData, 200 DWORD dwCountOfIndexEntry ) 201 { 202 DWORD dwStreamIndex; 203 DWORD dwIndex; 204 FOURCC ckid; 205 206 dwStreamIndex = 0; 207 for ( ; dwStreamIndex < (AVIFILE_STREAMS_MAX+1); dwStreamIndex ++ ) 208 This->pStreamIndexEntry[dwStreamIndex] = NULL; 209 210 dwStreamIndex = 0; 211 for ( ; dwStreamIndex < This->hdr.dwStreams; dwStreamIndex ++ ) 212 { 213 ckid = mmioFOURCC('0','0'+dwStreamIndex,0,0); 214 TRACE( "testing ckid %c%c%c%c\n", 215 (int)(ckid>> 0)&0xff, 216 (int)(ckid>> 8)&0xff, 217 (int)(ckid>>16)&0xff, 218 (int)(ckid>>24)&0xff ); 219 This->pStreamIndexEntry[dwStreamIndex] = pIndexBuf; 220 FIXME( "pIndexBuf = %p\n", pIndexBuf ); 221 for ( dwIndex = 0; dwIndex < dwCountOfIndexEntry; dwIndex++ ) 222 { 223 TRACE( "ckid %c%c%c%c\n", 224 (int)(pIndexData[dwIndex].ckid>> 0)&0xff, 226 225 (int)(pIndexData[dwIndex].ckid>> 8)&0xff, 227 226 (int)(pIndexData[dwIndex].ckid>>16)&0xff, 228 227 (int)(pIndexData[dwIndex].ckid>>24)&0xff ); 229 230 if ( (pIndexData[dwIndex].ckid & mmioFOURCC(0xff,0xff,0,0))231 == ckid )232 {233 memcpy( pIndexBuf, &pIndexData[dwIndex],234 sizeof(AVIINDEXENTRY) );235 pIndexBuf ++;236 }237 }228 229 if ( (pIndexData[dwIndex].ckid & mmioFOURCC(0xff,0xff,0,0)) 230 == ckid ) 231 { 232 memcpy( pIndexBuf, &pIndexData[dwIndex], 233 sizeof(AVIINDEXENTRY) ); 234 pIndexBuf ++; 235 } 236 } 238 237 FIXME( "pIndexBuf = %p\n", pIndexBuf ); 239 }240 This->pStreamIndexEntry[This->hdr.dwStreams] = pIndexBuf;238 } 239 This->pStreamIndexEntry[This->hdr.dwStreams] = pIndexBuf; 241 240 } 242 241 … … 251 250 HRESULT AVIFILE_CreateIAVIFile(void** ppobj) 252 251 { 253 IAVIFileImpl*This;254 HRESULThr;255 256 TRACE("(%p)\n",ppobj);257 *ppobj = NULL;258 This = (IAVIFileImpl*)HeapAlloc(AVIFILE_data.hHeap,HEAP_ZERO_MEMORY,259 sizeof(IAVIFileImpl));260 if ( This == NULL )261 return AVIERR_MEMORY;262 This->ref = 1;263 ICOM_VTBL(This) = &iavift;264 hr = AVIFILE_IAVIFile_Construct( This );265 if ( hr != S_OK )266 {267 AVIFILE_IAVIFile_Destruct( This );268 return hr;269 }270 271 TRACE("new -> %p\n",This);272 *ppobj = (LPVOID)This;273 274 return S_OK;252 IAVIFileImpl *This; 253 HRESULT hr; 254 255 TRACE("(%p)\n",ppobj); 256 *ppobj = NULL; 257 This = (IAVIFileImpl*)HeapAlloc(AVIFILE_data.hHeap,HEAP_ZERO_MEMORY, 258 sizeof(IAVIFileImpl)); 259 if ( This == NULL ) 260 return AVIERR_MEMORY; 261 This->ref = 1; 262 ICOM_VTBL(This) = &iavift; 263 hr = AVIFILE_IAVIFile_Construct( This ); 264 if ( hr != S_OK ) 265 { 266 AVIFILE_IAVIFile_Destruct( This ); 267 return hr; 268 } 269 270 TRACE("new -> %p\n",This); 271 *ppobj = (LPVOID)This; 272 273 return S_OK; 275 274 } 276 275 … … 280 279 281 280 static HRESULT WINAPI IAVIFile_fnQueryInterface(IAVIFile* iface,REFIID refiid,LPVOID *obj) { 282 ICOM_THIS(IAVIFileImpl,iface);283 284 TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(refiid),obj);285 if ( IsEqualGUID(&IID_IUnknown,refiid) ||286 IsEqualGUID(&IID_IAVIFile,refiid) )287 {288 *obj = iface;289 IAVIFile_AddRef(iface);290 return S_OK;291 }292 return OLE_E_ENUM_NOMORE;281 ICOM_THIS(IAVIFileImpl,iface); 282 283 TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(refiid),obj); 284 if ( IsEqualGUID(&IID_IUnknown,refiid) || 285 IsEqualGUID(&IID_IAVIFile,refiid) ) 286 { 287 *obj = iface; 288 IAVIFile_AddRef(iface); 289 return S_OK; 290 } 291 return OLE_E_ENUM_NOMORE; 293 292 } 294 293 295 294 static ULONG WINAPI IAVIFile_fnAddRef(IAVIFile* iface) { 296 ICOM_THIS(IAVIFileImpl,iface);297 298 TRACE("(%p)->AddRef()\n",iface);299 return ++(This->ref);295 ICOM_THIS(IAVIFileImpl,iface); 296 297 TRACE("(%p)->AddRef()\n",iface); 298 return ++(This->ref); 300 299 } 301 300 302 301 static ULONG WINAPI IAVIFile_fnRelease(IAVIFile* iface) { 303 ICOM_THIS(IAVIFileImpl,iface);304 305 TRACE("(%p)->Release()\n",iface);306 if ( (--(This->ref)) > 0 )307 return This->ref;308 309 AVIFILE_IAVIFile_Destruct(This);310 HeapFree(AVIFILE_data.hHeap,0,iface);311 return 0;302 ICOM_THIS(IAVIFileImpl,iface); 303 304 TRACE("(%p)->Release()\n",iface); 305 if ( (--(This->ref)) > 0 ) 306 return This->ref; 307 308 AVIFILE_IAVIFile_Destruct(This); 309 HeapFree(AVIFILE_data.hHeap,0,iface); 310 return 0; 312 311 } 313 312 … … 318 317 static HRESULT AVIFILE_IAVIFile_Construct( IAVIFileImpl* This ) 319 318 { 320 DWORDdwIndex;321 322 This->hf = INVALID_HANDLE_VALUE;323 This->dwAVIFileCaps = 0;324 This->dwAVIFileScale = 0;325 This->dwAVIFileRate = 0;326 This->dwAVIFileLength = 0;327 This->dwAVIFileEditCount = 0;328 for ( dwIndex = 0; dwIndex < AVIFILE_STREAMS_MAX; dwIndex++ )329 This->pStreams[dwIndex] = NULL;330 This->dwCountOfIndexEntry = 0;331 This->pIndexEntry = NULL;332 333 AVIFILE_data.dwClassObjRef ++;334 335 return S_OK;319 DWORD dwIndex; 320 321 This->hf = INVALID_HANDLE_VALUE; 322 This->dwAVIFileCaps = 0; 323 This->dwAVIFileScale = 0; 324 This->dwAVIFileRate = 0; 325 This->dwAVIFileLength = 0; 326 This->dwAVIFileEditCount = 0; 327 for ( dwIndex = 0; dwIndex < AVIFILE_STREAMS_MAX; dwIndex++ ) 328 This->pStreams[dwIndex] = NULL; 329 This->dwCountOfIndexEntry = 0; 330 This->pIndexEntry = NULL; 331 332 AVIFILE_data.dwClassObjRef ++; 333 334 return S_OK; 336 335 } 337 336 338 337 static void AVIFILE_IAVIFile_Destruct( IAVIFileImpl* This ) 339 338 { 340 DWORDdwIndex;341 342 if ( This->pIndexEntry != NULL )343 {344 HeapFree(AVIFILE_data.hHeap,0,This->pIndexEntry);345 This->pIndexEntry = NULL;346 }347 348 for ( dwIndex = 0; dwIndex < AVIFILE_STREAMS_MAX; dwIndex++ )349 {350 if ( This->pStreams[dwIndex] != NULL )351 {352 IAVIStream_Release( This->pStreams[dwIndex] );353 This->pStreams[dwIndex] = NULL;354 }355 }356 357 if ( This->hf != INVALID_HANDLE_VALUE )358 CloseHandle( This->hf );359 360 AVIFILE_data.dwClassObjRef --;339 DWORD dwIndex; 340 341 if ( This->pIndexEntry != NULL ) 342 { 343 HeapFree(AVIFILE_data.hHeap,0,This->pIndexEntry); 344 This->pIndexEntry = NULL; 345 } 346 347 for ( dwIndex = 0; dwIndex < AVIFILE_STREAMS_MAX; dwIndex++ ) 348 { 349 if ( This->pStreams[dwIndex] != NULL ) 350 { 351 IAVIStream_Release( This->pStreams[dwIndex] ); 352 This->pStreams[dwIndex] = NULL; 353 } 354 } 355 356 if ( This->hf != INVALID_HANDLE_VALUE ) 357 CloseHandle( This->hf ); 358 359 AVIFILE_data.dwClassObjRef --; 361 360 } 362 361 363 362 static HRESULT WINAPI IAVIFile_fnInfo(IAVIFile*iface,AVIFILEINFOW*afi,LONG size) 364 363 { 365 ICOM_THIS(IAVIFileImpl,iface);366 AVIFILEINFOWfiw;367 368 FIXME("(%p)->Info(%p,%ld)\n",iface,afi,size);369 370 memset( &fiw, 0, sizeof(fiw) );371 fiw.dwMaxBytesPerSec = This->hdr.dwMaxBytesPerSec;372 fiw.dwFlags = This->hdr.dwFlags;373 fiw.dwCaps = This->dwAVIFileCaps;374 fiw.dwStreams = This->hdr.dwStreams;375 fiw.dwSuggestedBufferSize = This->hdr.dwSuggestedBufferSize;376 fiw.dwWidth = This->hdr.dwWidth;377 fiw.dwHeight = This->hdr.dwHeight;378 fiw.dwScale = This->dwAVIFileScale; /* FIXME */379 fiw.dwRate = This->dwAVIFileRate; /* FIXME */380 fiw.dwLength = This->dwAVIFileLength; /* FIXME */381 fiw.dwEditCount = This->dwAVIFileEditCount; /* FIXME */382 /* fiw.szFileType[64]; */383 384 if ( size > sizeof(AVIFILEINFOW) )385 size = sizeof(AVIFILEINFOW);386 memcpy( afi, &fiw, size );387 388 return S_OK;364 ICOM_THIS(IAVIFileImpl,iface); 365 AVIFILEINFOW fiw; 366 367 FIXME("(%p)->Info(%p,%ld)\n",iface,afi,size); 368 369 memset( &fiw, 0, sizeof(fiw) ); 370 fiw.dwMaxBytesPerSec = This->hdr.dwMaxBytesPerSec; 371 fiw.dwFlags = This->hdr.dwFlags; 372 fiw.dwCaps = This->dwAVIFileCaps; 373 fiw.dwStreams = This->hdr.dwStreams; 374 fiw.dwSuggestedBufferSize = This->hdr.dwSuggestedBufferSize; 375 fiw.dwWidth = This->hdr.dwWidth; 376 fiw.dwHeight = This->hdr.dwHeight; 377 fiw.dwScale = This->dwAVIFileScale; /* FIXME */ 378 fiw.dwRate = This->dwAVIFileRate; /* FIXME */ 379 fiw.dwLength = This->dwAVIFileLength; /* FIXME */ 380 fiw.dwEditCount = This->dwAVIFileEditCount; /* FIXME */ 381 /* fiw.szFileType[64]; */ 382 383 if ( size > sizeof(AVIFILEINFOW) ) 384 size = sizeof(AVIFILEINFOW); 385 memcpy( afi, &fiw, size ); 386 387 return S_OK; 389 388 } 390 389 391 390 static HRESULT WINAPI IAVIFile_fnGetStream(IAVIFile*iface,PAVISTREAM*avis,DWORD fccType,LONG lParam) 392 391 { 393 ICOM_THIS(IAVIFileImpl,iface);394 395 FIXME("(%p)->GetStream(%p,0x%08lx,%ld)\n",iface,avis,fccType,lParam);396 if ( fccType != 0 )397 return E_FAIL;398 if ( lParam < 0 || lParam >= This->hdr.dwStreams )399 return E_FAIL;400 *avis = This->pStreams[lParam];401 IAVIStream_AddRef( *avis );402 403 return S_OK;392 ICOM_THIS(IAVIFileImpl,iface); 393 394 FIXME("(%p)->GetStream(%p,0x%08lx,%ld)\n",iface,avis,fccType,lParam); 395 if ( fccType != 0 ) 396 return E_FAIL; 397 if ( lParam < 0 || lParam >= This->hdr.dwStreams ) 398 return E_FAIL; 399 *avis = This->pStreams[lParam]; 400 IAVIStream_AddRef( *avis ); 401 402 return S_OK; 404 403 } 405 404 406 405 static HRESULT WINAPI IAVIFile_fnCreateStream(IAVIFile*iface,PAVISTREAM*avis,AVISTREAMINFOW*asi) 407 406 { 408 ICOM_THIS(IAVIFileImpl,iface);409 410 FIXME("(%p,%p,%p)\n",This,avis,asi);411 return E_FAIL;407 ICOM_THIS(IAVIFileImpl,iface); 408 409 FIXME("(%p,%p,%p)\n",This,avis,asi); 410 return E_FAIL; 412 411 } 413 412 414 413 static HRESULT WINAPI IAVIFile_fnWriteData(IAVIFile*iface,DWORD ckid,LPVOID lpData,LONG size) 415 414 { 416 ICOM_THIS(IAVIFileImpl,iface);417 418 FIXME("(%p)->WriteData(0x%08lx,%p,%ld)\n",This,ckid,lpData,size);419 /* FIXME: write data to file */420 return E_FAIL;415 ICOM_THIS(IAVIFileImpl,iface); 416 417 FIXME("(%p)->WriteData(0x%08lx,%p,%ld)\n",This,ckid,lpData,size); 418 /* FIXME: write data to file */ 419 return E_FAIL; 421 420 } 422 421 423 422 static HRESULT WINAPI IAVIFile_fnReadData(IAVIFile*iface,DWORD ckid,LPVOID lpData,LONG *size) 424 423 { 425 ICOM_THIS(IAVIFileImpl,iface);426 427 FIXME("(%p)->ReadData(0x%08lx,%p,%p)\n",This,ckid,lpData,size);428 /* FIXME: read at most size bytes from file */429 430 return E_FAIL;424 ICOM_THIS(IAVIFileImpl,iface); 425 426 FIXME("(%p)->ReadData(0x%08lx,%p,%p)\n",This,ckid,lpData,size); 427 /* FIXME: read at most size bytes from file */ 428 429 return E_FAIL; 431 430 } 432 431 433 432 static HRESULT WINAPI IAVIFile_fnEndRecord(IAVIFile*iface) 434 433 { 435 ICOM_THIS(IAVIFileImpl,iface);436 437 FIXME("(%p)->EndRecord()\n",This);438 /* FIXME: end record? */439 return E_FAIL;434 ICOM_THIS(IAVIFileImpl,iface); 435 436 FIXME("(%p)->EndRecord()\n",This); 437 /* FIXME: end record? */ 438 return E_FAIL; 440 439 } 441 440 442 441 static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile*iface,DWORD fccType,LONG lParam) 443 442 { 444 ICOM_THIS(IAVIFileImpl,iface);445 446 FIXME("(%p)->DeleteStream(0x%08lx,%ld)\n",This,fccType,lParam);447 /* FIXME: delete stream? */448 return E_FAIL;443 ICOM_THIS(IAVIFileImpl,iface); 444 445 FIXME("(%p)->DeleteStream(0x%08lx,%ld)\n",This,fccType,lParam); 446 /* FIXME: delete stream? */ 447 return E_FAIL; 449 448 } 450 449 451 450 /***************************************************************************** 452 * AVIFILE_IAVIFile_Open (internal)451 * AVIFILE_IAVIFile_Open (internal) 453 452 */ 454 453 HRESULT AVIFILE_IAVIFile_Open( PAVIFILE paf, LPCWSTR szFile, UINT uMode ) 455 454 { 456 ICOM_THIS(IAVIFileImpl,paf);457 HRESULThr;458 DWORDdwAcc;459 DWORDdwShared;460 DWORDdwCreate;461 BYTEbuf[12];462 DWORDdwRead;463 FOURCCfccFileType;464 DWORDdwLen;465 DWORDdwIndex;466 467 FIXME("(%p)->Open(%p,%u)\n",This,szFile,uMode);468 469 if ( This->hf != INVALID_HANDLE_VALUE )470 {471 CloseHandle( This->hf );472 This->hf = INVALID_HANDLE_VALUE;473 }474 475 switch ( uMode & 0x3 )476 {477 case OF_READ: /* 0x0 */478 dwAcc = GENERIC_READ;479 dwCreate = OPEN_EXISTING;480 This->dwAVIFileCaps = AVIFILECAPS_CANREAD;481 break;482 case OF_WRITE: /* 0x1 */483 dwAcc = GENERIC_WRITE;484 dwCreate = OPEN_ALWAYS;485 This->dwAVIFileCaps = AVIFILECAPS_CANWRITE;486 break;487 case OF_READWRITE: /* 0x2 */488 dwAcc = GENERIC_READ|GENERIC_WRITE;489 dwCreate = OPEN_ALWAYS;490 This->dwAVIFileCaps = AVIFILECAPS_CANREAD|AVIFILECAPS_CANWRITE;491 break;492 default:493 return E_FAIL;494 }495 496 if ( This->dwAVIFileCaps & AVIFILECAPS_CANWRITE )497 {498 FIXME( "editing AVI is currently not supported!\n" );499 return E_FAIL;500 }501 502 switch ( uMode & 0x70 )503 {504 case OF_SHARE_COMPAT: /* 0x00 */505 dwShared = FILE_SHARE_READ|FILE_SHARE_WRITE;506 break;507 case OF_SHARE_EXCLUSIVE: /* 0x10 */508 dwShared = 0;509 break;510 case OF_SHARE_DENY_WRITE: /* 0x20 */511 dwShared = FILE_SHARE_READ;512 break;513 case OF_SHARE_DENY_READ: /* 0x30 */514 dwShared = FILE_SHARE_WRITE;515 break;516 case OF_SHARE_DENY_NONE: /* 0x40 */517 dwShared = FILE_SHARE_READ|FILE_SHARE_WRITE;518 break;519 default:520 return E_FAIL;521 }522 if ( uMode & OF_CREATE )523 dwCreate = CREATE_ALWAYS;524 525 This->hf = CreateFileW( szFile, dwAcc, dwShared, NULL,526 dwCreate, FILE_ATTRIBUTE_NORMAL,527 (HANDLE)NULL );528 if ( This->hf == INVALID_HANDLE_VALUE )529 return AVIERR_FILEOPEN;530 531 if ( dwAcc & GENERIC_READ )532 {533 if ( !ReadFile( This->hf, buf, 12, &dwRead, NULL ) )534 return AVIERR_FILEREAD;535 if ( dwRead == 12 )536 {537 if ( mmioFOURCC(buf[0],buf[1],buf[2],buf[3]) != FOURCC_RIFF )538 return AVIERR_BADFORMAT;539 540 fccFileType = mmioFOURCC(buf[8],buf[9],buf[10],buf[11]);541 if ( fccFileType != formtypeAVI )542 return AVIERR_BADFORMAT;543 544 /* get AVI main header. */545 hr = AVIFILE_IAVIFile_SeekToSpecifiedChunk(546 This, ckidAVIMAINHDR, &dwLen );547 if ( hr != S_OK )548 return hr;549 if ( dwLen < (sizeof(DWORD)*10) )550 return AVIERR_BADFORMAT;551 hr = AVIFILE_IAVIFile_ReadChunkData(552 This, dwLen,553 &(This->hdr), sizeof(MainAVIHeader), &dwLen );554 if ( This->hdr.dwStreams == 0 ||555 This->hdr.dwStreams > AVIFILE_STREAMS_MAX )556 return AVIERR_BADFORMAT;557 558 /* get stream headers. */559 dwIndex = 0;560 while ( dwIndex < This->hdr.dwStreams )561 {562 WINE_AVISTREAM_DATA*pData;563 564 hr = AVIFILE_IAVIFile_SeekToSpecifiedChunk(565 This, ckidSTREAMHEADER, &dwLen );566 if ( hr != S_OK )567 return hr;568 if ( dwLen < (sizeof(DWORD)*12) )569 return AVIERR_BADFORMAT;570 hr = AVIFILE_IAVIFile_ReadChunkData(571 This, dwLen,572 &This->strhdrs[dwIndex],573 sizeof(AVIStreamHeader), &dwLen );574 575 hr = AVIFILE_IAVIFile_SeekToSpecifiedChunk(576 This, ckidSTREAMFORMAT, &dwLen );577 if ( hr != S_OK )578 return hr;579 pData = AVIFILE_Alloc_IAVIStreamData( dwLen );580 if ( pData == NULL )581 return AVIERR_MEMORY;582 hr = AVIFILE_IAVIFile_ReadChunkData(583 This, dwLen,584 pData->pbFmt, dwLen, &dwLen );585 if ( hr != S_OK )586 {587 AVIFILE_Free_IAVIStreamData( pData );588 return hr;589 }590 pData->dwStreamIndex = dwIndex;591 pData->pstrhdr = &This->strhdrs[dwIndex];592 593 hr = AVIStreamCreate(&This->pStreams[dwIndex],594 (LONG)paf, (LONG)(pData), NULL );595 if ( hr != S_OK )596 {597 AVIFILE_Free_IAVIStreamData( pData );598 return hr;599 }600 601 if ( (This->strhdrs[dwIndex].fccType602 == mmioFOURCC('v','i','d','s')) ||603 (This->strhdrs[dwIndex].fccType604 == mmioFOURCC('V','I','D','S')) )605 {606 This->dwAVIFileScale =607 This->strhdrs[dwIndex].dwScale;608 This->dwAVIFileRate =609 This->strhdrs[dwIndex].dwRate;610 This->dwAVIFileLength =611 This->strhdrs[dwIndex].dwLength;612 }613 else614 if ( This->dwAVIFileScale == 0 )615 {616 This->dwAVIFileScale =617 This->strhdrs[dwIndex].dwScale;618 This->dwAVIFileRate =619 This->strhdrs[dwIndex].dwRate;620 This->dwAVIFileLength =621 This->strhdrs[dwIndex].dwLength;622 }623 624 dwIndex ++;625 }626 627 /* skip movi. */628 while ( 1 )629 {630 hr = AVIFILE_IAVIFile_SeekToSpecifiedChunk(631 This, FOURCC_LIST, &dwLen );632 if ( hr != S_OK )633 return hr;634 if ( dwLen < 4 )635 return AVIERR_BADFORMAT;636 637 This->dwMoviTop = SetFilePointer( This->hf,0,NULL,FILE_CURRENT );638 if ( This->dwMoviTop == 0xffffffff )639 return AVIERR_BADFORMAT;640 641 if ( ( !ReadFile(This->hf, buf, 4, &dwRead, NULL) ) ||642 ( dwRead != 4 ) )643 return AVIERR_FILEREAD;644 645 hr = AVIFILE_IAVIFile_SkipChunkData(646 This, dwLen - 4 );647 if ( hr != S_OK )648 return hr;649 if ( mmioFOURCC(buf[0],buf[1],buf[2],buf[3])650 == mmioFOURCC('m', 'o', 'v', 'i') )651 break;652 }653 654 /* get idx1. */655 hr = AVIFILE_IAVIFile_SeekToSpecifiedChunk(656 This, ckidAVINEWINDEX, &dwLen );657 if ( hr != S_OK )658 return hr;659 660 This->dwCountOfIndexEntry = dwLen / sizeof(AVIINDEXENTRY);661 This->pIndexEntry = (AVIINDEXENTRY*)662 HeapAlloc(AVIFILE_data.hHeap,HEAP_ZERO_MEMORY,663 sizeof(AVIINDEXENTRY) *664 This->dwCountOfIndexEntry * 2 );665 if ( This->pIndexEntry == NULL )666 return AVIERR_MEMORY;667 hr = AVIFILE_IAVIFile_ReadChunkData(668 This, dwLen,669 This->pIndexEntry + This->dwCountOfIndexEntry,670 sizeof(AVIINDEXENTRY) *671 This->dwCountOfIndexEntry, &dwLen );672 if ( hr != S_OK )673 return hr;674 AVIFILE_IAVIFile_InitIndexTable(675 This, This->pIndexEntry,676 This->pIndexEntry + This->dwCountOfIndexEntry,677 This->dwCountOfIndexEntry );678 }679 else680 {681 /* FIXME - create the handle has GENERIC_WRITE access. */682 return AVIERR_FILEREAD;683 }684 }685 else686 {687 return AVIERR_FILEOPEN; /* FIXME */688 }689 690 return S_OK;455 ICOM_THIS(IAVIFileImpl,paf); 456 HRESULT hr; 457 DWORD dwAcc; 458 DWORD dwShared; 459 DWORD dwCreate; 460 BYTE buf[12]; 461 DWORD dwRead; 462 FOURCC fccFileType; 463 DWORD dwLen; 464 DWORD dwIndex; 465 466 FIXME("(%p)->Open(%p,%u)\n",This,szFile,uMode); 467 468 if ( This->hf != INVALID_HANDLE_VALUE ) 469 { 470 CloseHandle( This->hf ); 471 This->hf = INVALID_HANDLE_VALUE; 472 } 473 474 switch ( uMode & 0x3 ) 475 { 476 case OF_READ: /* 0x0 */ 477 dwAcc = GENERIC_READ; 478 dwCreate = OPEN_EXISTING; 479 This->dwAVIFileCaps = AVIFILECAPS_CANREAD; 480 break; 481 case OF_WRITE: /* 0x1 */ 482 dwAcc = GENERIC_WRITE; 483 dwCreate = OPEN_ALWAYS; 484 This->dwAVIFileCaps = AVIFILECAPS_CANWRITE; 485 break; 486 case OF_READWRITE: /* 0x2 */ 487 dwAcc = GENERIC_READ|GENERIC_WRITE; 488 dwCreate = OPEN_ALWAYS; 489 This->dwAVIFileCaps = AVIFILECAPS_CANREAD|AVIFILECAPS_CANWRITE; 490 break; 491 default: 492 return E_FAIL; 493 } 494 495 if ( This->dwAVIFileCaps & AVIFILECAPS_CANWRITE ) 496 { 497 FIXME( "editing AVI is currently not supported!\n" ); 498 return E_FAIL; 499 } 500 501 switch ( uMode & 0x70 ) 502 { 503 case OF_SHARE_COMPAT: /* 0x00 */ 504 dwShared = FILE_SHARE_READ|FILE_SHARE_WRITE; 505 break; 506 case OF_SHARE_EXCLUSIVE: /* 0x10 */ 507 dwShared = 0; 508 break; 509 case OF_SHARE_DENY_WRITE: /* 0x20 */ 510 dwShared = FILE_SHARE_READ; 511 break; 512 case OF_SHARE_DENY_READ: /* 0x30 */ 513 dwShared = FILE_SHARE_WRITE; 514 break; 515 case OF_SHARE_DENY_NONE: /* 0x40 */ 516 dwShared = FILE_SHARE_READ|FILE_SHARE_WRITE; 517 break; 518 default: 519 return E_FAIL; 520 } 521 if ( uMode & OF_CREATE ) 522 dwCreate = CREATE_ALWAYS; 523 524 This->hf = CreateFileW( szFile, dwAcc, dwShared, NULL, 525 dwCreate, FILE_ATTRIBUTE_NORMAL, 526 (HANDLE)NULL ); 527 if ( This->hf == INVALID_HANDLE_VALUE ) 528 return AVIERR_FILEOPEN; 529 530 if ( dwAcc & GENERIC_READ ) 531 { 532 if ( !ReadFile( This->hf, buf, 12, &dwRead, NULL ) ) 533 return AVIERR_FILEREAD; 534 if ( dwRead == 12 ) 535 { 536 if ( mmioFOURCC(buf[0],buf[1],buf[2],buf[3]) != FOURCC_RIFF ) 537 return AVIERR_BADFORMAT; 538 539 fccFileType = mmioFOURCC(buf[8],buf[9],buf[10],buf[11]); 540 if ( fccFileType != formtypeAVI ) 541 return AVIERR_BADFORMAT; 542 543 /* get AVI main header. */ 544 hr = AVIFILE_IAVIFile_SeekToSpecifiedChunk( 545 This, ckidAVIMAINHDR, &dwLen ); 546 if ( hr != S_OK ) 547 return hr; 548 if ( dwLen < (sizeof(DWORD)*10) ) 549 return AVIERR_BADFORMAT; 550 hr = AVIFILE_IAVIFile_ReadChunkData( 551 This, dwLen, 552 &(This->hdr), sizeof(MainAVIHeader), &dwLen ); 553 if ( This->hdr.dwStreams == 0 || 554 This->hdr.dwStreams > AVIFILE_STREAMS_MAX ) 555 return AVIERR_BADFORMAT; 556 557 /* get stream headers. */ 558 dwIndex = 0; 559 while ( dwIndex < This->hdr.dwStreams ) 560 { 561 WINE_AVISTREAM_DATA* pData; 562 563 hr = AVIFILE_IAVIFile_SeekToSpecifiedChunk( 564 This, ckidSTREAMHEADER, &dwLen ); 565 if ( hr != S_OK ) 566 return hr; 567 if ( dwLen < (sizeof(DWORD)*12) ) 568 return AVIERR_BADFORMAT; 569 hr = AVIFILE_IAVIFile_ReadChunkData( 570 This, dwLen, 571 &This->strhdrs[dwIndex], 572 sizeof(AVIStreamHeader), &dwLen ); 573 574 hr = AVIFILE_IAVIFile_SeekToSpecifiedChunk( 575 This, ckidSTREAMFORMAT, &dwLen ); 576 if ( hr != S_OK ) 577 return hr; 578 pData = AVIFILE_Alloc_IAVIStreamData( dwLen ); 579 if ( pData == NULL ) 580 return AVIERR_MEMORY; 581 hr = AVIFILE_IAVIFile_ReadChunkData( 582 This, dwLen, 583 pData->pbFmt, dwLen, &dwLen ); 584 if ( hr != S_OK ) 585 { 586 AVIFILE_Free_IAVIStreamData( pData ); 587 return hr; 588 } 589 pData->dwStreamIndex = dwIndex; 590 pData->pstrhdr = &This->strhdrs[dwIndex]; 591 592 hr = AVIStreamCreate(&This->pStreams[dwIndex], 593 (LONG)paf, (LONG)(pData), NULL ); 594 if ( hr != S_OK ) 595 { 596 AVIFILE_Free_IAVIStreamData( pData ); 597 return hr; 598 } 599 600 if ( (This->strhdrs[dwIndex].fccType 601 == mmioFOURCC('v','i','d','s')) || 602 (This->strhdrs[dwIndex].fccType 603 == mmioFOURCC('V','I','D','S')) ) 604 { 605 This->dwAVIFileScale = 606 This->strhdrs[dwIndex].dwScale; 607 This->dwAVIFileRate = 608 This->strhdrs[dwIndex].dwRate; 609 This->dwAVIFileLength = 610 This->strhdrs[dwIndex].dwLength; 611 } 612 else 613 if ( This->dwAVIFileScale == 0 ) 614 { 615 This->dwAVIFileScale = 616 This->strhdrs[dwIndex].dwScale; 617 This->dwAVIFileRate = 618 This->strhdrs[dwIndex].dwRate; 619 This->dwAVIFileLength = 620 This->strhdrs[dwIndex].dwLength; 621 } 622 623 dwIndex ++; 624 } 625 626 /* skip movi. */ 627 while ( 1 ) 628 { 629 hr = AVIFILE_IAVIFile_SeekToSpecifiedChunk( 630 This, FOURCC_LIST, &dwLen ); 631 if ( hr != S_OK ) 632 return hr; 633 if ( dwLen < 4 ) 634 return AVIERR_BADFORMAT; 635 636 This->dwMoviTop = SetFilePointer( This->hf,0,NULL,FILE_CURRENT ); 637 if ( This->dwMoviTop == 0xffffffff ) 638 return AVIERR_BADFORMAT; 639 640 if ( ( !ReadFile(This->hf, buf, 4, &dwRead, NULL) ) || 641 ( dwRead != 4 ) ) 642 return AVIERR_FILEREAD; 643 644 hr = AVIFILE_IAVIFile_SkipChunkData( 645 This, dwLen - 4 ); 646 if ( hr != S_OK ) 647 return hr; 648 if ( mmioFOURCC(buf[0],buf[1],buf[2],buf[3]) 649 == mmioFOURCC('m', 'o', 'v', 'i') ) 650 break; 651 } 652 653 /* get idx1. */ 654 hr = AVIFILE_IAVIFile_SeekToSpecifiedChunk( 655 This, ckidAVINEWINDEX, &dwLen ); 656 if ( hr != S_OK ) 657 return hr; 658 659 This->dwCountOfIndexEntry = dwLen / sizeof(AVIINDEXENTRY); 660 This->pIndexEntry = (AVIINDEXENTRY*) 661 HeapAlloc(AVIFILE_data.hHeap,HEAP_ZERO_MEMORY, 662 sizeof(AVIINDEXENTRY) * 663 This->dwCountOfIndexEntry * 2 ); 664 if ( This->pIndexEntry == NULL ) 665 return AVIERR_MEMORY; 666 hr = AVIFILE_IAVIFile_ReadChunkData( 667 This, dwLen, 668 This->pIndexEntry + This->dwCountOfIndexEntry, 669 sizeof(AVIINDEXENTRY) * 670 This->dwCountOfIndexEntry, &dwLen ); 671 if ( hr != S_OK ) 672 return hr; 673 AVIFILE_IAVIFile_InitIndexTable( 674 This, This->pIndexEntry, 675 This->pIndexEntry + This->dwCountOfIndexEntry, 676 This->dwCountOfIndexEntry ); 677 } 678 else 679 { 680 /* FIXME - create the handle has GENERIC_WRITE access. */ 681 return AVIERR_FILEREAD; 682 } 683 } 684 else 685 { 686 return AVIERR_FILEOPEN; /* FIXME */ 687 } 688 689 return S_OK; 691 690 } 692 691 693 692 /***************************************************************************** 694 * AVIFILE_IAVIFile_GetIndexTable (internal)693 * AVIFILE_IAVIFile_GetIndexTable (internal) 695 694 */ 696 695 HRESULT AVIFILE_IAVIFile_GetIndexTable( PAVIFILE paf, DWORD dwStreamIndex, 697 AVIINDEXENTRY** ppIndexEntry,698 DWORD* pdwCountOfIndexEntry )699 { 700 ICOM_THIS(IAVIFileImpl,paf);701 702 if ( dwStreamIndex < 0 || dwStreamIndex >= This->hdr.dwStreams )703 {704 FIXME( "invalid stream index %lu\n", dwStreamIndex );705 return E_FAIL;706 }707 FIXME( "cur %p, next %p\n",708 This->pStreamIndexEntry[dwStreamIndex],709 This->pStreamIndexEntry[dwStreamIndex+1] );710 *ppIndexEntry = This->pStreamIndexEntry[dwStreamIndex];711 *pdwCountOfIndexEntry =712 This->pStreamIndexEntry[dwStreamIndex+1] -713 This->pStreamIndexEntry[dwStreamIndex];714 715 return S_OK;696 AVIINDEXENTRY** ppIndexEntry, 697 DWORD* pdwCountOfIndexEntry ) 698 { 699 ICOM_THIS(IAVIFileImpl,paf); 700 701 if ( dwStreamIndex < 0 || dwStreamIndex >= This->hdr.dwStreams ) 702 { 703 FIXME( "invalid stream index %lu\n", dwStreamIndex ); 704 return E_FAIL; 705 } 706 FIXME( "cur %p, next %p\n", 707 This->pStreamIndexEntry[dwStreamIndex], 708 This->pStreamIndexEntry[dwStreamIndex+1] ); 709 *ppIndexEntry = This->pStreamIndexEntry[dwStreamIndex]; 710 *pdwCountOfIndexEntry = 711 This->pStreamIndexEntry[dwStreamIndex+1] - 712 This->pStreamIndexEntry[dwStreamIndex]; 713 714 return S_OK; 716 715 } 717 716 718 717 /***************************************************************************** 719 * AVIFILE_IAVIFile_ReadMovieData (internal)718 * AVIFILE_IAVIFile_ReadMovieData (internal) 720 719 */ 721 720 HRESULT AVIFILE_IAVIFile_ReadMovieData( PAVIFILE paf, DWORD dwOffset, 722 DWORD dwLength, LPVOID lpvBuf )723 { 724 ICOM_THIS(IAVIFileImpl,paf);725 LONGlHigh = 0;726 DWORDdwRes;727 728 if ( dwLength == 0 )729 return S_OK;730 SetLastError(NO_ERROR);731 dwRes = SetFilePointer( This->hf, (LONG)(dwOffset+This->dwMoviTop),732 &lHigh, FILE_BEGIN );733 if ( dwRes == (DWORD)0xffffffff && GetLastError() != NO_ERROR )734 return AVIERR_FILEREAD;735 736 if ( ( !ReadFile(This->hf, lpvBuf, dwLength, &dwRes, NULL) ) ||737 ( dwLength != dwRes ) )738 {739 FIXME( "error in ReadFile()\n" );740 return AVIERR_FILEREAD;741 }742 743 return S_OK;744 } 745 721 DWORD dwLength, LPVOID lpvBuf ) 722 { 723 ICOM_THIS(IAVIFileImpl,paf); 724 LONG lHigh = 0; 725 DWORD dwRes; 726 727 if ( dwLength == 0 ) 728 return S_OK; 729 SetLastError(NO_ERROR); 730 dwRes = SetFilePointer( This->hf, (LONG)(dwOffset+This->dwMoviTop), 731 &lHigh, FILE_BEGIN ); 732 if ( dwRes == (DWORD)0xffffffff && GetLastError() != NO_ERROR ) 733 return AVIERR_FILEREAD; 734 735 if ( ( !ReadFile(This->hf, lpvBuf, dwLength, &dwRes, NULL) ) || 736 ( dwLength != dwRes ) ) 737 { 738 FIXME( "error in ReadFile()\n" ); 739 return AVIERR_FILEREAD; 740 } 741 742 return S_OK; 743 } 744 -
trunk/src/avifil32/iastream.c
r6652 r6712 1 /* $Id: iastream.c,v 1.2 2001-09-05 14:16:45 bird Exp $ */2 1 /* 3 2 * Copyright 2001 Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp> … … 56 55 typedef struct IAVIStreamImpl 57 56 { 58 ICOM_VFIELD(IAVIStream);59 /* IUnknown stuff */60 DWORDref;61 /* IAVIStream stuff */62 IAVIFile*paf;63 WINE_AVISTREAM_DATA*pData;57 ICOM_VFIELD(IAVIStream); 58 /* IUnknown stuff */ 59 DWORD ref; 60 /* IAVIStream stuff */ 61 IAVIFile* paf; 62 WINE_AVISTREAM_DATA* pData; 64 63 } IAVIStreamImpl; 65 64 … … 69 68 HRESULT AVIFILE_CreateIAVIStream(void** ppobj) 70 69 { 71 IAVIStreamImpl*This;72 HRESULThr;73 74 *ppobj = NULL;75 This = (IAVIStreamImpl*)HeapAlloc(AVIFILE_data.hHeap,HEAP_ZERO_MEMORY,76 sizeof(IAVIStreamImpl));77 This->ref = 1;78 ICOM_VTBL(This) = &iavist;79 hr = IAVIStream_Construct( This );80 if ( hr != S_OK )81 {82 IAVIStream_Destruct( This );83 return hr;84 }85 86 *ppobj = (LPVOID)This;87 88 return S_OK;70 IAVIStreamImpl *This; 71 HRESULT hr; 72 73 *ppobj = NULL; 74 This = (IAVIStreamImpl*)HeapAlloc(AVIFILE_data.hHeap,HEAP_ZERO_MEMORY, 75 sizeof(IAVIStreamImpl)); 76 This->ref = 1; 77 ICOM_VTBL(This) = &iavist; 78 hr = IAVIStream_Construct( This ); 79 if ( hr != S_OK ) 80 { 81 IAVIStream_Destruct( This ); 82 return hr; 83 } 84 85 *ppobj = (LPVOID)This; 86 87 return S_OK; 89 88 } 90 89 … … 95 94 96 95 static HRESULT WINAPI IAVIStream_fnQueryInterface(IAVIStream*iface,REFIID refiid,LPVOID *obj) { 97 ICOM_THIS(IAVIStreamImpl,iface);98 99 TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(refiid),obj);100 if ( IsEqualGUID(&IID_IUnknown,refiid) ||101 IsEqualGUID(&IID_IAVIStream,refiid) )102 {103 IAVIStream_AddRef(iface);104 *obj = iface;105 return S_OK;106 }107 /* can return IGetFrame interface too */108 109 return OLE_E_ENUM_NOMORE;96 ICOM_THIS(IAVIStreamImpl,iface); 97 98 TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(refiid),obj); 99 if ( IsEqualGUID(&IID_IUnknown,refiid) || 100 IsEqualGUID(&IID_IAVIStream,refiid) ) 101 { 102 IAVIStream_AddRef(iface); 103 *obj = iface; 104 return S_OK; 105 } 106 /* can return IGetFrame interface too */ 107 108 return OLE_E_ENUM_NOMORE; 110 109 } 111 110 112 111 static ULONG WINAPI IAVIStream_fnAddRef(IAVIStream*iface) { 113 ICOM_THIS(IAVIStreamImpl,iface);114 115 TRACE("(%p)->AddRef()\n",iface);116 return ++(This->ref);112 ICOM_THIS(IAVIStreamImpl,iface); 113 114 TRACE("(%p)->AddRef()\n",iface); 115 return ++(This->ref); 117 116 } 118 117 119 118 static ULONG WINAPI IAVIStream_fnRelease(IAVIStream* iface) { 120 ICOM_THIS(IAVIStreamImpl,iface);121 122 TRACE("(%p)->Release()\n",iface);123 if ((--(This->ref)) > 0 )124 return This->ref;125 IAVIStream_Destruct(This);126 127 HeapFree(AVIFILE_data.hHeap,0,iface);128 return 0;119 ICOM_THIS(IAVIStreamImpl,iface); 120 121 TRACE("(%p)->Release()\n",iface); 122 if ((--(This->ref)) > 0 ) 123 return This->ref; 124 IAVIStream_Destruct(This); 125 126 HeapFree(AVIFILE_data.hHeap,0,iface); 127 return 0; 129 128 } 130 129 … … 135 134 static HRESULT IAVIStream_Construct( IAVIStreamImpl* This ) 136 135 { 137 This->paf = NULL;138 This->pData = NULL;139 140 AVIFILE_data.dwClassObjRef ++;141 142 return S_OK;136 This->paf = NULL; 137 This->pData = NULL; 138 139 AVIFILE_data.dwClassObjRef ++; 140 141 return S_OK; 143 142 } 144 143 145 144 static void IAVIStream_Destruct( IAVIStreamImpl* This ) 146 145 { 147 AVIFILE_data.dwClassObjRef --;146 AVIFILE_data.dwClassObjRef --; 148 147 } 149 148 150 149 static HRESULT WINAPI IAVIStream_fnCreate(IAVIStream*iface,LPARAM lParam1,LPARAM lParam2) 151 150 { 152 ICOM_THIS(IAVIStreamImpl,iface);153 154 FIXME("(%p)->Create(%ld,%ld)\n",iface,lParam1,lParam2);155 156 This->paf = (IAVIFile*)lParam1;157 This->pData = (WINE_AVISTREAM_DATA*)lParam2;158 159 return S_OK;151 ICOM_THIS(IAVIStreamImpl,iface); 152 153 FIXME("(%p)->Create(%ld,%ld)\n",iface,lParam1,lParam2); 154 155 This->paf = (IAVIFile*)lParam1; 156 This->pData = (WINE_AVISTREAM_DATA*)lParam2; 157 158 return S_OK; 160 159 } 161 160 162 161 static HRESULT WINAPI IAVIStream_fnInfo(IAVIStream*iface,AVISTREAMINFOW *psi,LONG size) 163 162 { 164 ICOM_THIS(IAVIStreamImpl,iface);165 AVISTREAMINFOWsiw;166 167 FIXME("(%p)->Info(%p,%ld)\n",iface,psi,size);168 if ( This->pData == NULL )169 return E_UNEXPECTED;170 171 memset( &siw, 0, sizeof(AVISTREAMINFOW) );172 siw.fccType = This->pData->pstrhdr->fccType;173 siw.fccHandler = This->pData->pstrhdr->fccHandler;174 siw.dwFlags = This->pData->pstrhdr->dwFlags;175 siw.dwCaps = 0; /* FIXME */176 siw.wPriority = This->pData->pstrhdr->wPriority;177 siw.wLanguage = This->pData->pstrhdr->wLanguage;178 siw.dwScale = This->pData->pstrhdr->dwScale;179 siw.dwRate = This->pData->pstrhdr->dwRate;180 siw.dwStart = This->pData->pstrhdr->dwStart;181 siw.dwLength = This->pData->pstrhdr->dwLength;182 siw.dwInitialFrames = This->pData->pstrhdr->dwInitialFrames;183 siw.dwSuggestedBufferSize = This->pData->pstrhdr->dwSuggestedBufferSize;184 siw.dwQuality = This->pData->pstrhdr->dwQuality;185 siw.dwSampleSize = This->pData->pstrhdr->dwSampleSize;186 siw.rcFrame.left = This->pData->pstrhdr->rcFrame.left;187 siw.rcFrame.top = This->pData->pstrhdr->rcFrame.top;188 siw.rcFrame.right = This->pData->pstrhdr->rcFrame.right;189 siw.rcFrame.bottom = This->pData->pstrhdr->rcFrame.bottom;190 siw.dwEditCount = 0; /* FIXME */191 siw.dwFormatChangeCount = 0; /* FIXME */192 /* siw.szName[64] */193 194 if ( size > sizeof(AVISTREAMINFOW) )195 size = sizeof(AVISTREAMINFOW);196 memcpy( psi, &siw, size );197 198 return S_OK;163 ICOM_THIS(IAVIStreamImpl,iface); 164 AVISTREAMINFOW siw; 165 166 FIXME("(%p)->Info(%p,%ld)\n",iface,psi,size); 167 if ( This->pData == NULL ) 168 return E_UNEXPECTED; 169 170 memset( &siw, 0, sizeof(AVISTREAMINFOW) ); 171 siw.fccType = This->pData->pstrhdr->fccType; 172 siw.fccHandler = This->pData->pstrhdr->fccHandler; 173 siw.dwFlags = This->pData->pstrhdr->dwFlags; 174 siw.dwCaps = 0; /* FIXME */ 175 siw.wPriority = This->pData->pstrhdr->wPriority; 176 siw.wLanguage = This->pData->pstrhdr->wLanguage; 177 siw.dwScale = This->pData->pstrhdr->dwScale; 178 siw.dwRate = This->pData->pstrhdr->dwRate; 179 siw.dwStart = This->pData->pstrhdr->dwStart; 180 siw.dwLength = This->pData->pstrhdr->dwLength; 181 siw.dwInitialFrames = This->pData->pstrhdr->dwInitialFrames; 182 siw.dwSuggestedBufferSize = This->pData->pstrhdr->dwSuggestedBufferSize; 183 siw.dwQuality = This->pData->pstrhdr->dwQuality; 184 siw.dwSampleSize = This->pData->pstrhdr->dwSampleSize; 185 siw.rcFrame.left = This->pData->pstrhdr->rcFrame.left; 186 siw.rcFrame.top = This->pData->pstrhdr->rcFrame.top; 187 siw.rcFrame.right = This->pData->pstrhdr->rcFrame.right; 188 siw.rcFrame.bottom = This->pData->pstrhdr->rcFrame.bottom; 189 siw.dwEditCount = 0; /* FIXME */ 190 siw.dwFormatChangeCount = 0; /* FIXME */ 191 /* siw.szName[64] */ 192 193 if ( size > sizeof(AVISTREAMINFOW) ) 194 size = sizeof(AVISTREAMINFOW); 195 memcpy( psi, &siw, size ); 196 197 return S_OK; 199 198 } 200 199 201 200 static LONG WINAPI IAVIStream_fnFindSample(IAVIStream*iface,LONG pos,LONG flags) 202 201 { 203 ICOM_THIS(IAVIStreamImpl,iface);204 HRESULThr;205 AVIINDEXENTRY*pIndexEntry;206 DWORDdwCountOfIndexEntry;207 LONGlCur, lAdd, lEnd;208 209 FIXME("(%p)->FindSample(%ld,0x%08lx)\n",This,pos,flags);210 211 hr = AVIFILE_IAVIFile_GetIndexTable(212 This->paf, This->pData->dwStreamIndex,213 &pIndexEntry, &dwCountOfIndexEntry );214 if ( hr != S_OK )215 return -1L;216 217 if ( flags & (~(FIND_DIR|FIND_TYPE|FIND_RET)) )218 {219 FIXME( "unknown flag %08lx\n", flags );220 return -1L;221 }222 223 switch ( flags & FIND_DIR )224 {225 case FIND_NEXT:226 lCur = pos;227 lAdd = 1;228 lEnd = dwCountOfIndexEntry;229 if ( lCur > dwCountOfIndexEntry )230 return -1L;231 break;232 case FIND_PREV:233 lCur = pos;234 if ( lCur > dwCountOfIndexEntry )235 lCur = dwCountOfIndexEntry;236 lAdd = -1;237 lEnd = 0;238 break;239 case FIND_FROM_START:240 lCur = 0;241 lAdd = 1;242 lEnd = dwCountOfIndexEntry;243 break;244 default:245 FIXME( "unknown direction flag %08lx\n", (flags & FIND_DIR) );246 return -1L;247 }248 249 switch ( flags & FIND_TYPE )250 {251 case FIND_KEY:252 while ( 1 )253 {254 if ( pIndexEntry[lCur].dwFlags & AVIIF_KEYFRAME )255 break;256 if ( lCur == lEnd )257 return -1L;258 lCur += lAdd;259 }260 break;261 case FIND_ANY:262 while ( 1 )263 {264 if ( !(pIndexEntry[lCur].dwFlags & AVIIF_NOTIME) )265 break;266 if ( lCur == lEnd )267 return -1L;268 lCur += lAdd;269 }270 break;271 case FIND_FORMAT:272 FIXME( "FIND_FORMAT is not implemented.\n" );273 return -1L;274 default:275 FIXME( "unknown type flag %08lx\n", (flags & FIND_TYPE) );276 return -1L;277 }278 279 switch ( flags & FIND_RET )280 {281 case FIND_POS:282 return lCur;283 case FIND_LENGTH:284 FIXME( "FIND_LENGTH is not implemented.\n" );285 return -1L;286 case FIND_OFFSET:287 return pIndexEntry[lCur].dwChunkOffset;288 case FIND_SIZE:289 return pIndexEntry[lCur].dwChunkLength;290 case FIND_INDEX:291 FIXME( "FIND_INDEX is not implemented.\n" );292 return -1L;293 default:294 FIXME( "unknown return type flag %08lx\n", (flags & FIND_RET) );295 break;296 }297 298 return -1L;202 ICOM_THIS(IAVIStreamImpl,iface); 203 HRESULT hr; 204 AVIINDEXENTRY* pIndexEntry; 205 DWORD dwCountOfIndexEntry; 206 LONG lCur, lAdd, lEnd; 207 208 FIXME("(%p)->FindSample(%ld,0x%08lx)\n",This,pos,flags); 209 210 hr = AVIFILE_IAVIFile_GetIndexTable( 211 This->paf, This->pData->dwStreamIndex, 212 &pIndexEntry, &dwCountOfIndexEntry ); 213 if ( hr != S_OK ) 214 return -1L; 215 216 if ( flags & (~(FIND_DIR|FIND_TYPE|FIND_RET)) ) 217 { 218 FIXME( "unknown flag %08lx\n", flags ); 219 return -1L; 220 } 221 222 switch ( flags & FIND_DIR ) 223 { 224 case FIND_NEXT: 225 lCur = pos; 226 lAdd = 1; 227 lEnd = dwCountOfIndexEntry; 228 if ( lCur > dwCountOfIndexEntry ) 229 return -1L; 230 break; 231 case FIND_PREV: 232 lCur = pos; 233 if ( lCur > dwCountOfIndexEntry ) 234 lCur = dwCountOfIndexEntry; 235 lAdd = -1; 236 lEnd = 0; 237 break; 238 case FIND_FROM_START: 239 lCur = 0; 240 lAdd = 1; 241 lEnd = dwCountOfIndexEntry; 242 break; 243 default: 244 FIXME( "unknown direction flag %08lx\n", (flags & FIND_DIR) ); 245 return -1L; 246 } 247 248 switch ( flags & FIND_TYPE ) 249 { 250 case FIND_KEY: 251 while ( 1 ) 252 { 253 if ( pIndexEntry[lCur].dwFlags & AVIIF_KEYFRAME ) 254 break; 255 if ( lCur == lEnd ) 256 return -1L; 257 lCur += lAdd; 258 } 259 break; 260 case FIND_ANY: 261 while ( 1 ) 262 { 263 if ( !(pIndexEntry[lCur].dwFlags & AVIIF_NOTIME) ) 264 break; 265 if ( lCur == lEnd ) 266 return -1L; 267 lCur += lAdd; 268 } 269 break; 270 case FIND_FORMAT: 271 FIXME( "FIND_FORMAT is not implemented.\n" ); 272 return -1L; 273 default: 274 FIXME( "unknown type flag %08lx\n", (flags & FIND_TYPE) ); 275 return -1L; 276 } 277 278 switch ( flags & FIND_RET ) 279 { 280 case FIND_POS: 281 return lCur; 282 case FIND_LENGTH: 283 FIXME( "FIND_LENGTH is not implemented.\n" ); 284 return -1L; 285 case FIND_OFFSET: 286 return pIndexEntry[lCur].dwChunkOffset; 287 case FIND_SIZE: 288 return pIndexEntry[lCur].dwChunkLength; 289 case FIND_INDEX: 290 FIXME( "FIND_INDEX is not implemented.\n" ); 291 return -1L; 292 default: 293 FIXME( "unknown return type flag %08lx\n", (flags & FIND_RET) ); 294 break; 295 } 296 297 return -1L; 299 298 } 300 299 301 300 static HRESULT WINAPI IAVIStream_fnReadFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG *formatsize) { 302 ICOM_THIS(IAVIStreamImpl,iface);303 304 TRACE("(%p)->ReadFormat(%ld,%p,%p)\n",This,pos,format,formatsize);305 if ( This->pData == NULL )306 return E_UNEXPECTED;307 308 /* FIXME - check pos. */309 if ( format == NULL )310 {311 *formatsize = This->pData->dwFmtLen;312 return S_OK;313 }314 if ( (*formatsize) < This->pData->dwFmtLen )315 return AVIERR_BUFFERTOOSMALL;316 317 memcpy( format, This->pData->pbFmt, This->pData->dwFmtLen );318 *formatsize = This->pData->dwFmtLen;319 320 return S_OK;301 ICOM_THIS(IAVIStreamImpl,iface); 302 303 TRACE("(%p)->ReadFormat(%ld,%p,%p)\n",This,pos,format,formatsize); 304 if ( This->pData == NULL ) 305 return E_UNEXPECTED; 306 307 /* FIXME - check pos. */ 308 if ( format == NULL ) 309 { 310 *formatsize = This->pData->dwFmtLen; 311 return S_OK; 312 } 313 if ( (*formatsize) < This->pData->dwFmtLen ) 314 return AVIERR_BUFFERTOOSMALL; 315 316 memcpy( format, This->pData->pbFmt, This->pData->dwFmtLen ); 317 *formatsize = This->pData->dwFmtLen; 318 319 return S_OK; 321 320 } 322 321 323 322 static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG formatsize) { 324 ICOM_THIS(IAVIStreamImpl,iface);325 326 FIXME("(%p)->SetFormat(%ld,%p,%ld)\n",This,pos,format,formatsize);327 return E_FAIL;323 ICOM_THIS(IAVIStreamImpl,iface); 324 325 FIXME("(%p)->SetFormat(%ld,%p,%ld)\n",This,pos,format,formatsize); 326 return E_FAIL; 328 327 } 329 328 330 329 static HRESULT WINAPI IAVIStream_fnRead(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread) { 331 ICOM_THIS(IAVIStreamImpl,iface);332 HRESULThr;333 AVIINDEXENTRY*pIndexEntry;334 DWORDdwCountOfIndexEntry;335 DWORDdwFrameLength;336 337 FIXME("(%p)->Read(%ld,%ld,%p,%ld,%p,%p)\n",This,start,samples,buffer,buffersize,bytesread,samplesread);338 339 *bytesread = 0;340 *samplesread = 0;341 342 hr = AVIFILE_IAVIFile_GetIndexTable(343 This->paf, This->pData->dwStreamIndex,344 &pIndexEntry, &dwCountOfIndexEntry );345 if ( hr != S_OK )346 return hr;347 if ( start < 0 )348 return E_FAIL;349 if ( start >= dwCountOfIndexEntry || samples <= 0 )350 {351 FIXME("start %ld,samples %ld,total %ld\n",start,samples,dwCountOfIndexEntry);352 return S_OK;353 }354 355 /* FIXME - is this data valid??? */356 dwFrameLength = pIndexEntry[start].dwChunkLength + sizeof(DWORD)*2;357 358 if ( buffer == NULL )359 {360 *bytesread = dwFrameLength;361 *samplesread = 1;362 return S_OK;363 }364 if ( buffersize < dwFrameLength )365 {366 FIXME( "buffer is too small!\n" );367 return AVIERR_BUFFERTOOSMALL;368 }369 370 hr = AVIFILE_IAVIFile_ReadMovieData(371 This->paf,372 pIndexEntry[start].dwChunkOffset,373 dwFrameLength, buffer );374 if ( hr != S_OK )375 {376 FIXME( "ReadMovieData failed!\n");377 return hr;378 }379 *bytesread = dwFrameLength;380 *samplesread = 1;381 382 return S_OK;330 ICOM_THIS(IAVIStreamImpl,iface); 331 HRESULT hr; 332 AVIINDEXENTRY* pIndexEntry; 333 DWORD dwCountOfIndexEntry; 334 DWORD dwFrameLength; 335 336 FIXME("(%p)->Read(%ld,%ld,%p,%ld,%p,%p)\n",This,start,samples,buffer,buffersize,bytesread,samplesread); 337 338 *bytesread = 0; 339 *samplesread = 0; 340 341 hr = AVIFILE_IAVIFile_GetIndexTable( 342 This->paf, This->pData->dwStreamIndex, 343 &pIndexEntry, &dwCountOfIndexEntry ); 344 if ( hr != S_OK ) 345 return hr; 346 if ( start < 0 ) 347 return E_FAIL; 348 if ( start >= dwCountOfIndexEntry || samples <= 0 ) 349 { 350 FIXME("start %ld,samples %ld,total %ld\n",start,samples,dwCountOfIndexEntry); 351 return S_OK; 352 } 353 354 /* FIXME - is this data valid??? */ 355 dwFrameLength = pIndexEntry[start].dwChunkLength + sizeof(DWORD)*2; 356 357 if ( buffer == NULL ) 358 { 359 *bytesread = dwFrameLength; 360 *samplesread = 1; 361 return S_OK; 362 } 363 if ( buffersize < dwFrameLength ) 364 { 365 FIXME( "buffer is too small!\n" ); 366 return AVIERR_BUFFERTOOSMALL; 367 } 368 369 hr = AVIFILE_IAVIFile_ReadMovieData( 370 This->paf, 371 pIndexEntry[start].dwChunkOffset, 372 dwFrameLength, buffer ); 373 if ( hr != S_OK ) 374 { 375 FIXME( "ReadMovieData failed!\n"); 376 return hr; 377 } 378 *bytesread = dwFrameLength; 379 *samplesread = 1; 380 381 return S_OK; 383 382 } 384 383 385 384 static HRESULT WINAPI IAVIStream_fnWrite(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,DWORD flags,LONG *sampwritten,LONG *byteswritten) { 386 ICOM_THIS(IAVIStreamImpl,iface);387 388 389 FIXME("(%p)->Write(%ld,%ld,%p,%ld,0x%08lx,%p,%p)\n",This,start,samples,buffer,buffersize,flags,sampwritten,byteswritten);390 return E_FAIL;385 ICOM_THIS(IAVIStreamImpl,iface); 386 387 388 FIXME("(%p)->Write(%ld,%ld,%p,%ld,0x%08lx,%p,%p)\n",This,start,samples,buffer,buffersize,flags,sampwritten,byteswritten); 389 return E_FAIL; 391 390 } 392 391 393 392 static HRESULT WINAPI IAVIStream_fnDelete(IAVIStream*iface,LONG start,LONG samples) { 394 ICOM_THIS(IAVIStreamImpl,iface);395 396 FIXME("(%p)->Delete(%ld,%ld)\n",This,start,samples);397 return E_FAIL;393 ICOM_THIS(IAVIStreamImpl,iface); 394 395 FIXME("(%p)->Delete(%ld,%ld)\n",This,start,samples); 396 return E_FAIL; 398 397 } 399 398 static HRESULT WINAPI IAVIStream_fnReadData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG *lpread) { 400 ICOM_THIS(IAVIStreamImpl,iface);401 402 FIXME("(%p)->ReadData(0x%08lx,%p,%p)\n",This,fcc,lp,lpread);403 return E_FAIL;399 ICOM_THIS(IAVIStreamImpl,iface); 400 401 FIXME("(%p)->ReadData(0x%08lx,%p,%p)\n",This,fcc,lp,lpread); 402 return E_FAIL; 404 403 } 405 404 406 405 static HRESULT WINAPI IAVIStream_fnWriteData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG size) { 407 ICOM_THIS(IAVIStreamImpl,iface);408 409 FIXME("(%p)->WriteData(0x%08lx,%p,%ld)\n",This,fcc,lp,size);410 return E_FAIL;406 ICOM_THIS(IAVIStreamImpl,iface); 407 408 FIXME("(%p)->WriteData(0x%08lx,%p,%ld)\n",This,fcc,lp,size); 409 return E_FAIL; 411 410 } 412 411 413 412 static HRESULT WINAPI IAVIStream_fnSetInfo(IAVIStream*iface,AVISTREAMINFOW*info,LONG infolen) { 414 ICOM_THIS(IAVIStreamImpl,iface);415 416 FIXME("(%p)->SetInfo(%p,%ld)\n",This,info,infolen);417 418 return E_FAIL;419 } 420 413 ICOM_THIS(IAVIStreamImpl,iface); 414 415 FIXME("(%p)->SetInfo(%p,%ld)\n",This,info,infolen); 416 417 return E_FAIL; 418 } 419 -
trunk/src/avifil32/igframe.c
r6652 r6712 1 /* $Id: igframe.c,v 1.2 2001-09-05 14:16:45 bird Exp $ */2 1 /* 3 2 * Copyright 2001 Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp> … … 30 29 struct ICOM_VTABLE(IGetFrame) igetfrm = { 31 30 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 32 IGetFrame_fnQueryInterface,33 IGetFrame_fnAddRef,34 IGetFrame_fnRelease,35 IGetFrame_fnGetFrame,36 IGetFrame_fnBegin,37 IGetFrame_fnEnd,38 IGetFrame_fnSetFormat,31 IGetFrame_fnQueryInterface, 32 IGetFrame_fnAddRef, 33 IGetFrame_fnRelease, 34 IGetFrame_fnGetFrame, 35 IGetFrame_fnBegin, 36 IGetFrame_fnEnd, 37 IGetFrame_fnSetFormat, 39 38 }; 40 39 41 40 typedef struct IGetFrameImpl 42 41 { 43 ICOM_VFIELD(IGetFrame);44 /* IUnknown stuff */45 DWORDref;46 /* IGetFrame stuff */47 IAVIStream*pas;48 HIChIC;49 LONGlCachedFrame;50 BITMAPINFO*pbiICIn;51 BITMAPINFO*pbiICOut;52 LPVOIDpvICOutBits;53 LPVOIDpvICInFmtBuf;54 DWORDdwICInDataBufSize;55 LPVOIDpvICInDataBuf;56 LPVOIDpvICOutBuf;42 ICOM_VFIELD(IGetFrame); 43 /* IUnknown stuff */ 44 DWORD ref; 45 /* IGetFrame stuff */ 46 IAVIStream* pas; 47 HIC hIC; 48 LONG lCachedFrame; 49 BITMAPINFO* pbiICIn; 50 BITMAPINFO* pbiICOut; 51 LPVOID pvICOutBits; 52 LPVOID pvICInFmtBuf; 53 DWORD dwICInDataBufSize; 54 LPVOID pvICInDataBuf; 55 LPVOID pvICOutBuf; 57 56 } IGetFrameImpl; 58 57 59 58 static HRESULT IGetFrame_Construct( IGetFrameImpl* This, 60 IAVIStream* pstr,61 LPBITMAPINFOHEADER lpbi );59 IAVIStream* pstr, 60 LPBITMAPINFOHEADER lpbi ); 62 61 static void IGetFrame_Destruct( IGetFrameImpl* This ); 63 62 … … 67 66 static LPVOID AVIFILE_IGetFrame_DecodeFrame(IGetFrameImpl* This,LONG lPos) 68 67 { 69 HRESULThr;70 DWORDdwRes;71 LONGlFrameLength;72 LONGlSampleCount;73 ICDECOMPRESSicd;74 75 if ( This->hIC == (HIC)NULL )76 return NULL;77 78 hr = IAVIStream_Read(This->pas,lPos,1,NULL,0,79 &lFrameLength,&lSampleCount);80 if ( hr != S_OK || lSampleCount <= 0 )81 {82 FIXME( "IAVIStream_Read failed! res = %08lx\n", hr );83 return NULL;84 }85 TRACE( "frame length = %ld\n", lFrameLength );86 87 if ( This->dwICInDataBufSize < lFrameLength )88 {89 LPVOIDlpv;90 91 if ( This->pvICInDataBuf == NULL )92 {93 lpv = HeapAlloc(94 AVIFILE_data.hHeap,HEAP_ZERO_MEMORY,95 lFrameLength );96 }97 else98 {99 lpv = HeapReAlloc(100 AVIFILE_data.hHeap,HEAP_ZERO_MEMORY,101 This->pvICInDataBuf,lFrameLength );102 }103 if ( lpv == NULL )104 {105 ERR( "out of memory!\n" );106 return NULL;107 }108 This->pvICInDataBuf = lpv;109 This->dwICInDataBufSize = lFrameLength;110 }111 112 hr = IAVIStream_Read(This->pas,lPos,1,113 This->pvICInDataBuf,This->dwICInDataBufSize,114 &lFrameLength,&lSampleCount);115 if ( hr != S_OK || lSampleCount <= 0 )116 {117 FIXME( "IAVIStream_Read to buffer failed! res = %08lx\n", hr );118 return NULL;119 }120 121 This->pbiICIn->bmiHeader.biSizeImage = lFrameLength;122 123 TRACE( "call ICM_DECOMPRESS\n" );124 icd.dwFlags = (*(BYTE*)This->pvICInDataBuf) == 'c' ?125 ICDECOMPRESS_NOTKEYFRAME : 0;126 icd.lpbiInput = &This->pbiICIn->bmiHeader;127 icd.lpInput = (BYTE*)This->pvICInDataBuf + 8;128 icd.lpbiOutput = &This->pbiICOut->bmiHeader;129 icd.lpOutput = This->pvICOutBits;130 icd.ckid = *((DWORD*)This->pvICInDataBuf);131 dwRes = ICSendMessage(This->hIC,ICM_DECOMPRESS,132 (DWORD)(&icd),sizeof(ICDECOMPRESS) );133 TRACE( "returned from ICM_DECOMPRESS\n" );134 if ( dwRes != ICERR_OK )135 {136 ERR( "ICDecompress failed!\n" );137 return NULL;138 }139 140 This->lCachedFrame = lPos;141 142 return This->pvICOutBits;68 HRESULT hr; 69 DWORD dwRes; 70 LONG lFrameLength; 71 LONG lSampleCount; 72 ICDECOMPRESS icd; 73 74 if ( This->hIC == (HIC)NULL ) 75 return NULL; 76 77 hr = IAVIStream_Read(This->pas,lPos,1,NULL,0, 78 &lFrameLength,&lSampleCount); 79 if ( hr != S_OK || lSampleCount <= 0 ) 80 { 81 FIXME( "IAVIStream_Read failed! res = %08lx\n", hr ); 82 return NULL; 83 } 84 TRACE( "frame length = %ld\n", lFrameLength ); 85 86 if ( This->dwICInDataBufSize < lFrameLength ) 87 { 88 LPVOID lpv; 89 90 if ( This->pvICInDataBuf == NULL ) 91 { 92 lpv = HeapAlloc( 93 AVIFILE_data.hHeap,HEAP_ZERO_MEMORY, 94 lFrameLength ); 95 } 96 else 97 { 98 lpv = HeapReAlloc( 99 AVIFILE_data.hHeap,HEAP_ZERO_MEMORY, 100 This->pvICInDataBuf,lFrameLength ); 101 } 102 if ( lpv == NULL ) 103 { 104 ERR( "out of memory!\n" ); 105 return NULL; 106 } 107 This->pvICInDataBuf = lpv; 108 This->dwICInDataBufSize = lFrameLength; 109 } 110 111 hr = IAVIStream_Read(This->pas,lPos,1, 112 This->pvICInDataBuf,This->dwICInDataBufSize, 113 &lFrameLength,&lSampleCount); 114 if ( hr != S_OK || lSampleCount <= 0 ) 115 { 116 FIXME( "IAVIStream_Read to buffer failed! res = %08lx\n", hr ); 117 return NULL; 118 } 119 120 This->pbiICIn->bmiHeader.biSizeImage = lFrameLength; 121 122 TRACE( "call ICM_DECOMPRESS\n" ); 123 icd.dwFlags = (*(BYTE*)This->pvICInDataBuf) == 'c' ? 124 ICDECOMPRESS_NOTKEYFRAME : 0; 125 icd.lpbiInput = &This->pbiICIn->bmiHeader; 126 icd.lpInput = (BYTE*)This->pvICInDataBuf + 8; 127 icd.lpbiOutput = &This->pbiICOut->bmiHeader; 128 icd.lpOutput = This->pvICOutBits; 129 icd.ckid = *((DWORD*)This->pvICInDataBuf); 130 dwRes = ICSendMessage(This->hIC,ICM_DECOMPRESS, 131 (DWORD)(&icd),sizeof(ICDECOMPRESS) ); 132 TRACE( "returned from ICM_DECOMPRESS\n" ); 133 if ( dwRes != ICERR_OK ) 134 { 135 ERR( "ICDecompress failed!\n" ); 136 return NULL; 137 } 138 139 This->lCachedFrame = lPos; 140 141 return This->pvICOutBits; 143 142 } 144 143 … … 146 145 147 146 HRESULT AVIFILE_CreateIGetFrame(void** ppobj, 148 IAVIStream* pstr,LPBITMAPINFOHEADER lpbi)149 { 150 IGetFrameImpl*This;151 HRESULThr;152 153 *ppobj = NULL;154 This = (IGetFrameImpl*)HeapAlloc(AVIFILE_data.hHeap,HEAP_ZERO_MEMORY,155 sizeof(IGetFrameImpl));156 This->ref = 1;157 ICOM_VTBL(This) = &igetfrm;158 hr = IGetFrame_Construct( This, pstr, lpbi );159 if ( hr != S_OK )160 {161 IGetFrame_Destruct( This );162 return hr;163 }164 165 *ppobj = (LPVOID)This;166 167 return S_OK;147 IAVIStream* pstr,LPBITMAPINFOHEADER lpbi) 148 { 149 IGetFrameImpl *This; 150 HRESULT hr; 151 152 *ppobj = NULL; 153 This = (IGetFrameImpl*)HeapAlloc(AVIFILE_data.hHeap,HEAP_ZERO_MEMORY, 154 sizeof(IGetFrameImpl)); 155 This->ref = 1; 156 ICOM_VTBL(This) = &igetfrm; 157 hr = IGetFrame_Construct( This, pstr, lpbi ); 158 if ( hr != S_OK ) 159 { 160 IGetFrame_Destruct( This ); 161 return hr; 162 } 163 164 *ppobj = (LPVOID)This; 165 166 return S_OK; 168 167 } 169 168 … … 174 173 static HRESULT WINAPI IGetFrame_fnQueryInterface(IGetFrame* iface,REFIID refiid,LPVOID *obj) 175 174 { 176 ICOM_THIS(IGetFrameImpl,iface);177 178 TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(refiid),obj);179 if ( IsEqualGUID(&IID_IUnknown,refiid) ||180 IsEqualGUID(&IID_IGetFrame,refiid) )181 {182 IGetFrame_AddRef(iface);183 *obj = iface;184 return S_OK;185 }186 187 return OLE_E_ENUM_NOMORE;175 ICOM_THIS(IGetFrameImpl,iface); 176 177 TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(refiid),obj); 178 if ( IsEqualGUID(&IID_IUnknown,refiid) || 179 IsEqualGUID(&IID_IGetFrame,refiid) ) 180 { 181 IGetFrame_AddRef(iface); 182 *obj = iface; 183 return S_OK; 184 } 185 186 return OLE_E_ENUM_NOMORE; 188 187 } 189 188 190 189 static ULONG WINAPI IGetFrame_fnAddRef(IGetFrame* iface) 191 190 { 192 ICOM_THIS(IGetFrameImpl,iface);193 194 TRACE("(%p)->AddRef()\n",iface);195 return ++(This->ref);191 ICOM_THIS(IGetFrameImpl,iface); 192 193 TRACE("(%p)->AddRef()\n",iface); 194 return ++(This->ref); 196 195 } 197 196 198 197 static ULONG WINAPI IGetFrame_fnRelease(IGetFrame* iface) 199 198 { 200 ICOM_THIS(IGetFrameImpl,iface);201 202 TRACE("(%p)->Release()\n",iface);203 if ((--(This->ref)) > 0 )204 return This->ref;205 IGetFrame_Destruct(This);206 if ( This->pas != NULL )207 IAVIStream_Release( This->pas );208 209 HeapFree(AVIFILE_data.hHeap,0,iface);210 return 0;199 ICOM_THIS(IGetFrameImpl,iface); 200 201 TRACE("(%p)->Release()\n",iface); 202 if ((--(This->ref)) > 0 ) 203 return This->ref; 204 IGetFrame_Destruct(This); 205 if ( This->pas != NULL ) 206 IAVIStream_Release( This->pas ); 207 208 HeapFree(AVIFILE_data.hHeap,0,iface); 209 return 0; 211 210 } 212 211 … … 217 216 static LPVOID WINAPI IGetFrame_fnGetFrame(IGetFrame* iface,LONG lPos) 218 217 { 219 ICOM_THIS(IGetFrameImpl,iface);220 LPVOIDlpv;221 LONGlKeyFrame;222 223 TRACE( "(%p)->(%ld)\n", This, lPos );224 225 if ( lPos < 0 )226 return NULL;227 228 if ( This->lCachedFrame == lPos )229 return This->pvICOutBits;230 if ( (This->lCachedFrame+1) != lPos )231 {232 lKeyFrame = IAVIStream_FindSample( This->pas, lPos,233 FIND_KEY | FIND_PREV );234 if ( lKeyFrame < 0 || lKeyFrame > lPos )235 return NULL;236 while ( ++lKeyFrame < lPos )237 {238 lpv = AVIFILE_IGetFrame_DecodeFrame(This, lKeyFrame);239 if ( lpv == NULL )240 return NULL;241 }242 }243 244 lpv = AVIFILE_IGetFrame_DecodeFrame(This, lPos);245 TRACE( "lpv = %p\n",lpv );246 if ( lpv == NULL )247 return NULL;248 249 return lpv;218 ICOM_THIS(IGetFrameImpl,iface); 219 LPVOID lpv; 220 LONG lKeyFrame; 221 222 TRACE( "(%p)->(%ld)\n", This, lPos ); 223 224 if ( lPos < 0 ) 225 return NULL; 226 227 if ( This->lCachedFrame == lPos ) 228 return This->pvICOutBits; 229 if ( (This->lCachedFrame+1) != lPos ) 230 { 231 lKeyFrame = IAVIStream_FindSample( This->pas, lPos, 232 FIND_KEY | FIND_PREV ); 233 if ( lKeyFrame < 0 || lKeyFrame > lPos ) 234 return NULL; 235 while ( ++lKeyFrame < lPos ) 236 { 237 lpv = AVIFILE_IGetFrame_DecodeFrame(This, lKeyFrame); 238 if ( lpv == NULL ) 239 return NULL; 240 } 241 } 242 243 lpv = AVIFILE_IGetFrame_DecodeFrame(This, lPos); 244 TRACE( "lpv = %p\n",lpv ); 245 if ( lpv == NULL ) 246 return NULL; 247 248 return lpv; 250 249 } 251 250 252 251 static HRESULT WINAPI IGetFrame_fnBegin(IGetFrame* iface,LONG lStart,LONG lEnd,LONG lRate) 253 252 { 254 ICOM_THIS(IGetFrameImpl,iface);255 256 TRACE( "(%p)->(%ld,%ld,%ld)\n", This, lStart, lEnd, lRate );257 258 if ( This->hIC == (HIC)NULL )259 return E_UNEXPECTED;260 261 if ( ICDecompressBegin( This->hIC,262 This->pbiICIn,263 This->pbiICOut ) != ICERR_OK )264 return E_FAIL;265 266 return S_OK;253 ICOM_THIS(IGetFrameImpl,iface); 254 255 TRACE( "(%p)->(%ld,%ld,%ld)\n", This, lStart, lEnd, lRate ); 256 257 if ( This->hIC == (HIC)NULL ) 258 return E_UNEXPECTED; 259 260 if ( ICDecompressBegin( This->hIC, 261 This->pbiICIn, 262 This->pbiICOut ) != ICERR_OK ) 263 return E_FAIL; 264 265 return S_OK; 267 266 } 268 267 269 268 static HRESULT WINAPI IGetFrame_fnEnd(IGetFrame* iface) 270 269 { 271 ICOM_THIS(IGetFrameImpl,iface);272 273 TRACE( "(%p)->()\n", This );274 275 if ( This->hIC == (HIC)NULL )276 return E_UNEXPECTED;277 278 if ( ICDecompressEnd( This->hIC ) != ICERR_OK )279 return E_FAIL;280 281 return S_OK;270 ICOM_THIS(IGetFrameImpl,iface); 271 272 TRACE( "(%p)->()\n", This ); 273 274 if ( This->hIC == (HIC)NULL ) 275 return E_UNEXPECTED; 276 277 if ( ICDecompressEnd( This->hIC ) != ICERR_OK ) 278 return E_FAIL; 279 280 return S_OK; 282 281 } 283 282 284 283 static HRESULT WINAPI IGetFrame_fnSetFormat(IGetFrame* iface,LPBITMAPINFOHEADER lpbi,LPVOID lpBits,INT x,INT y,INT dx,INT dy) 285 284 { 286 ICOM_THIS(IGetFrameImpl,iface);287 HRESULThr;288 LONGfmtlen;289 BITMAPINFOHEADERbiTemp;290 DWORDdwSizeImage;291 292 FIXME( "(%p)->(%p,%p,%d,%d,%d,%d)\n",This,lpbi,lpBits,x,y,dx,dy );293 294 IGetFrame_Destruct(This);295 296 hr = IAVIStream_ReadFormat(This->pas,0,NULL,&fmtlen);297 if ( hr != S_OK )298 return hr;299 This->pvICInFmtBuf = HeapAlloc(300 AVIFILE_data.hHeap,HEAP_ZERO_MEMORY,fmtlen);301 if ( This->pvICInFmtBuf == NULL )302 return AVIERR_MEMORY;303 hr = IAVIStream_ReadFormat(This->pas,0,This->pvICInFmtBuf,&fmtlen);304 if ( hr != S_OK )305 return hr;306 This->pbiICIn = (LPBITMAPINFO)This->pvICInFmtBuf;307 308 This->hIC = (HIC)ICOpen( ICTYPE_VIDEO,309 This->pbiICIn->bmiHeader.biCompression,310 ICMODE_DECOMPRESS );311 if ( This->hIC == (HIC)NULL )312 {313 ERR( "no AVI decompressor for %c%c%c%c.\n",314 (int)(This->pbiICIn->bmiHeader.biCompression>> 0)&0xff,315 (int)(This->pbiICIn->bmiHeader.biCompression>> 8)&0xff,316 (int)(This->pbiICIn->bmiHeader.biCompression>>16)&0xff,317 (int)(This->pbiICIn->bmiHeader.biCompression>>24)&0xff );318 return E_FAIL;319 }320 321 if ( lpbi == NULL || lpbi == ((LPBITMAPINFOHEADER)1) )322 {323 memset( &biTemp, 0, sizeof(biTemp) );324 biTemp.biSize = sizeof(BITMAPINFOHEADER);325 biTemp.biWidth = This->pbiICIn->bmiHeader.biWidth;326 biTemp.biHeight = This->pbiICIn->bmiHeader.biHeight;327 biTemp.biPlanes = 1;328 biTemp.biBitCount = 24;329 biTemp.biCompression = 0;330 lpbi = &biTemp;331 }332 333 if ( lpbi->biPlanes != 1 || lpbi->biCompression != 0 )334 return E_FAIL;335 336 dwSizeImage =337 ((This->pbiICIn->bmiHeader.biWidth*lpbi->biBitCount+7)/8)*338 This->pbiICIn->bmiHeader.biHeight;339 This->pvICOutBuf = HeapAlloc(340 AVIFILE_data.hHeap,HEAP_ZERO_MEMORY,341 (sizeof(BITMAPINFO)+sizeof(RGBQUAD)*256)*2+342 dwSizeImage );343 if ( This->pvICOutBuf == NULL )344 return AVIERR_MEMORY;345 346 This->pbiICOut = (BITMAPINFO*)This->pvICOutBuf;347 This->pvICOutBits = (LPVOID)( (BYTE*)This->pvICOutBuf +348 sizeof(BITMAPINFO) + sizeof(RGBQUAD)*256 );349 350 This->pbiICOut->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);351 This->pbiICOut->bmiHeader.biWidth = This->pbiICIn->bmiHeader.biWidth;352 This->pbiICOut->bmiHeader.biHeight = This->pbiICIn->bmiHeader.biHeight;353 This->pbiICOut->bmiHeader.biPlanes = 1;354 This->pbiICOut->bmiHeader.biBitCount = lpbi->biBitCount;355 This->pbiICOut->bmiHeader.biSizeImage = dwSizeImage;356 memcpy( This->pvICOutBits, This->pbiICOut, sizeof(BITMAPINFOHEADER) );357 358 return S_OK;285 ICOM_THIS(IGetFrameImpl,iface); 286 HRESULT hr; 287 LONG fmtlen; 288 BITMAPINFOHEADER biTemp; 289 DWORD dwSizeImage; 290 291 FIXME( "(%p)->(%p,%p,%d,%d,%d,%d)\n",This,lpbi,lpBits,x,y,dx,dy ); 292 293 IGetFrame_Destruct(This); 294 295 hr = IAVIStream_ReadFormat(This->pas,0,NULL,&fmtlen); 296 if ( hr != S_OK ) 297 return hr; 298 This->pvICInFmtBuf = HeapAlloc( 299 AVIFILE_data.hHeap,HEAP_ZERO_MEMORY,fmtlen); 300 if ( This->pvICInFmtBuf == NULL ) 301 return AVIERR_MEMORY; 302 hr = IAVIStream_ReadFormat(This->pas,0,This->pvICInFmtBuf,&fmtlen); 303 if ( hr != S_OK ) 304 return hr; 305 This->pbiICIn = (LPBITMAPINFO)This->pvICInFmtBuf; 306 307 This->hIC = (HIC)ICOpen( ICTYPE_VIDEO, 308 This->pbiICIn->bmiHeader.biCompression, 309 ICMODE_DECOMPRESS ); 310 if ( This->hIC == (HIC)NULL ) 311 { 312 ERR( "no AVI decompressor for %c%c%c%c.\n", 313 (int)(This->pbiICIn->bmiHeader.biCompression>> 0)&0xff, 314 (int)(This->pbiICIn->bmiHeader.biCompression>> 8)&0xff, 315 (int)(This->pbiICIn->bmiHeader.biCompression>>16)&0xff, 316 (int)(This->pbiICIn->bmiHeader.biCompression>>24)&0xff ); 317 return E_FAIL; 318 } 319 320 if ( lpbi == NULL || lpbi == ((LPBITMAPINFOHEADER)1) ) 321 { 322 memset( &biTemp, 0, sizeof(biTemp) ); 323 biTemp.biSize = sizeof(BITMAPINFOHEADER); 324 biTemp.biWidth = This->pbiICIn->bmiHeader.biWidth; 325 biTemp.biHeight = This->pbiICIn->bmiHeader.biHeight; 326 biTemp.biPlanes = 1; 327 biTemp.biBitCount = 24; 328 biTemp.biCompression = 0; 329 lpbi = &biTemp; 330 } 331 332 if ( lpbi->biPlanes != 1 || lpbi->biCompression != 0 ) 333 return E_FAIL; 334 335 dwSizeImage = 336 ((This->pbiICIn->bmiHeader.biWidth*lpbi->biBitCount+7)/8)* 337 This->pbiICIn->bmiHeader.biHeight; 338 This->pvICOutBuf = HeapAlloc( 339 AVIFILE_data.hHeap,HEAP_ZERO_MEMORY, 340 (sizeof(BITMAPINFO)+sizeof(RGBQUAD)*256)*2+ 341 dwSizeImage ); 342 if ( This->pvICOutBuf == NULL ) 343 return AVIERR_MEMORY; 344 345 This->pbiICOut = (BITMAPINFO*)This->pvICOutBuf; 346 This->pvICOutBits = (LPVOID)( (BYTE*)This->pvICOutBuf + 347 sizeof(BITMAPINFO) + sizeof(RGBQUAD)*256 ); 348 349 This->pbiICOut->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); 350 This->pbiICOut->bmiHeader.biWidth = This->pbiICIn->bmiHeader.biWidth; 351 This->pbiICOut->bmiHeader.biHeight = This->pbiICIn->bmiHeader.biHeight; 352 This->pbiICOut->bmiHeader.biPlanes = 1; 353 This->pbiICOut->bmiHeader.biBitCount = lpbi->biBitCount; 354 This->pbiICOut->bmiHeader.biSizeImage = dwSizeImage; 355 memcpy( This->pvICOutBits, This->pbiICOut, sizeof(BITMAPINFOHEADER) ); 356 357 return S_OK; 359 358 } 360 359 361 360 static HRESULT IGetFrame_Construct( IGetFrameImpl* This, 362 IAVIStream* pstr,363 LPBITMAPINFOHEADER lpbi )364 { 365 HRESULThr;366 367 TRACE( "(%p)->(%p,%p)\n",This,pstr,lpbi );368 369 IAVIStream_AddRef( pstr );370 This->pas = pstr;371 This->hIC = (HIC)NULL;372 This->lCachedFrame = -1L;373 This->pbiICIn = NULL;374 This->pbiICOut = NULL;375 This->pvICInFmtBuf = NULL;376 This->pvICInDataBuf = NULL;377 This->dwICInDataBufSize = 0;378 This->pvICOutBuf = NULL;379 380 hr = IGetFrame_SetFormat((IGetFrame*)This,lpbi,NULL,0,0,0,0);381 if ( hr != S_OK )382 return hr;383 384 return S_OK;361 IAVIStream* pstr, 362 LPBITMAPINFOHEADER lpbi ) 363 { 364 HRESULT hr; 365 366 TRACE( "(%p)->(%p,%p)\n",This,pstr,lpbi ); 367 368 IAVIStream_AddRef( pstr ); 369 This->pas = pstr; 370 This->hIC = (HIC)NULL; 371 This->lCachedFrame = -1L; 372 This->pbiICIn = NULL; 373 This->pbiICOut = NULL; 374 This->pvICInFmtBuf = NULL; 375 This->pvICInDataBuf = NULL; 376 This->dwICInDataBufSize = 0; 377 This->pvICOutBuf = NULL; 378 379 hr = IGetFrame_SetFormat((IGetFrame*)This,lpbi,NULL,0,0,0,0); 380 if ( hr != S_OK ) 381 return hr; 382 383 return S_OK; 385 384 } 386 385 387 386 static void IGetFrame_Destruct( IGetFrameImpl* This ) 388 387 { 389 if ( This->hIC != (HIC)NULL )390 {391 ICClose( This->hIC );392 This->hIC = (HIC)NULL;393 }394 if ( This->pvICInFmtBuf != NULL )395 {396 HeapFree( AVIFILE_data.hHeap, 0, This->pvICInFmtBuf );397 This->pvICInFmtBuf = NULL;398 }399 if ( This->pvICInDataBuf != NULL )400 {401 HeapFree( AVIFILE_data.hHeap, 0, This->pvICInDataBuf );402 This->pvICInDataBuf = NULL;403 }404 if ( This->pvICOutBuf != NULL )405 {406 HeapFree( AVIFILE_data.hHeap, 0, This->pvICOutBuf );407 This->pvICOutBuf = NULL;408 }409 410 This->lCachedFrame = -1L;411 This->pbiICIn = NULL;412 This->pbiICOut = NULL;413 This->dwICInDataBufSize = 0;414 } 388 if ( This->hIC != (HIC)NULL ) 389 { 390 ICClose( This->hIC ); 391 This->hIC = (HIC)NULL; 392 } 393 if ( This->pvICInFmtBuf != NULL ) 394 { 395 HeapFree( AVIFILE_data.hHeap, 0, This->pvICInFmtBuf ); 396 This->pvICInFmtBuf = NULL; 397 } 398 if ( This->pvICInDataBuf != NULL ) 399 { 400 HeapFree( AVIFILE_data.hHeap, 0, This->pvICInDataBuf ); 401 This->pvICInDataBuf = NULL; 402 } 403 if ( This->pvICOutBuf != NULL ) 404 { 405 HeapFree( AVIFILE_data.hHeap, 0, This->pvICOutBuf ); 406 This->pvICOutBuf = NULL; 407 } 408 409 This->lCachedFrame = -1L; 410 This->pbiICIn = NULL; 411 This->pbiICOut = NULL; 412 This->dwICInDataBufSize = 0; 413 } -
trunk/src/avifil32/main.c
r6652 r6712 1 /* $Id: main.c,v 1.2 2001-09-05 14:16:45 bird Exp $ */2 1 /* 3 2 * Copyright 2001 Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp> … … 22 21 23 22 /*********************************************************************** 24 * AVIFILE_InitProcess (internal)23 * AVIFILE_InitProcess (internal) 25 24 */ 26 25 static BOOL AVIFILE_InitProcess( void ) 27 26 { 28 TRACE("()\n");27 TRACE("()\n"); 29 28 30 AVIFILE_data.dwAVIFileRef = 0;31 AVIFILE_data.dwClassObjRef = 0;32 AVIFILE_data.hHeap = (HANDLE)NULL;29 AVIFILE_data.dwAVIFileRef = 0; 30 AVIFILE_data.dwClassObjRef = 0; 31 AVIFILE_data.hHeap = (HANDLE)NULL; 33 32 34 AVIFILE_data.hHeap = HeapCreate( 0, 0x10000, 0 );35 if ( AVIFILE_data.hHeap == (HANDLE)NULL )36 {37 ERR( "cannot allocate heap for AVIFILE.\n" );38 return FALSE;39 }33 AVIFILE_data.hHeap = HeapCreate( 0, 0x10000, 0 ); 34 if ( AVIFILE_data.hHeap == (HANDLE)NULL ) 35 { 36 ERR( "cannot allocate heap for AVIFILE.\n" ); 37 return FALSE; 38 } 40 39 41 return TRUE;40 return TRUE; 42 41 } 43 42 44 43 /*********************************************************************** 45 * AVIFILE_UninitProcess (internal)44 * AVIFILE_UninitProcess (internal) 46 45 */ 47 46 static void AVIFILE_UninitProcess( void ) 48 47 { 49 TRACE("()\n");48 TRACE("()\n"); 50 49 51 if ( AVIFILE_data.dwAVIFileRef != 0 )52 ERR( "you must call AVIFileExit()\n" );50 if ( AVIFILE_data.dwAVIFileRef != 0 ) 51 ERR( "you must call AVIFileExit()\n" ); 53 52 54 if ( AVIFILE_data.dwClassObjRef != 0 )55 ERR( "you must release some objects allocated from AVIFile.\n" );53 if ( AVIFILE_data.dwClassObjRef != 0 ) 54 ERR( "you must release some objects allocated from AVIFile.\n" ); 56 55 57 if ( AVIFILE_data.hHeap != (HANDLE)NULL )58 {59 HeapDestroy( AVIFILE_data.hHeap );60 AVIFILE_data.hHeap = (HANDLE)NULL;61 }56 if ( AVIFILE_data.hHeap != (HANDLE)NULL ) 57 { 58 HeapDestroy( AVIFILE_data.hHeap ); 59 AVIFILE_data.hHeap = (HANDLE)NULL; 60 } 62 61 } 63 62 64 63 /*********************************************************************** 65 * AVIFILE_DllMain64 * AVIFILE_DllMain 66 65 */ 67 66 BOOL WINAPI AVIFILE_DllMain( 68 HINSTANCE hInstDLL,69 DWORD fdwReason,70 LPVOID lpvReserved )67 HINSTANCE hInstDLL, 68 DWORD fdwReason, 69 LPVOID lpvReserved ) 71 70 { 72 switch ( fdwReason )73 {74 case DLL_PROCESS_ATTACH:75 if ( !AVIFILE_InitProcess() )76 return FALSE;77 break;78 case DLL_PROCESS_DETACH:79 AVIFILE_UninitProcess();80 break;81 case DLL_THREAD_ATTACH:82 break;83 case DLL_THREAD_DETACH:84 break;85 }71 switch ( fdwReason ) 72 { 73 case DLL_PROCESS_ATTACH: 74 if ( !AVIFILE_InitProcess() ) 75 return FALSE; 76 break; 77 case DLL_PROCESS_DETACH: 78 AVIFILE_UninitProcess(); 79 break; 80 case DLL_THREAD_ATTACH: 81 break; 82 case DLL_THREAD_DETACH: 83 break; 84 } 86 85 87 return TRUE;86 return TRUE; 88 87 } 89 88 -
trunk/src/avifil32/string.c
r6652 r6712 1 /* $Id: string.c,v 1.2 2001-09-05 14:16:46 bird Exp $ */2 1 /* 3 2 * Copyright 2001 Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp> … … 25 24 INT AVIFILE_strlenAtoW( LPCSTR lpstr ) 26 25 { 27 INTlen;26 INT len; 28 27 29 len = MultiByteToWideChar( CP_ACP, 0, lpstr, -1, NULL, 0 );30 return ( len > 0 ) ? (len-1) : 0;28 len = MultiByteToWideChar( CP_ACP, 0, lpstr, -1, NULL, 0 ); 29 return ( len > 0 ) ? (len-1) : 0; 31 30 } 32 31 33 32 INT AVIFILE_strlenWtoA( LPCWSTR lpwstr ) 34 33 { 35 INTlen;34 INT len; 36 35 37 len = WideCharToMultiByte( CP_ACP, 0, lpwstr, -1,38 NULL, 0, NULL, NULL );39 return ( len > 0 ) ? (len-1) : 0;36 len = WideCharToMultiByte( CP_ACP, 0, lpwstr, -1, 37 NULL, 0, NULL, NULL ); 38 return ( len > 0 ) ? (len-1) : 0; 40 39 } 41 40 42 41 LPWSTR AVIFILE_strncpyAtoW( LPWSTR lpwstr, LPCSTR lpstr, INT wbuflen ) 43 42 { 44 INTlen;43 INT len; 45 44 46 len = MultiByteToWideChar( CP_ACP, 0, lpstr, -1, lpwstr, wbuflen );47 if ( len == 0 )48 *lpwstr = 0;49 return lpwstr;45 len = MultiByteToWideChar( CP_ACP, 0, lpstr, -1, lpwstr, wbuflen ); 46 if ( len == 0 ) 47 *lpwstr = 0; 48 return lpwstr; 50 49 } 51 50 52 51 LPSTR AVIFILE_strncpyWtoA( LPSTR lpstr, LPCWSTR lpwstr, INT abuflen ) 53 52 { 54 INTlen;53 INT len; 55 54 56 len = WideCharToMultiByte( CP_ACP, 0, lpwstr, -1,57 lpstr, abuflen, NULL, NULL );58 if ( len == 0 )59 *lpstr = 0;60 return lpstr;55 len = WideCharToMultiByte( CP_ACP, 0, lpwstr, -1, 56 lpstr, abuflen, NULL, NULL ); 57 if ( len == 0 ) 58 *lpstr = 0; 59 return lpstr; 61 60 } 62 61 63 62 LPWSTR AVIFILE_strdupAtoW( LPCSTR lpstr ) 64 63 { 65 INT len;66 LPWSTR lpwstr = NULL;64 INT len; 65 LPWSTR lpwstr = NULL; 67 66 68 len = AVIFILE_strlenAtoW( lpstr );69 if ( len > 0 )70 {71 lpwstr = (LPWSTR)HeapAlloc( AVIFILE_data.hHeap, 0, sizeof(WCHAR)*(len+1) );72 if ( lpwstr != NULL )73 (void)AVIFILE_strncpyAtoW( lpwstr, lpstr, len+1 );74 }67 len = AVIFILE_strlenAtoW( lpstr ); 68 if ( len > 0 ) 69 { 70 lpwstr = (LPWSTR)HeapAlloc( AVIFILE_data.hHeap, 0, sizeof(WCHAR)*(len+1) ); 71 if ( lpwstr != NULL ) 72 (void)AVIFILE_strncpyAtoW( lpwstr, lpstr, len+1 ); 73 } 75 74 76 return lpwstr;75 return lpwstr; 77 76 } 78 77 79 78 LPSTR AVIFILE_strdupWtoA( LPCWSTR lpwstr ) 80 79 { 81 INT len;82 LPSTR lpstr = NULL;80 INT len; 81 LPSTR lpstr = NULL; 83 82 84 len = AVIFILE_strlenWtoA( lpwstr );85 if ( len > 0 )86 {87 lpstr = (LPSTR)HeapAlloc( AVIFILE_data.hHeap, 0, sizeof(CHAR)*(len+1) );88 if ( lpstr != NULL )89 (void)AVIFILE_strncpyWtoA( lpstr, lpwstr, len+1 );90 }83 len = AVIFILE_strlenWtoA( lpwstr ); 84 if ( len > 0 ) 85 { 86 lpstr = (LPSTR)HeapAlloc( AVIFILE_data.hHeap, 0, sizeof(CHAR)*(len+1) ); 87 if ( lpstr != NULL ) 88 (void)AVIFILE_strncpyWtoA( lpstr, lpwstr, len+1 ); 89 } 91 90 92 return lpstr;91 return lpstr; 93 92 } 94 93 -
trunk/src/crtdll/crtdll.cpp
r6645 r6712 1 /* $Id: crtdll.cpp,v 1.30 2001-09-05 12:14:23 bird Exp $ */2 1 /* 3 2 * The C RunTime DLL 4 * 3 * 5 4 * Implements C run-time functionality as known from UNIX. 6 5 * 7 * TODO: 6 * TODO: 8 7 * - Check setjmp(3) 9 8 * - fix *ALL* functions for the FS: wrapper problem … … 73 72 // Definitions for internal functions 74 73 // 75 void qsort1 (char*, char*, size_t,74 void qsort1 (char*, char*, size_t, 76 75 int (* CDECL)(const void*, const void*)); 77 76 … … 445 444 446 445 /********************************************************************* 447 * _cscanf(CRTDLL.67)446 * _cscanf (CRTDLL.67) 448 447 */ 449 448 INT CDECL CRTDLL__cscanf( char *s, va_list arg ) … … 605 604 606 605 /********************************************************************* 607 * _ftime(CRTDLL.112)606 * _ftime (CRTDLL.112) 608 607 */ 609 608 void CDECL CRTDLL__ftime( struct timeb *timebuf ) … … 619 618 LONG CDECL CRTDLL__ftol(void) 620 619 { 621 /* don't just do DO_FPU("fistp",retval), because the rounding622 * mode must also be set to "round towards zero"... */623 double fl;624 POP_FPU(fl);625 return (LONG)fl;620 /* don't just do DO_FPU("fistp",retval), because the rounding 621 * mode must also be set to "round towards zero"... */ 622 double fl; 623 POP_FPU(fl); 624 return (LONG)fl; 626 625 } 627 626 … … 776 775 777 776 /********************************************************************* 778 * _ltoa (CRTDLL.179)777 * _ltoa (CRTDLL.179) 779 778 */ 780 779 LPSTR CDECL CRTDLL__ltoa(long x,LPSTR buf,INT radix) … … 785 784 786 785 /********************************************************************* 787 * _matherr (CRTDLL.181)786 * _matherr (CRTDLL.181) 788 787 */ 789 788 double CDECL CRTDLL__matherr( struct exception * excep ) … … 882 881 883 882 /********************************************************************* 884 * CRTDLL__searchenv (CRTDLL.260)883 * CRTDLL__searchenv (CRTDLL.260) 885 884 */ 886 885 void CDECL CRTDLL__searchenv(char *file, char *var,char *path ) … … 892 891 893 892 /********************************************************************* 894 * CRTDLL__seterrormode (CRTDLL.261)893 * CRTDLL__seterrormode (CRTDLL.261) 895 894 */ 896 895 void CDECL CRTDLL__seterrormode(int uMode) … … 903 902 904 903 /********************************************************************* 905 * CRTDLL__setjmp (CRTDLL.262)904 * CRTDLL__setjmp (CRTDLL.262) 906 905 */ 907 906 int CDECL CRTDLL__setjmp( jmp_buf env ) … … 938 937 939 938 /********************************************************************* 940 * _sopen(CRTDLL.268)939 * _sopen (CRTDLL.268) 941 940 */ 942 941 int CDECL CRTDLL__sopen( const char *s, int i1, int i2, va_list arg ) … … 948 947 949 948 /********************************************************************* 950 * CRTDLL__spawnl (CRTDLL.269)949 * CRTDLL__spawnl (CRTDLL.269) 951 950 */ 952 951 int CDECL CRTDLL__spawnl(int nMode, char* szPath, char* szArgv0, va_list arg) … … 958 957 959 958 /********************************************************************* 960 * CRTDLL__spawnle (CRTDLL.270)959 * CRTDLL__spawnle (CRTDLL.270) 961 960 */ 962 961 int CDECL CRTDLL__spawnle( int mode, char *path, char **szArgv0, va_list arg ) … … 968 967 969 968 /********************************************************************* 970 * CRTDLL__spawnlp (CRTDLL.271)969 * CRTDLL__spawnlp (CRTDLL.271) 971 970 */ 972 971 int CDECL CRTDLL__spawnlp(int nMode, char* szPath, char* szArgv0, va_list arg) … … 978 977 979 978 /********************************************************************* 980 * CRTDLL__spawnlpe (CRTDLL.272)979 * CRTDLL__spawnlpe (CRTDLL.272) 981 980 */ 982 981 int CDECL CRTDLL__spawnlpe( int mode, char *path, char *szArgv0, va_list arg ) … … 988 987 989 988 /********************************************************************* 990 * CRTDLL__spawnv (CRTDLL.273)989 * CRTDLL__spawnv (CRTDLL.273) 991 990 */ 992 991 int CDECL CRTDLL__spawnv( int i, char *s1, char ** s2 ) … … 998 997 999 998 /********************************************************************* 1000 * CRTDLL__spawnvp (CRTDLL.275)999 * CRTDLL__spawnvp (CRTDLL.275) 1001 1000 */ 1002 1001 int CDECL CRTDLL__spawnvp( int i, char *s1, char ** s2 ) … … 1007 1006 1008 1007 /********************************************************************* 1009 * CRTDLL__spawnv (CRTDLL.276)1008 * CRTDLL__spawnv (CRTDLL.276) 1010 1009 */ 1011 1010 int CDECL CRTDLL__spawnvpe( int i, char *s1, char ** s2, char ** s3 ) … … 1017 1016 1018 1017 /********************************************************************* 1019 * CRTDLL__statusfp (CRTDLL.279)1018 * CRTDLL__statusfp (CRTDLL.279) 1020 1019 */ 1021 1020 unsigned int CDECL CRTDLL__statusfp( void ) … … 1024 1023 return (_status87()); 1025 1024 } 1026 1027 1028 /********************************************************************* 1029 * _ultoa (CRTDLL.309)1025 1026 1027 /********************************************************************* 1028 * _ultoa (CRTDLL.309) 1030 1029 */ 1031 1030 LPSTR CDECL CRTDLL__ultoa(long x,LPSTR buf,INT radix) … … 1037 1036 1038 1037 /********************************************************************* 1039 * CRTDLL__ungetch (CRTDLL.311)1038 * CRTDLL__ungetch (CRTDLL.311) 1040 1039 */ 1041 1040 int CDECL CRTDLL__ungetch( int i ) … … 1047 1046 1048 1047 /********************************************************************* 1049 * _utime (CRTDLL.314)1048 * _utime (CRTDLL.314) 1050 1049 */ 1051 1050 int CDECL CRTDLL__utime( char *path, struct utimbuf * times ) … … 1057 1056 1058 1057 /********************************************************************* 1059 * _vsnprintf(CRTDLL.315)1058 * _vsnprintf (CRTDLL.315) 1060 1059 */ 1061 1060 int CDECL CRTDLL__vsnprintf( char *s, size_t bufsize, const char *format, va_list arg ) … … 1101 1100 1102 1101 /********************************************************************* 1103 * abs (CRTDLL.336)1102 * abs (CRTDLL.336) 1104 1103 */ 1105 1104 double CDECL CRTDLL_abs(double d) … … 1113 1112 1114 1113 /********************************************************************* 1115 * acos (CRTDLL.337)1114 * acos (CRTDLL.337) 1116 1115 */ 1117 1116 double CDECL CRTDLL_acos( double x ) … … 1123 1122 1124 1123 /********************************************************************* 1125 * asctime (CRTDLL.338)1124 * asctime (CRTDLL.338) 1126 1125 */ 1127 1126 char * CDECL CRTDLL_asctime( const struct tm *timeptr ) … … 1133 1132 1134 1133 /********************************************************************* 1135 * asin (CRTDLL.339)1134 * asin (CRTDLL.339) 1136 1135 */ 1137 1136 double CDECL CRTDLL_asin( double x ) … … 1143 1142 1144 1143 /********************************************************************* 1145 * atan (CRTDLL.340)1144 * atan (CRTDLL.340) 1146 1145 */ 1147 1146 double CDECL CRTDLL_atan(double d) … … 1155 1154 1156 1155 /********************************************************************* 1157 * atan2 (CRTDLL.341)1156 * atan2 (CRTDLL.341) 1158 1157 */ 1159 1158 double CDECL CRTDLL_atan2( double y, double x ) … … 1165 1164 1166 1165 /********************************************************************* 1167 * atof (CRTDLL.343)1166 * atof (CRTDLL.343) 1168 1167 */ 1169 1168 double CDECL CRTDLL_atof( const char *nptr ) … … 1175 1174 1176 1175 /********************************************************************* 1177 * atoi (CRTDLL.344)1176 * atoi (CRTDLL.344) 1178 1177 */ 1179 1178 int CDECL CRTDLL_atoi(LPSTR str) … … 1187 1186 1188 1187 /********************************************************************* 1189 * atol (CRTDLL.345)1188 * atol (CRTDLL.345) 1190 1189 */ 1191 1190 long CDECL CRTDLL_atol(LPSTR str) … … 1199 1198 1200 1199 /********************************************************************* 1201 * bsearch (CRTDLL.346)1200 * bsearch (CRTDLL.346) 1202 1201 */ 1203 1202 void *CDECL CRTDLL_bsearch (const void *key, const void *base, size_t num, size_t width, … … 1206 1205 int left, right, median, sign; 1207 1206 const void *element; 1208 1207 1209 1208 if (width == 0) 1210 1209 return 0; … … 1227 1226 1228 1227 /********************************************************************* 1229 * ceil (CRTDLL.348)1228 * ceil (CRTDLL.348) 1230 1229 */ 1231 1230 double CDECL CRTDLL_ceil(double d) … … 1238 1237 1239 1238 /********************************************************************* 1240 * clock (CRTDLL.350)1239 * clock (CRTDLL.350) 1241 1240 */ 1242 1241 clock_t CDECL CRTDLL_clock( void ) … … 1248 1247 1249 1248 /********************************************************************* 1250 * cos (CRTDLL.351)1249 * cos (CRTDLL.351) 1251 1250 */ 1252 1251 double CDECL CRTDLL_cos(double d) … … 1260 1259 1261 1260 /********************************************************************* 1262 * cosh (CRTDLL.352)1261 * cosh (CRTDLL.352) 1263 1262 */ 1264 1263 double CDECL CRTDLL_cosh( double x ) … … 1270 1269 1271 1270 /********************************************************************* 1272 * ctime (CRTDLL.353)1271 * ctime (CRTDLL.353) 1273 1272 */ 1274 1273 char * CDECL CRTDLL_ctime( const time_t *timer ) … … 1280 1279 1281 1280 /********************************************************************* 1282 * difftime (CRTDLL.354)1281 * difftime (CRTDLL.354) 1283 1282 */ 1284 1283 double CDECL CRTDLL_difftime( time_t t1, time_t t0 ) … … 1290 1289 1291 1290 /********************************************************************* 1292 * div (CRTDLL.355)1291 * div (CRTDLL.355) 1293 1292 */ 1294 1293 ULONG CDECL CRTDLL_div( int number, int denom ) … … 1304 1303 1305 1304 /********************************************************************* 1306 * exp (CRTDLL.357)1305 * exp (CRTDLL.357) 1307 1306 */ 1308 1307 double CDECL CRTDLL_exp( double x ) … … 1314 1313 1315 1314 /********************************************************************* 1316 * fabs (CRTDLL.358)1315 * fabs (CRTDLL.358) 1317 1316 */ 1318 1317 double CDECL CRTDLL_fabs(double d) … … 1326 1325 1327 1326 /********************************************************************* 1328 * floor (CRTDLL.367)1327 * floor (CRTDLL.367) 1329 1328 */ 1330 1329 double CDECL CRTDLL_floor(double d) … … 1338 1337 1339 1338 /********************************************************************* 1340 * fmod (CRTDLL.368)1339 * fmod (CRTDLL.368) 1341 1340 */ 1342 1341 double CDECL CRTDLL_fmod(double x, double y ) … … 1348 1347 1349 1348 /********************************************************************* 1350 * frexp (CRTDLL.377)1349 * frexp (CRTDLL.377) 1351 1350 */ 1352 1351 double CDECL CRTDLL_frexp( double value, int *exp ) … … 1490 1489 1491 1490 /********************************************************************* 1492 * labs (CRTDLL.416)1491 * labs (CRTDLL.416) 1493 1492 */ 1494 1493 long int CDECL CRTDLL_labs( long int j ) … … 1500 1499 1501 1500 /********************************************************************* 1502 * ldexp (CRTDLL.417)1503 */ 1504 double CDECL CRTDLL_ldexp( double x, int exp ) 1501 * ldexp (CRTDLL.417) 1502 */ 1503 double CDECL CRTDLL_ldexp( double x, int exp ) 1505 1504 { 1506 1505 dprintf2(("CRTDLL: ldexp\n")); … … 1510 1509 1511 1510 /********************************************************************* 1512 * ldiv (CRTDLL.418)1513 */ 1514 ldiv_t CDECL CRTDLL_ldiv( long int numer, long int denom ) 1511 * ldiv (CRTDLL.418) 1512 */ 1513 ldiv_t CDECL CRTDLL_ldiv( long int numer, long int denom ) 1515 1514 { 1516 1515 dprintf2(("CRTDLL: ldiv\n")); … … 1520 1519 1521 1520 /********************************************************************* 1522 * localeconv (CRTDLL.419)1521 * localeconv (CRTDLL.419) 1523 1522 */ 1524 1523 struct lconv * CDECL CRTDLL_localeconv(void) … … 1530 1529 1531 1530 /********************************************************************* 1532 * localtime (CRTDLL.420)1531 * localtime (CRTDLL.420) 1533 1532 */ 1534 1533 struct tm * CDECL CRTDLL_localtime( const time_t *timer ) … … 1540 1539 1541 1540 /********************************************************************* 1542 * log (CRTDLL.421)1541 * log (CRTDLL.421) 1543 1542 */ 1544 1543 double CDECL CRTDLL_log( double x ) … … 1550 1549 1551 1550 /********************************************************************* 1552 * log10 (CRTDLL.422)1551 * log10 (CRTDLL.422) 1553 1552 */ 1554 1553 double CDECL CRTDLL_log10( double x ) … … 1582 1581 * pow (CRTDLL.436) 1583 1582 */ 1584 double CDECL CRTDLL_pow( double x, double y ) 1583 double CDECL CRTDLL_pow( double x, double y ) 1585 1584 { 1586 1585 dprintf2(("CRTDLL: pow(%08xh, %08xh)\n",x, y)); … … 1622 1621 1623 1622 /********************************************************************* 1624 * scanf(CRTDLL.448)1623 * scanf (CRTDLL.448) 1625 1624 */ 1626 1625 int CDECL CRTDLL_scanf( const char *format, va_list arg ) … … 1706 1705 1707 1706 /********************************************************************* 1708 * sscanf(CRTDLL.458)1707 * sscanf (CRTDLL.458) 1709 1708 */ 1710 1709 int CDECL CRTDLL_sscanf( const char *s, const char *format, va_list arg ) … … 1783 1782 1784 1783 /********************************************************************* 1785 * ungetc(CRTDLL.492)1784 * ungetc (CRTDLL.492) 1786 1785 */ 1787 1786 INT CDECL CRTDLL_ungetc(int c, FILE *f) … … 1813 1812 1814 1813 /********************************************************************* 1815 * CRTDLL__setjmp3 (CRTDLL.600)1814 * CRTDLL__setjmp3 (CRTDLL.600) 1816 1815 */ 1817 1816 int CDECL CRTDLL__setjmp3( jmp_buf env ) -
trunk/src/crtdll/crtdll_main.c
r6645 r6712 1 /* $Id: crtdll_main.c,v 1.2 2001-09-05 12:14:24 bird Exp $ */2 1 /* 3 2 * The C RunTime DLL 4 * 3 * 5 4 * Implements C run-time functionality as known from UNIX. 6 5 * … … 14 13 Unresolved issues Uwe Bonnes 970904: 15 14 - tested with ftp://ftp.remcomp.com/pub/remcomp/lcc-win32.zip, a C-Compiler 16 for Win32, based on lcc, from Jacob Navia15 for Win32, based on lcc, from Jacob Navia 17 16 UB 000416: 18 17 - probably not thread safe 19 18 */ 20 19 21 /* NOTE: This file also implements the wcs* functions. They _ARE_ in 20 /* NOTE: This file also implements the wcs* functions. They _ARE_ in 22 21 * the newer Linux libcs, but use 4 byte wide characters, so are unusable, 23 22 * since we need 2 byte wide characters. - Marcus Meissner, 981031 … … 64 63 UINT CRTDLL_winminor_dll; /* CRTDLL.330 */ 65 64 UINT CRTDLL_winver_dll; /* CRTDLL.331 */ 66 INT CRTDLL_doserrno = 0; 65 INT CRTDLL_doserrno = 0; 67 66 INT CRTDLL_errno = 0; 68 67 const INT CRTDLL__sys_nerr = 43; … … 78 77 * CRTDLL_MainInit (CRTDLL.init) 79 78 */ 80 79 81 80 BOOL WINAPI CRTDLL_Init(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) 82 81 { 83 82 FS_OS2 84 83 85 84 // call i/o initializer in file.c 86 if (fdwReason == DLL_PROCESS_ATTACH) 85 if (fdwReason == DLL_PROCESS_ATTACH) 87 86 { 88 87 __CRTDLL__init_io(); 89 88 } 90 89 91 90 /* 92 91 PH 2000/11/21 this code doesn't look very useful 93 92 94 93 if (fdwReason == DLL_PROCESS_ATTACH) { 95 94 _fdopen(0,"r"); … … 104 103 } 105 104 */ 106 105 107 106 FS_WIN32 108 107 return TRUE; … … 177 176 char *cmdline; 178 177 char **xargv; 179 intxargc,end,last_arg,afterlastspace;180 DWORDversion;181 182 TRACE("(%p,%p,%p,%ld).\n",183 argc,argv,environ,flag184 );185 186 if (CRTDLL_acmdln_dll != NULL)187 HeapFree(GetProcessHeap(), 0, CRTDLL_acmdln_dll);188 189 CRTDLL_acmdln_dll = cmdline = CRTDLL__strdup( GetCommandLineA() );190 TRACE("got '%s'\n", cmdline);191 192 version= GetVersion();193 CRTDLL_osver_dll = version >> 16;194 CRTDLL_winminor_dll = version & 0xFF;195 CRTDLL_winmajor_dll = (version>>8) & 0xFF;196 CRTDLL_baseversion_dll = version >> 16;197 CRTDLL_winver_dll = ((version >> 8) & 0xFF) + ((version & 0xFF) << 8);198 CRTDLL_baseminor_dll = (version >> 16) & 0xFF;199 CRTDLL_basemajor_dll = (version >> 24) & 0xFF;200 CRTDLL_osversion_dll = version & 0xFFFF;201 CRTDLL_osminor_dll = version & 0xFF;202 CRTDLL_osmajor_dll = (version>>8) & 0xFF;203 204 /* missing threading init */205 206 end=0;last_arg=0;xargv=NULL;xargc=0;afterlastspace=0;207 while (1)208 {209 if ((cmdline[end]==' ') || (cmdline[end]=='\0'))210 {211 if (cmdline[end]=='\0')212 last_arg=1;213 else214 cmdline[end]='\0';215 /* alloc xargc + NULL entry */216 xargv=(char**)HeapReAlloc( GetProcessHeap(), 0, xargv,217 sizeof(char*)*(xargc+1));218 if (strlen(cmdline+afterlastspace))219 {220 xargv[xargc] = CRTDLL__strdup(cmdline+afterlastspace);221 xargc++;178 int xargc,end,last_arg,afterlastspace; 179 DWORD version; 180 181 TRACE("(%p,%p,%p,%ld).\n", 182 argc,argv,environ,flag 183 ); 184 185 if (CRTDLL_acmdln_dll != NULL) 186 HeapFree(GetProcessHeap(), 0, CRTDLL_acmdln_dll); 187 188 CRTDLL_acmdln_dll = cmdline = CRTDLL__strdup( GetCommandLineA() ); 189 TRACE("got '%s'\n", cmdline); 190 191 version = GetVersion(); 192 CRTDLL_osver_dll = version >> 16; 193 CRTDLL_winminor_dll = version & 0xFF; 194 CRTDLL_winmajor_dll = (version>>8) & 0xFF; 195 CRTDLL_baseversion_dll = version >> 16; 196 CRTDLL_winver_dll = ((version >> 8) & 0xFF) + ((version & 0xFF) << 8); 197 CRTDLL_baseminor_dll = (version >> 16) & 0xFF; 198 CRTDLL_basemajor_dll = (version >> 24) & 0xFF; 199 CRTDLL_osversion_dll = version & 0xFFFF; 200 CRTDLL_osminor_dll = version & 0xFF; 201 CRTDLL_osmajor_dll = (version>>8) & 0xFF; 202 203 /* missing threading init */ 204 205 end=0;last_arg=0;xargv=NULL;xargc=0;afterlastspace=0; 206 while (1) 207 { 208 if ((cmdline[end]==' ') || (cmdline[end]=='\0')) 209 { 210 if (cmdline[end]=='\0') 211 last_arg=1; 212 else 213 cmdline[end]='\0'; 214 /* alloc xargc + NULL entry */ 215 xargv=(char**)HeapReAlloc( GetProcessHeap(), 0, xargv, 216 sizeof(char*)*(xargc+1)); 217 if (strlen(cmdline+afterlastspace)) 218 { 219 xargv[xargc] = CRTDLL__strdup(cmdline+afterlastspace); 220 xargc++; 222 221 if (!last_arg) /* need to seek to the next arg ? */ 223 {224 end++;225 while (cmdline[end]==' ')226 end++;227 }228 afterlastspace=end;229 }230 else231 {232 xargv[xargc] = NULL; /* the last entry is NULL */233 break;234 }235 }236 else237 end++;238 }239 CRTDLL_argc_dll= xargc;240 *argc= xargc;241 CRTDLL_argv_dll= xargv;242 *argv= xargv;243 244 TRACE("found %d arguments\n",245 CRTDLL_argc_dll);246 CRTDLL_environ_dll = *environ = GetEnvironmentStringsA();247 return environ;222 { 223 end++; 224 while (cmdline[end]==' ') 225 end++; 226 } 227 afterlastspace=end; 228 } 229 else 230 { 231 xargv[xargc] = NULL; /* the last entry is NULL */ 232 break; 233 } 234 } 235 else 236 end++; 237 } 238 CRTDLL_argc_dll = xargc; 239 *argc = xargc; 240 CRTDLL_argv_dll = xargv; 241 *argv = xargv; 242 243 TRACE("found %d arguments\n", 244 CRTDLL_argc_dll); 245 CRTDLL_environ_dll = *environ = GetEnvironmentStringsA(); 246 return environ; 248 247 } 249 248 … … 254 253 DWORD CDECL CRTDLL__initterm(_INITTERMFUN *start,_INITTERMFUN *end) 255 254 { 256 _INITTERMFUN*current;257 258 TRACE("(%p,%p)\n",start,end);259 current=start;260 while (current<end) {261 if (*current) (*current)();262 current++;263 }264 return 0;255 _INITTERMFUN *current; 256 257 TRACE("(%p,%p)\n",start,end); 258 current=start; 259 while (current<end) { 260 if (*current) (*current)(); 261 current++; 262 } 263 return 0; 265 264 } 266 265 … … 310 309 INT CDECL CRTDLL_rand() 311 310 { 312 return (rand() & CRTDLL_RAND_MAX); 311 return (rand() & CRTDLL_RAND_MAX); 313 312 } 314 313 … … 320 319 { 321 320 // return (_rotl(value, shift)); 322 321 323 322 shift &= 31; 324 323 return (x << shift) | (x >> (32-shift)); … … 332 331 { 333 332 // return (_lrotl(value, shift)); 334 333 335 334 shift &= 31; 336 335 return (x << shift) | (x >> (32-shift)); … … 344 343 { 345 344 // return (_lrotr(value, shift)); 346 345 347 346 shift &= 0x1f; 348 347 return (x >> shift) | (x << (32-shift)); … … 356 355 { 357 356 // return (_rotr(value, shift)); 358 357 359 358 shift &= 0x1f; 360 359 return (x >> shift) | (x << (32-shift)); … … 368 367 { 369 368 // return (vswprintf(s, t, format, arg)); 370 369 371 370 return wvsprintfW( buffer, spec, args ); 372 371 } … … 389 388 { 390 389 return (setlocale(category, locale)); 391 390 392 391 /* 393 392 LPSTR categorystr; … … 438 437 { 439 438 // return (_fullpath(buf, path, size)); 440 439 441 440 if (!buf) 442 441 { … … 456 455 { 457 456 // _splitpath( path, drive, dir, fname, ext); 458 457 459 458 /* drive includes : 460 459 directory includes leading and trailing (forward and backward slashes) … … 520 519 { 521 520 // _makepath(path, drive, dir, fname, ext); 522 521 523 522 char ch; 524 523 TRACE("CRTDLL__makepath got %s %s %s %s\n", drive, directory, … … 568 567 { 569 568 // return (_errno()); 570 569 571 570 return &CRTDLL_errno; 572 571 } … … 575 574 /********************************************************************* 576 575 * __doserrno (CRTDLL.26) 577 * 576 * 578 577 * Return the address of the DOS errno (holding the last OS error). 579 578 * @@@PH Note: veeeery strange ... … … 584 583 { 585 584 // return (__doserrno()); 586 585 587 586 return &CRTDLL_doserrno; 588 587 } … … 602 601 { 603 602 // return (_strerror((char*)s)); 604 603 605 604 static char strerrbuff[256]; 606 605 sprintf(strerrbuff,"%s: %s\n",err,CRTDLL_strerror(CRTDLL_errno)); … … 617 616 { 618 617 // perror( s ); 619 618 620 619 char *err_str = CRTDLL_strerror(CRTDLL_errno); 621 620 CRTDLL_fprintf(CRTDLL_stderr,"%s: %s\n",err,err_str); 622 621 CRTDLL_free(err_str); 623 622 } 624 623 625 624 626 625 /********************************************************************* … … 632 631 * The caller does not own the string returned. 633 632 */ 634 extern char *strerror(int errnum); 633 extern char *strerror(int errnum); 635 634 636 635 LPSTR CDECL CRTDLL_strerror (INT err) … … 646 645 { 647 646 //return (signal(sig, ptr)); 648 647 649 648 FIXME("(%d %p):stub.\n", sig, ptr); 650 649 return (void*)-1; … … 668 667 { 669 668 // return (getenv(name)); 670 669 671 670 LPSTR environ = GetEnvironmentStringsA(); 672 671 LPSTR pp,pos = NULL; … … 675 674 for (pp = environ; (*pp); pp = pp + strlen(pp) +1) 676 675 { 677 pos =strchr(pp,'=');678 if (pos)679 length = pos -pp;680 else681 length = strlen(pp);682 if (!strncmp(pp,name,length)) break;676 pos =strchr(pp,'='); 677 if (pos) 678 length = pos -pp; 679 else 680 length = strlen(pp); 681 if (!strncmp(pp,name,length)) break; 683 682 } 684 if ((pp)&& (pos)) 683 if ((pp)&& (pos)) 685 684 { 686 pp = pos+1;687 TRACE("got %s\n",pp);685 pp = pos+1; 686 TRACE("got %s\n",pp); 688 687 } 689 688 FreeEnvironmentStringsA( environ ); … … 696 695 */ 697 696 INT CDECL CRTDLL__except_handler2 ( 698 PEXCEPTION_RECORD rec,699 PEXCEPTION_FRAME frame,700 PCONTEXT context,701 PEXCEPTION_FRAME *dispatcher)702 { 703 FIXME ("exception %lx flags=%lx at %p handler=%p %p %p stub\n",704 rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress,705 frame->Handler, context, dispatcher);706 return ExceptionContinueSearch;697 PEXCEPTION_RECORD rec, 698 PEXCEPTION_FRAME frame, 699 PCONTEXT context, 700 PEXCEPTION_FRAME *dispatcher) 701 { 702 FIXME ("exception %lx flags=%lx at %p handler=%p %p %p stub\n", 703 rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress, 704 frame->Handler, context, dispatcher); 705 return ExceptionContinueSearch; 707 706 } 708 707 … … 725 724 { 726 725 // return (_toascii(c)); 727 726 728 727 return c & 0x7f; 729 728 } … … 755 754 { 756 755 // return (_iscsym(c)); 757 756 758 757 return (isalnum(c) || c == '_'); 759 758 } … … 774 773 { 775 774 // return (_iscsymf(c)); 776 775 777 776 return (isalpha(c) || c == '_'); 778 777 } … … 847 846 { 848 847 if (cf((LPVOID*)match, (LPVOID*)pStart) == 0) 849 return pStart; /* found */848 return pStart; /* found */ 850 849 pStart += elem_size; 851 850 } while (--size); … … 915 914 { 916 915 // return (_toupper(n)); 917 916 918 917 return toupper(c); 919 918 } … … 926 925 { 927 926 // return (_tolower(n)); 928 927 929 928 return tolower(c); 930 929 } … … 947 946 { 948 947 // return (_cabs(c)); 949 948 950 949 return sqrt(c.real * c.real + c.imaginary * c.imaginary); 951 950 } … … 1007 1006 * 1008 1007 * Reset the state of the floating point processor. 1009 * 1008 * 1010 1009 * PARAMS 1011 1010 * None. -
trunk/src/crtdll/dir.c
r6645 r6712 1 /* $Id: dir.c,v 1.5 2001-09-05 12:14:24 bird Exp $ */2 1 /* 3 2 * CRTDLL drive/directory functions 4 * 3 * 5 4 * Copyright 1996,1998 Marcus Meissner 6 5 * Copyright 1996 Jukka Iivonen … … 58 57 * RETURNS 59 58 * Sucess: 0 60 * 59 * 61 60 * Failure: -1 62 61 */ … … 65 64 dprintf(("CRTDLL: _chdir(%s)\n", 66 65 newdir)); 67 66 68 67 if (!SetCurrentDirectoryA(newdir)) 69 68 { … … 85 84 * RETURNS 86 85 * Sucess: 0 87 * 88 * Failure: 1 86 * 87 * Failure: 1 89 88 */ 90 89 BOOL CDECL CRTDLL__chdrive(INT newdrive) … … 92 91 char buffer[3] = "A:"; 93 92 buffer[0] += newdrive - 1; 94 93 95 94 dprintf(("CRTDLL: _chdrive(%s)\n", 96 95 buffer)); 97 96 98 97 if (!SetCurrentDirectoryA( buffer )) 99 98 { … … 109 108 /********************************************************************* 110 109 * _findclose (CRTDLL.098) 111 * 110 * 112 111 * Free the resources from a search handle created from _findfirst. 113 112 * … … 124 123 dprintf(("CRTDLL: _findclose(%08xh)\n", 125 124 hand)); 126 125 127 126 if (!FindClose((HANDLE)hand)) 128 127 { … … 142 141 * PARAMS 143 142 * fspec [in] File specification string for search, e.g "C:\*.BAT" 144 * 143 * 145 144 * ft [out] A pointer to a find_t structure to populate. 146 145 * … … 156 155 WIN32_FIND_DATAA find_data; 157 156 HANDLE hfind; 158 157 159 158 dprintf(("CRTDLL: _findfirst(%s)\n", 160 159 fspec)); … … 174 173 /********************************************************************* 175 174 * _findnext (CRTDLL.100) 176 * 175 * 177 176 * Return the next matching file/directory from a search hadle. 178 177 * 179 178 * PARAMS 180 179 * hand [in] Search handle from a pervious call to _findfirst 181 * 180 * 182 181 * ft [out] A pointer to a find_t structure to populate. 183 182 * … … 191 190 { 192 191 WIN32_FIND_DATAA find_data; 193 192 194 193 dprintf(("CRTDLL: _findnext(%08xh)\n", 195 194 hand)); 196 195 197 196 if (!FindNextFileA(hand, &find_data)) 198 197 { … … 225 224 { 226 225 // return (_getcwd(buf, size)); 227 226 228 227 char dir[_MAX_PATH]; 229 228 int dir_len = GetCurrentDirectoryA(_MAX_PATH,dir); 230 229 231 230 dprintf(("CRTDLL: _getcwd()\n")); 232 231 233 232 if (dir_len < 1) 234 233 return NULL; /* FIXME: Real return value untested */ … … 259 258 { 260 259 // return (_getdcwd(drive, buffer, maxlen)); 261 260 262 261 static CHAR* dummy; 263 262 264 263 dprintf(("CRTDLL: _getdcwd()\n")); 265 264 266 265 if (!drive || drive == CRTDLL__getdrive()) 267 266 return CRTDLL__getcwd(buf,size); /* current */ … … 306 305 DWORD ret[4]; 307 306 UINT err; 308 307 309 308 dprintf(("CRTDLL: _getdiskfree(%08xh)\n", disk)); 310 309 311 310 if (disk > 26) 312 311 return ERROR_INVALID_PARAMETER; /* CRTDLL doesn't set errno here */ … … 336 335 { 337 336 // return DRIVE_GetCurrentDrive() + 1; 338 337 339 338 char buffer[MAX_PATH]; 340 339 341 340 dprintf(("CRTDLL: _getdrive()\n")); 342 341 343 if (!GetCurrentDirectoryA( sizeof(buffer), buffer )) 344 return 0; 345 if (buffer[1] != ':') 342 if (!GetCurrentDirectoryA( sizeof(buffer), buffer )) 343 return 0; 344 if (buffer[1] != ':') 346 345 return 0; 347 346 return toupper(buffer[0]) - 'A' + 1; … … 358 357 dprintf(("CRTDLL: _mkdir(%s)\n", 359 358 newdir)); 360 359 361 360 if (CreateDirectoryA(newdir,NULL)) 362 361 return 0; … … 369 368 * _rmdir (CRTDLL.255) 370 369 * 371 * Delete a directory 370 * Delete a directory 372 371 * 373 372 */ … … 376 375 dprintf(("CRTDLL: _rmdir(%s)\n", 377 376 dir)); 378 377 379 378 if (RemoveDirectoryA(dir)) 380 379 return 0; -
trunk/src/crtdll/exit.c
r6645 r6712 1 /* $Id: exit.c,v 1.2 2001-09-05 12:14:24 bird Exp $ */2 1 /* 3 2 * CRTDLL exit/abort/atexit functions 4 * 3 * 5 4 * Copyright 1996,1998 Marcus Meissner 6 5 * Copyright 1996 Jukka Iivonen … … 11 10 * and whether they return to the caller (really!). 12 11 * return do 13 * Name to caller? cleanup? 12 * Name to caller? cleanup? 14 13 * _c_exit Y N 15 14 * _cexit Y Y … … 55 54 56 55 /********************************************************************* 57 * __dllonexit(CRTDLL.25)56 * __dllonexit (CRTDLL.25) 58 57 */ 59 58 VOID CDECL CRTDLL___dllonexit () 60 { 59 { 61 60 dprintf(("__dllonexit not implemented.\n")); 62 61 SetLastError(ERROR_CALL_NOT_IMPLEMENTED); … … 65 64 66 65 /********************************************************************* 67 * _abnormal_termination(CRTDLL.36)66 * _abnormal_termination (CRTDLL.36) 68 67 */ 69 68 int CDECL CRTDLL__abnormal_termination(void) … … 84 83 { 85 84 dprintf2(("CRTDLL: _amsg_exit\n")); 86 85 87 86 // fprintf(stderr,strerror(errnum)); 88 87 // ExitProcess(-1); 89 88 90 89 CRTDLL_fprintf(CRTDLL_stderr,"\nrun-time error:\nError Code %d\n",errnum); 91 90 CRTDLL__exit(255); … … 96 95 * _assert (CRTDLL.041) 97 96 * 98 * Print an assertion message and call abort(). Really only present 97 * Print an assertion message and call abort(). Really only present 99 98 * for win binaries. Winelib programs would typically use libc's 100 99 * version. … … 103 102 { 104 103 dprintf2(("CRTDLL: _assert\n")); 105 104 106 105 CRTDLL_fprintf(CRTDLL_stderr,"Assertion failed: %s, file %s, line %d\n\n", 107 106 (char*)str,(char*)file, line); 108 107 CRTDLL_abort(); 109 108 110 109 // _assert(str, file, line); 111 110 } … … 120 119 dprintf2(("_c_exit(%d)\n",ret)); 121 120 FIXME("not calling CRTDLL cleanup\n"); 122 121 123 122 /* dont exit, return to caller */ 124 123 125 124 ExitProcess(ret); 126 125 } … … 136 135 FIXME("not calling CRTDLL cleanup\n"); 137 136 /* dont exit, return to caller */ 138 137 139 138 ExitProcess(ret); 140 139 } … … 146 145 VOID CDECL CRTDLL__exit(LONG ret) 147 146 { 148 dprintf2(("CRTDLL: _exit (%08xh)\n", 147 dprintf2(("CRTDLL: _exit (%08xh)\n", 149 148 ret)); 150 149 TRACE(":exit code %ld\n",ret); … … 200 199 { 201 200 dprintf2(("CRTDLL: abort\n")); 202 201 203 202 CRTDLL_fprintf(CRTDLL_stderr,"\nabnormal program termination\n"); 204 203 CRTDLL__exit(3); … … 208 207 209 208 /********************************************************************* 210 * atexit (CRTDLL.342)209 * atexit (CRTDLL.342) 211 210 * 212 211 * Register a function to be called when the process terminates. … … 215 214 { 216 215 dprintf(("CRTDLL: atexit\n")); 217 216 218 217 return CRTDLL__onexit(func) == func ? 0 : -1; 219 218 220 219 // if (_atexit_n >= sizeof (_atexit_v) / sizeof (_atexit_v[0])) 221 220 // return -1; -
trunk/src/crtdll/file.c
r6645 r6712 1 /* $Id: file.c,v 1.3 2001-09-05 12:14:24 bird Exp $ */2 1 /* 3 2 * CRTDLL file functions 4 * 3 * 5 4 * Copyright 1996,1998 Marcus Meissner 6 5 * Copyright 1996 Jukka Iivonen … … 9 8 * 10 9 * Implementation Notes: 11 * Mapping is performed between FILE*, fd and HANDLE's. This allows us to 12 * implement all calls using the Win32 API, support remapping fd's to 10 * Mapping is performed between FILE*, fd and HANDLE's. This allows us to 11 * implement all calls using the Win32 API, support remapping fd's to 13 12 * FILES and do some other tricks as well (like closeall, _get_osfhandle). 14 13 * For mix and matching with the host libc, processes can use the Win32 HANDLE … … 129 128 else 130 129 while(__CRTDLL_fdstart < __CRTDLL_fdend && 131 __CRTDLL_handles[__CRTDLL_fdstart] != INVALID_HANDLE_VALUE)130 __CRTDLL_handles[__CRTDLL_fdstart] != INVALID_HANDLE_VALUE) 132 131 __CRTDLL_fdstart++; 133 132 … … 144 143 { 145 144 TRACE(":fd (%d) allocating FILE*\n",fd); 146 if (fd < 0 || fd >= __CRTDLL_fdend || 145 if (fd < 0 || fd >= __CRTDLL_fdend || 147 146 __CRTDLL_handles[fd] == INVALID_HANDLE_VALUE) 148 147 { … … 179 178 180 179 TRACE(":handles (%d)(%d)(%d)\n",__CRTDLL_handles[0], 181 __CRTDLL_handles[1],__CRTDLL_handles[2]);180 __CRTDLL_handles[1],__CRTDLL_handles[2]); 182 181 183 182 for (i = 0; i < 3; i++) … … 196 195 { 197 196 // return (_access(path, mode)); 198 197 199 198 DWORD attr = GetFileAttributesA(filename); 200 199 … … 203 202 if (!filename) 204 203 { 205 /* FIXME: Should GetFileAttributesA() return this? */204 /* FIXME: Should GetFileAttributesA() return this? */ 206 205 __CRTDLL__set_errno(ERROR_INVALID_DATA); 207 206 return -1; … … 304 303 { 305 304 // return (__eof(_fd)); 306 305 307 306 DWORD curpos,endpos; 308 307 HANDLE hand = __CRTDLL__fdtoh(fd); … … 339 338 { 340 339 // return (_fcloseall()); 341 340 342 341 int num_closed = 0, i = 3; 343 342 … … 362 361 { 363 362 // return (_fdopen(handle, mode)); 364 363 365 364 CRTDLL_FILE* file = __CRTDLL__alloc_fp(fd); 366 365 … … 379 378 { 380 379 // return (_fgetchar()); 381 380 382 381 return CRTDLL_fgetc(CRTDLL_stdin); 383 382 } … … 391 390 * becomes negative. We ensure that _cnt is always 0 after any read 392 391 * so this function is always called. Our implementation simply calls 393 * fgetc as all the underlying buffering is handled by Wines 392 * fgetc as all the underlying buffering is handled by Wines 394 393 * implementation of the Win32 file I/O calls. 395 394 */ … … 411 410 { 412 411 // return (_fileno(f)); 413 412 414 413 TRACE(":FILE* (%p) fd (%d)\n",file,file->_file); 415 414 return file->_file; … … 441 440 { 442 441 // return (_flushall()); 443 442 444 443 int num_flushed = 0, i = 3; 445 444 … … 448 447 { 449 448 if (CRTDLL__commit(i) == -1) 450 if (__CRTDLL_files[i])451 __CRTDLL_files[i]->_flag |= _IOERR;449 if (__CRTDLL_files[i]) 450 __CRTDLL_files[i]->_flag |= _IOERR; 452 451 num_flushed++; 453 452 } … … 466 465 { 467 466 // return(_fputchar(c)); 468 467 469 468 return CRTDLL_fputc(c, CRTDLL_stdout); 470 469 } … … 485 484 /********************************************************************* 486 485 * _fstat (CRTDLL.111) 487 * 486 * 488 487 * Get information about an open file. 489 488 */ … … 491 490 { 492 491 // return (_fstat(file, buf)); 493 492 494 493 DWORD dw; 495 494 BY_HANDLE_FILE_INFORMATION hfi; … … 549 548 { 550 549 /* FIXME: I'm not convinced that I should be copying the 551 * handle here - it may be leaked if the app doesn't 550 * handle here - it may be leaked if the app doesn't 552 551 * close it (and the API docs dont say that it should) 553 552 * Not duplicating it means that it can't be inherited … … 558 557 */ 559 558 DuplicateHandle(GetCurrentProcess(),hand,GetCurrentProcess(), 560 &newhand,0,TRUE,DUPLICATE_SAME_ACCESS );559 &newhand,0,TRUE,DUPLICATE_SAME_ACCESS ); 561 560 } 562 561 return newhand; … … 589 588 { 590 589 // return (_lseek(handle, offset, origin)); 591 590 592 591 LONG ret; 593 592 HANDLE hand = __CRTDLL__fdtoh(fd); … … 778 777 { 779 778 // return (_setmode(fh, mode)); 780 779 781 780 if (mode & _O_TEXT) 782 781 FIXME("fd (%d) mode (%d) TEXT not implemented\n",fd,mode); … … 791 790 { 792 791 // return(_stat(s1, n)); 793 792 794 793 DWORD dw; 795 794 WIN32_FILE_ATTRIBUTE_DATA hfi; … … 827 826 { 828 827 unsigned int ext = tolower(path[plen-1]) | (tolower(path[plen-2]) << 8) 829 | (tolower(path[plen-3]) << 16);828 | (tolower(path[plen-3]) << 16); 830 829 if (ext == EXE || ext == BAT || ext == CMD || ext == COM) 831 mode |= CRTDLL_S_IEXEC;830 mode |= CRTDLL_S_IEXEC; 832 831 } 833 832 } … … 844 843 buf->st_mtime = buf->st_ctime = dw; 845 844 TRACE("\n%d %d %d %d %d %d\n", buf->st_mode,buf->st_nlink,buf->st_size, 846 buf->st_atime,buf->st_mtime, buf->st_ctime);845 buf->st_atime,buf->st_mtime, buf->st_ctime); 847 846 return 0; 848 847 } … … 857 856 { 858 857 // return (_tell(i)); 859 858 860 859 return CRTDLL__lseek(fd, 0, SEEK_CUR); 861 860 } … … 864 863 /********************************************************************* 865 864 * _tempnam (CRTDLL.305) 866 * 865 * 867 866 */ 868 867 LPSTR CDECL CRTDLL__tempnam(LPCSTR dir, LPCSTR prefix) 869 868 { 870 869 // return (_tempnam(dir, prefix)); 871 870 872 871 char tmpbuf[MAX_PATH]; 873 872 … … 891 890 { 892 891 // return (_umask(i)); 893 892 894 893 INT old_umask = __CRTDLL_umask; 895 894 TRACE("umask (%d)\n",umask); … … 977 976 { 978 977 // return (fclose(fp)); 979 978 980 979 return CRTDLL__close(file->_file); 981 980 } … … 990 989 { 991 990 // return (feof(fp)); 992 991 993 992 return file->_flag & _IOEOF; 994 993 } … … 1003 1002 { 1004 1003 // return (ferror(fp)); 1005 1004 1006 1005 return file->_flag & _IOERR; 1007 1006 } … … 1025 1024 { 1026 1025 // return (fgetc(fp)); 1027 1026 1028 1027 char c; 1029 1028 if (CRTDLL__read(file->_file,&c,1) != 1) … … 1051 1050 { 1052 1051 // return (fgets(s, n, fp)); 1053 1052 1054 1053 int cc; 1055 1054 LPSTR buf_start = s; 1056 1055 1057 1056 TRACE(":file(%p) fd (%d) str (%p) len (%d)\n", 1058 file,file->_file,s,size);1057 file,file->_file,s,size); 1059 1058 1060 1059 /* BAD, for the whole WINE process blocks... just done this way to test … … 1089 1088 { 1090 1089 // return (fputs(s, fp)); 1091 1090 1092 1091 return CRTDLL_fwrite(s,strlen(s),1,file); 1093 1092 } … … 1100 1099 { 1101 1100 // return (fprintf(file, format, arg)); 1102 1101 1103 1102 va_list valist; 1104 1103 INT res; … … 1119 1118 { 1120 1119 // return (fopen( filename, mode)); 1121 1120 1122 1121 CRTDLL_FILE* file; 1123 1122 INT flags = 0, plus = 0, fd; … … 1183 1182 { 1184 1183 // return (fputc(c, fp)); 1185 1184 1186 1185 return CRTDLL__write(file->_file, &c, 1) == 1? c : EOF; 1187 1186 } … … 1194 1193 { 1195 1194 // return (fread(ptr, size, n, fp)); 1196 1195 1197 1196 DWORD read = CRTDLL__read(file->_file,ptr, size * nmemb); 1198 1197 if (read <= 0) … … 1204 1203 /********************************************************************* 1205 1204 * freopen (CRTDLL.379) 1206 * 1205 * 1207 1206 */ 1208 1207 CRTDLL_FILE* CDECL CRTDLL_freopen(LPCSTR path, LPCSTR mode,CRTDLL_FILE* file) 1209 1208 { 1210 1209 // return (freopen(filename, mode, fp)); 1211 1210 1212 1211 CRTDLL_FILE* newfile; 1213 1212 INT fd; … … 1257 1256 { 1258 1257 // return (fsetpos(fp, pos)); 1259 1258 1260 1259 return CRTDLL__lseek(file->_file,*pos,SEEK_SET); 1261 1260 } … … 1393 1392 { 1394 1393 // return (fseek(file, offset, whence)); 1395 1394 1396 1395 return CRTDLL__lseek(file->_file,offset,whence); 1397 1396 } … … 1404 1403 { 1405 1404 // return (ftell(fp)); 1406 1405 1407 1406 return CRTDLL__tell(file->_file); 1408 1407 } … … 1429 1428 { 1430 1429 // return (getchar()); 1431 1430 1432 1431 return CRTDLL_fgetc(CRTDLL_stdin); 1433 1432 } … … 1460 1459 */ 1461 1460 for(cc = CRTDLL_fgetc(CRTDLL_stdin); cc != EOF && cc != '\n'; 1462 cc = CRTDLL_fgetc(CRTDLL_stdin))1463 if(cc != '\r') *buf++ = (char)cc;1461 cc = CRTDLL_fgetc(CRTDLL_stdin)) 1462 if(cc != '\r') *buf++ = (char)cc; 1464 1463 1465 1464 *buf = '\0'; … … 1498 1497 { 1499 1498 // return puts( s ); 1500 1499 1501 1500 return CRTDLL_fputs(s, CRTDLL_stdout); 1502 1501 } … … 1512 1511 { 1513 1512 // rewind(fp); 1514 1513 1515 1514 TRACE(":file (%p) fd (%d)\n",file,file->_file); 1516 1515 CRTDLL__lseek(file->_file,0,SEEK_SET); … … 1525 1524 { 1526 1525 // return (remove(file)); 1527 1526 1528 1527 TRACE(":path (%s)\n",path); 1529 1528 if (DeleteFileA(path)) … … 1541 1540 { 1542 1541 // return (rename(old, new2)); 1543 1542 1544 1543 TRACE(":from %s to %s\n",oldpath,newpath); 1545 1544 if (MoveFileExA( oldpath, newpath, MOVEFILE_REPLACE_EXISTING)) … … 1557 1556 { 1558 1557 // setbuf(fp, buf); 1559 1558 1560 1559 TRACE(":file (%p) fd (%d) buf (%p)\n", file, file->_file,buf); 1561 1560 if (buf) … … 1570 1569 * 1571 1570 * lcclnk from lcc-win32 relies on a terminating dot in the name returned 1572 * 1571 * 1573 1572 */ 1574 1573 LPSTR CDECL CRTDLL_tmpnam(LPSTR s) 1575 1574 { 1576 1575 // return (tmpnam(s)); 1577 1576 1578 1577 char tmpbuf[MAX_PATH]; 1579 1578 char* prefix = "TMP"; … … 1600 1599 { 1601 1600 // return (vfprintf(file, format, args)); 1602 1601 1603 1602 /* FIXME: We should parse the format string, calculate the maximum, 1604 1603 * length of each arg, malloc a buffer, print to it, and fwrite that. -
trunk/src/crtdll/initterm.cpp
r6645 r6712 1 /* $Id: initterm.cpp,v 1.7 2001-09-05 12:14:25 bird Exp $ */2 1 /* 3 2 * DLL entry point … … 56 55 case DLL_THREAD_ATTACH: 57 56 case DLL_THREAD_DETACH: 58 return CRTDLL_Init(hinstDLL, fdwReason, fImpLoad);57 return CRTDLL_Init(hinstDLL, fdwReason, fImpLoad); 59 58 60 59 case DLL_PROCESS_DETACH: 61 CRTDLL_Init(hinstDLL, fdwReason, fImpLoad);62 ctordtorTerm();63 return TRUE;60 CRTDLL_Init(hinstDLL, fdwReason, fImpLoad); 61 ctordtorTerm(); 62 return TRUE; 64 63 } 65 64 return FALSE; … … 91 90 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/ 92 91 93 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab);94 if(dllHandle == 0) 95 return 0UL;92 // dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab); 93 // if(dllHandle == 0) 94 // return 0UL; 96 95 97 96 break; 98 97 case 1 : 99 if(dllHandle) {100 UnregisterLxDll(dllHandle);101 }98 // if(dllHandle) { 99 // UnregisterLxDll(dllHandle); 100 // } 102 101 break; 103 102 -
trunk/src/crtdll/memory.c
r6645 r6712 1 /* $Id: memory.c,v 1.3 2001-09-05 12:14:25 bird Exp $ */2 1 /* 3 2 * CRTDLL memory functions 4 * 3 * 5 4 * Copyright 1996,1998 Marcus Meissner 6 5 * Copyright 1996 Jukka Iivonen … … 33 32 VOID* result; 34 33 if(!(result = HeapAlloc(GetProcessHeap(),0,size)) && new_handler) 35 (*new_handler)();34 (*new_handler)(); 36 35 return result; 37 36 } … … 80 79 { 81 80 // return (_heapchk()); 82 81 83 82 if (!HeapValidate( GetProcessHeap(), 0, NULL)) 84 83 { … … 98 97 { 99 98 // return (_heapmin()); 100 99 101 100 if (!HeapCompact( GetProcessHeap(), 0 )) 102 101 { … … 117 116 { 118 117 // return (_heapset(fill)); 119 118 120 119 INT retVal; 121 120 struct _heapinfo heap; … … 145 144 phe.wFlags = next->_useflag == _USEDENTRY ? PROCESS_HEAP_ENTRY_BUSY : 0; 146 145 147 if (phe.lpData && phe.wFlags & PROCESS_HEAP_ENTRY_BUSY && 146 if (phe.lpData && phe.wFlags & PROCESS_HEAP_ENTRY_BUSY && 148 147 !HeapValidate( GetProcessHeap(), 0, phe.lpData )) 149 148 { … … 181 180 { 182 181 // return (_msize(ptr)); 183 182 184 183 LONG size = HeapSize(GetProcessHeap(),0,mem); 185 184 if (size == -1) … … 216 215 /********************************************************************* 217 216 * malloc (CRTDLL.424) 218 * 217 * 219 218 * Alocate memory from the heap. 220 219 */ -
trunk/src/crtdll/spawn.c
r6645 r6712 1 /* $Id: spawn.c,v 1.3 2001-09-05 12:14:25 bird Exp $ */2 1 /* 3 2 * CRTDLL spawn functions 4 * 3 * 5 4 * Copyright 1996,1998 Marcus Meissner 6 5 * Copyright 1996 Jukka Iivonen … … 25 24 * Implementation Notes: 26 25 * MT Safe - But only because of missing functionality. 27 * 26 * 28 27 * After translating input arguments into the required format for 29 28 * CreateProcess(), the internal function __CRTDLL__spawn() is … … 83 82 84 83 if (!CreateProcessA(exe, args, NULL, NULL, TRUE, 85 flags == _P_DETACH ? DETACHED_PROCESS : 0,86 env, NULL, &si, &pi))84 flags == _P_DETACH ? DETACHED_PROCESS : 0, 85 env, NULL, &si, &pi)) 87 86 { 88 87 __CRTDLL__set_errno(GetLastError()); … … 158 157 { 159 158 // return (_spawnve(i, s1, s2, s3)); 160 159 161 160 LPSTR args = __CRTDLL__argvtos(argv,' '); 162 161 LPSTR envs = __CRTDLL__argvtos(envv,0); … … 187 186 { 188 187 // return system(string); 189 188 190 189 /* FIXME: should probably launch cmd interpreter in COMSPEC */ 191 190 return __CRTDLL__spawn(_P_WAIT, NULL, x, NULL); -
trunk/src/msacm32/driver.c
r6648 r6712 1 1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */ 2 /* $Id: driver.c,v 1.2 2001-09-05 13:11:25 bird Exp $ */ 2 3 3 /* 4 4 * MSACM32 library 5 5 * 6 6 * Copyright 1998 Patrik Stridvall 7 * 1999Eric Pouech7 * 1999 Eric Pouech 8 8 */ 9 9 … … 29 29 30 30 DEFAULT_DEBUG_CHANNEL(msacm); 31 31 32 32 /*********************************************************************** 33 33 * acmDriverAddA (MSACM32.2) 34 34 */ 35 35 MMRESULT WINAPI acmDriverAddA(PHACMDRIVERID phadid, HINSTANCE hinstModule, 36 LPARAM lParam, DWORD dwPriority, DWORD fdwAdd)36 LPARAM lParam, DWORD dwPriority, DWORD fdwAdd) 37 37 { 38 38 if (!phadid) 39 return MMSYSERR_INVALPARAM;40 39 return MMSYSERR_INVALPARAM; 40 41 41 /* Check if any unknown flags */ 42 if (fdwAdd & 43 ~(ACM_DRIVERADDF_FUNCTION|ACM_DRIVERADDF_NOTIFYHWND|44 ACM_DRIVERADDF_GLOBAL))45 return MMSYSERR_INVALFLAG;46 42 if (fdwAdd & 43 ~(ACM_DRIVERADDF_FUNCTION|ACM_DRIVERADDF_NOTIFYHWND| 44 ACM_DRIVERADDF_GLOBAL)) 45 return MMSYSERR_INVALFLAG; 46 47 47 /* Check if any incompatible flags */ 48 if ((fdwAdd & ACM_DRIVERADDF_FUNCTION) && 49 (fdwAdd & ACM_DRIVERADDF_NOTIFYHWND))50 return MMSYSERR_INVALFLAG;51 52 /* FIXME: in fact, should GetModuleFileName(hinstModule) and do a 48 if ((fdwAdd & ACM_DRIVERADDF_FUNCTION) && 49 (fdwAdd & ACM_DRIVERADDF_NOTIFYHWND)) 50 return MMSYSERR_INVALFLAG; 51 52 /* FIXME: in fact, should GetModuleFileName(hinstModule) and do a 53 53 * LoadDriver on it, to be sure we can call SendDriverMessage on the 54 54 * hDrvr handle. 55 55 */ 56 56 *phadid = (HACMDRIVERID) MSACM_RegisterDriver(NULL, NULL, hinstModule); 57 57 58 58 /* FIXME: lParam, dwPriority and fdwAdd ignored */ 59 59 60 60 return MMSYSERR_NOERROR; 61 61 } … … 67 67 */ 68 68 MMRESULT WINAPI acmDriverAddW(PHACMDRIVERID phadid, HINSTANCE hinstModule, 69 LPARAM lParam, DWORD dwPriority, DWORD fdwAdd)69 LPARAM lParam, DWORD dwPriority, DWORD fdwAdd) 70 70 { 71 71 FIXME("(%p, 0x%08x, %ld, %ld, %ld): stub\n", 72 phadid, hinstModule, lParam, dwPriority, fdwAdd);73 72 phadid, hinstModule, lParam, dwPriority, fdwAdd); 73 74 74 SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 75 75 return MMSYSERR_ERROR; … … 81 81 MMRESULT WINAPI acmDriverClose(HACMDRIVER had, DWORD fdwClose) 82 82 { 83 PWINE_ACMDRIVER pad;84 PWINE_ACMDRIVERID padid;85 PWINE_ACMDRIVER* tpad;83 PWINE_ACMDRIVER pad; 84 PWINE_ACMDRIVERID padid; 85 PWINE_ACMDRIVER* tpad; 86 86 87 87 if (fdwClose) 88 return MMSYSERR_INVALFLAG;89 88 return MMSYSERR_INVALFLAG; 89 90 90 pad = MSACM_GetDriver(had); 91 91 if (!pad) 92 return MMSYSERR_INVALHANDLE;92 return MMSYSERR_INVALHANDLE; 93 93 94 94 padid = pad->obj.pACMDriverID; … … 96 96 /* remove driver from list */ 97 97 for (tpad = &(padid->pACMDriverList); *tpad; *tpad = (*tpad)->pNextACMDriver) { 98 if (*tpad == pad) {99 *tpad = (*tpad)->pNextACMDriver;100 break;101 }102 } 103 98 if (*tpad == pad) { 99 *tpad = (*tpad)->pNextACMDriver; 100 break; 101 } 102 } 103 104 104 /* close driver if it has been opened */ 105 105 if (pad->hDrvr && !padid->hInstModule) 106 CloseDriver(pad->hDrvr, 0, 0);107 106 CloseDriver(pad->hDrvr, 0, 0); 107 108 108 HeapFree(MSACM_hHeap, 0, pad); 109 109 110 110 return MMSYSERR_NOERROR; 111 111 } … … 117 117 { 118 118 MMRESULT mmr; 119 ACMDRIVERDETAILSW addw;120 119 ACMDRIVERDETAILSW addw; 120 121 121 addw.cbStruct = sizeof(addw); 122 122 mmr = acmDriverDetailsW(hadid, &addw, fdwDetails); 123 123 if (mmr == 0) { 124 padd->fccType = addw.fccType; 125 padd->fccComp = addw.fccComp; 126 padd->wMid = addw.wMid; 127 padd->wPid = addw.wPid; 128 padd->vdwACM = addw.vdwACM; 129 padd->vdwDriver = addw.vdwDriver; 130 padd->fdwSupport = addw.fdwSupport; 131 padd->cFormatTags = addw.cFormatTags; 132 padd->cFilterTags = addw.cFilterTags; 133 padd->hicon = addw.hicon; 124 padd->fccType = addw.fccType; 125 padd->fccComp = addw.fccComp; 126 padd->wMid = addw.wMid; 127 padd->wPid = addw.wPid; 128 padd->vdwACM = addw.vdwACM; 129 padd->vdwDriver = addw.vdwDriver; 130 padd->fdwSupport = addw.fdwSupport; 131 padd->cFormatTags = addw.cFormatTags; 132 padd->cFilterTags = addw.cFilterTags; 133 padd->hicon = addw.hicon; 134 134 WideCharToMultiByte( CP_ACP, 0, addw.szShortName, -1, padd->szShortName, 135 135 sizeof(padd->szShortName), NULL, NULL ); … … 153 153 HACMDRIVER acmDrvr; 154 154 MMRESULT mmr; 155 155 156 156 if (fdwDetails) 157 return MMSYSERR_INVALFLAG;158 157 return MMSYSERR_INVALFLAG; 158 159 159 mmr = acmDriverOpen(&acmDrvr, hadid, 0); 160 160 if (mmr == MMSYSERR_NOERROR) { 161 mmr = (MMRESULT)MSACM_Message(acmDrvr, ACMDM_DRIVER_DETAILS, (LPARAM)padd, 0);162 163 acmDriverClose(acmDrvr, 0);164 } 165 161 mmr = (MMRESULT)MSACM_Message(acmDrvr, ACMDM_DRIVER_DETAILS, (LPARAM)padd, 0); 162 163 acmDriverClose(acmDrvr, 0); 164 } 165 166 166 return mmr; 167 167 } … … 172 172 MMRESULT WINAPI acmDriverEnum(ACMDRIVERENUMCB fnCallback, DWORD dwInstance, DWORD fdwEnum) 173 173 { 174 PWINE_ACMDRIVERID p;175 ACMDRIVERDETAILSW add;174 PWINE_ACMDRIVERID p; 175 ACMDRIVERDETAILSW add; 176 176 177 177 if (!fnCallback) return MMSYSERR_INVALPARAM; 178 178 179 179 if (fdwEnum && ~(ACM_DRIVERENUMF_NOLOCAL|ACM_DRIVERENUMF_DISABLED)) 180 return MMSYSERR_INVALFLAG;181 180 return MMSYSERR_INVALFLAG; 181 182 182 add.cbStruct = sizeof(add); 183 183 for (p = MSACM_pFirstACMDriverID; p; p = p->pNextACMDriverID) { 184 if (acmDriverDetailsW((HACMDRIVERID)p, &add, 0) != MMSYSERR_NOERROR)185 continue;186 if (!p->bEnabled) {187 if (fdwEnum & ACM_DRIVERENUMF_DISABLED)188 add.fdwSupport |= ACMDRIVERDETAILS_SUPPORTF_DISABLED;189 else190 continue;191 }192 if (!(*fnCallback)((HACMDRIVERID)p, dwInstance, add.fdwSupport))193 break;194 } 195 184 if (acmDriverDetailsW((HACMDRIVERID)p, &add, 0) != MMSYSERR_NOERROR) 185 continue; 186 if (!p->bEnabled) { 187 if (fdwEnum & ACM_DRIVERENUMF_DISABLED) 188 add.fdwSupport |= ACMDRIVERDETAILS_SUPPORTF_DISABLED; 189 else 190 continue; 191 } 192 if (!(*fnCallback)((HACMDRIVERID)p, dwInstance, add.fdwSupport)) 193 break; 194 } 195 196 196 return MMSYSERR_NOERROR; 197 197 } … … 203 203 { 204 204 PWINE_ACMOBJ pao; 205 205 206 206 if (!phadid) 207 return MMSYSERR_INVALPARAM;208 207 return MMSYSERR_INVALPARAM; 208 209 209 if (fdwDriverID) 210 return MMSYSERR_INVALFLAG;211 210 return MMSYSERR_INVALFLAG; 211 212 212 pao = MSACM_GetObj(hao, WINE_ACMOBJ_DONTCARE); 213 213 if (!pao) 214 return MMSYSERR_INVALHANDLE;215 214 return MMSYSERR_INVALHANDLE; 215 216 216 *phadid = (HACMDRIVERID) pao->pACMDriverID; 217 217 218 218 return MMSYSERR_NOERROR; 219 219 } … … 226 226 { 227 227 if ((uMsg >= ACMDM_USER && uMsg < ACMDM_RESERVED_LOW) || 228 uMsg == ACMDM_DRIVER_ABOUT ||229 uMsg == DRV_QUERYCONFIGURE ||230 uMsg == DRV_CONFIGURE)231 return MSACM_Message(had, uMsg, lParam1, lParam2);228 uMsg == ACMDM_DRIVER_ABOUT || 229 uMsg == DRV_QUERYCONFIGURE || 230 uMsg == DRV_CONFIGURE) 231 return MSACM_Message(had, uMsg, lParam1, lParam2); 232 232 return MMSYSERR_INVALPARAM; 233 233 } … … 239 239 MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpen) 240 240 { 241 PWINE_ACMDRIVERID padid;242 PWINE_ACMDRIVER pad;241 PWINE_ACMDRIVERID padid; 242 PWINE_ACMDRIVER pad; 243 243 244 244 TRACE("(%p, %x, %08lu)\n", phad, hadid, fdwOpen); 245 245 246 246 if (!phad) 247 return MMSYSERR_INVALPARAM;248 247 return MMSYSERR_INVALPARAM; 248 249 249 if (fdwOpen) 250 return MMSYSERR_INVALFLAG;251 252 padid = MSACM_GetDriverID(hadid); 250 return MMSYSERR_INVALFLAG; 251 252 padid = MSACM_GetDriverID(hadid); 253 253 if (!padid) 254 return MMSYSERR_INVALHANDLE;255 254 return MMSYSERR_INVALHANDLE; 255 256 256 pad = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVER)); 257 257 if (!pad) return MMSYSERR_NOMEM; … … 259 259 pad->obj.dwType = WINE_ACMOBJ_DRIVER; 260 260 pad->obj.pACMDriverID = padid; 261 261 262 262 if (!(pad->hDrvr = padid->hInstModule) && padid->pszDriverAlias) 263 pad->hDrvr = OpenDriverA(padid->pszDriverAlias, NULL, 0);263 pad->hDrvr = OpenDriverA(padid->pszDriverAlias, NULL, 0); 264 264 if (!pad->hDrvr) { 265 HeapFree(MSACM_hHeap, 0, pad);266 return MMSYSERR_ERROR;265 HeapFree(MSACM_hHeap, 0, pad); 266 return MMSYSERR_ERROR; 267 267 } 268 268 … … 289 289 HKEY hPriorityKey; 290 290 DWORD dwPriorityCounter; 291 291 292 292 padid = MSACM_GetDriverID(hadid); 293 293 if (!padid) 294 return MMSYSERR_INVALHANDLE;295 294 return MMSYSERR_INVALHANDLE; 295 296 296 /* Check for unknown flags */ 297 if (fdwPriority & 298 ~(ACM_DRIVERPRIORITYF_ENABLE|ACM_DRIVERPRIORITYF_DISABLE|299 ACM_DRIVERPRIORITYF_BEGIN|ACM_DRIVERPRIORITYF_END))300 return MMSYSERR_INVALFLAG;301 297 if (fdwPriority & 298 ~(ACM_DRIVERPRIORITYF_ENABLE|ACM_DRIVERPRIORITYF_DISABLE| 299 ACM_DRIVERPRIORITYF_BEGIN|ACM_DRIVERPRIORITYF_END)) 300 return MMSYSERR_INVALFLAG; 301 302 302 /* Check for incompatible flags */ 303 303 if ((fdwPriority & ACM_DRIVERPRIORITYF_ENABLE) && 304 (fdwPriority & ACM_DRIVERPRIORITYF_DISABLE))305 return MMSYSERR_INVALFLAG;306 304 (fdwPriority & ACM_DRIVERPRIORITYF_DISABLE)) 305 return MMSYSERR_INVALFLAG; 306 307 307 /* Check for incompatible flags */ 308 308 if ((fdwPriority & ACM_DRIVERPRIORITYF_BEGIN) && 309 (fdwPriority & ACM_DRIVERPRIORITYF_END))310 return MMSYSERR_INVALFLAG;311 312 lError = RegOpenKeyA(HKEY_CURRENT_USER, 313 "Software\\Microsoft\\Multimedia\\"314 "Audio Compression Manager\\Priority v4.00",315 &hPriorityKey316 );309 (fdwPriority & ACM_DRIVERPRIORITYF_END)) 310 return MMSYSERR_INVALFLAG; 311 312 lError = RegOpenKeyA(HKEY_CURRENT_USER, 313 "Software\\Microsoft\\Multimedia\\" 314 "Audio Compression Manager\\Priority v4.00", 315 &hPriorityKey 316 ); 317 317 /* FIXME: Create key */ 318 318 if (lError != ERROR_SUCCESS) 319 return MMSYSERR_ERROR; 320 321 for (dwPriorityCounter = 1; ; dwPriorityCounter++) { 322 snprintf(szSubKey, 17, "Priorty%ld", dwPriorityCounter); 323 lError = RegQueryValueA(hPriorityKey, szSubKey, szBuffer, &lBufferLength); 324 if (lError != ERROR_SUCCESS) 325 break; 326 327 FIXME("(0x%08x, %ld, %ld): stub (partial)\n", 328 hadid, dwPriority, fdwPriority); 329 break; 330 } 331 332 RegCloseKey(hPriorityKey); 333 319 334 return MMSYSERR_ERROR; 320 321 for (dwPriorityCounter = 1; ; dwPriorityCounter++) {322 snprintf(szSubKey, 17, "Priorty%ld", dwPriorityCounter);323 lError = RegQueryValueA(hPriorityKey, szSubKey, szBuffer, &lBufferLength);324 if (lError != ERROR_SUCCESS)325 break;326 327 FIXME("(0x%08x, %ld, %ld): stub (partial)\n",328 hadid, dwPriority, fdwPriority);329 break;330 }331 332 RegCloseKey(hPriorityKey);333 334 return MMSYSERR_ERROR;335 335 } 336 336 … … 341 341 { 342 342 PWINE_ACMDRIVERID padid; 343 343 344 344 padid = MSACM_GetDriverID(hadid); 345 345 if (!padid) 346 return MMSYSERR_INVALHANDLE;347 346 return MMSYSERR_INVALHANDLE; 347 348 348 if (fdwRemove) 349 return MMSYSERR_INVALFLAG;350 349 return MMSYSERR_INVALFLAG; 350 351 351 MSACM_UnregisterDriver(padid); 352 353 return MMSYSERR_NOERROR; 354 } 355 352 353 return MMSYSERR_NOERROR; 354 } 355 -
trunk/src/msacm32/filter.c
r6648 r6712 1 1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */ 2 /* $Id: filter.c,v 1.2 2001-09-05 13:11:25 bird Exp $ */ 2 3 3 /* 4 4 * MSACM32 library … … 42 42 * acmFilterDetailsA (MSACM32.15) 43 43 */ 44 MMRESULT WINAPI acmFilterDetailsA(HACMDRIVER had, PACMFILTERDETAILSA pafd, 45 DWORD fdwDetails)46 { 47 ACMFILTERDETAILSW afdw;48 MMRESULT mmr;44 MMRESULT WINAPI acmFilterDetailsA(HACMDRIVER had, PACMFILTERDETAILSA pafd, 45 DWORD fdwDetails) 46 { 47 ACMFILTERDETAILSW afdw; 48 MMRESULT mmr; 49 49 50 50 memset(&afdw, 0, sizeof(afdw)); 51 51 afdw.cbStruct = sizeof(afdw); 52 52 afdw.dwFilterIndex = pafd->dwFilterIndex; 53 afdw.dwFilterTag = pafd->dwFilterTag; 53 afdw.dwFilterTag = pafd->dwFilterTag; 54 54 afdw.pwfltr = pafd->pwfltr; 55 55 afdw.cbwfltr = pafd->cbwfltr; … … 57 57 mmr = acmFilterDetailsW(had, &afdw, fdwDetails); 58 58 if (mmr == MMSYSERR_NOERROR) { 59 pafd->dwFilterTag = afdw.dwFilterTag; 60 pafd->fdwSupport = afdw.fdwSupport; 59 pafd->dwFilterTag = afdw.dwFilterTag; 60 pafd->fdwSupport = afdw.fdwSupport; 61 61 WideCharToMultiByte( CP_ACP, 0, afdw.szFilter, -1, pafd->szFilter, 62 62 sizeof(pafd->szFilter), NULL, NULL ); … … 68 68 * acmFilterDetailsW (MSACM32.16) 69 69 */ 70 MMRESULT WINAPI acmFilterDetailsW(HACMDRIVER had, PACMFILTERDETAILSW pafd, 71 DWORD fdwDetails)72 { 73 MMRESULT mmr;74 ACMFILTERTAGDETAILSA aftd;70 MMRESULT WINAPI acmFilterDetailsW(HACMDRIVER had, PACMFILTERDETAILSW pafd, 71 DWORD fdwDetails) 72 { 73 MMRESULT mmr; 74 ACMFILTERTAGDETAILSA aftd; 75 75 76 76 TRACE("(0x%08x, %p, %ld)\n", had, pafd, fdwDetails); … … 80 80 81 81 if (pafd->cbStruct < sizeof(*pafd)) return MMSYSERR_INVALPARAM; 82 82 83 83 switch (fdwDetails) { 84 84 case ACM_FILTERDETAILSF_FILTER: 85 if (pafd->dwFilterTag != pafd->pwfltr->dwFilterTag) {86 mmr = MMSYSERR_INVALPARAM;87 break;88 }89 if (had == (HACMDRIVER)NULL) {90 PWINE_ACMDRIVERIDpadid;91 92 mmr = ACMERR_NOTPOSSIBLE;93 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {94 /* should check for codec only */95 if (padid->bEnabled && 96 acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) {97 mmr = MSACM_Message(had, ACMDM_FILTER_DETAILS,98 (LPARAM)pafd, (LPARAM)fdwDetails);99 acmDriverClose(had, 0);100 if (mmr == MMSYSERR_NOERROR) break;101 }102 } 103 } else {104 mmr = MSACM_Message(had, ACMDM_FILTER_DETAILS,105 (LPARAM)pafd, (LPARAM)fdwDetails);106 }107 break;85 if (pafd->dwFilterTag != pafd->pwfltr->dwFilterTag) { 86 mmr = MMSYSERR_INVALPARAM; 87 break; 88 } 89 if (had == (HACMDRIVER)NULL) { 90 PWINE_ACMDRIVERID padid; 91 92 mmr = ACMERR_NOTPOSSIBLE; 93 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) { 94 /* should check for codec only */ 95 if (padid->bEnabled && 96 acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) { 97 mmr = MSACM_Message(had, ACMDM_FILTER_DETAILS, 98 (LPARAM)pafd, (LPARAM)fdwDetails); 99 acmDriverClose(had, 0); 100 if (mmr == MMSYSERR_NOERROR) break; 101 } 102 } 103 } else { 104 mmr = MSACM_Message(had, ACMDM_FILTER_DETAILS, 105 (LPARAM)pafd, (LPARAM)fdwDetails); 106 } 107 break; 108 108 case ACM_FILTERDETAILSF_INDEX: 109 /* should check pafd->dwFilterIndex < aftd->cStandardFilters */110 mmr = MSACM_Message(had, ACMDM_FILTER_DETAILS,111 (LPARAM)pafd, (LPARAM)fdwDetails);112 break;109 /* should check pafd->dwFilterIndex < aftd->cStandardFilters */ 110 mmr = MSACM_Message(had, ACMDM_FILTER_DETAILS, 111 (LPARAM)pafd, (LPARAM)fdwDetails); 112 break; 113 113 default: 114 WARN("Unknown fdwDetails %08lx\n", fdwDetails);115 mmr = MMSYSERR_INVALFLAG;116 break;114 WARN("Unknown fdwDetails %08lx\n", fdwDetails); 115 mmr = MMSYSERR_INVALFLAG; 116 break; 117 117 } 118 118 … … 122 122 123 123 struct MSACM_FilterEnumWtoA_Instance { 124 PACMFILTERDETAILSA pafda;125 DWORD dwInstance;126 ACMFILTERENUMCBA fnCallback;124 PACMFILTERDETAILSA pafda; 125 DWORD dwInstance; 126 ACMFILTERENUMCBA fnCallback; 127 127 }; 128 128 129 129 static BOOL CALLBACK MSACM_FilterEnumCallbackWtoA(HACMDRIVERID hadid, 130 PACMFILTERDETAILSW pafdw, 131 DWORD dwInstance, 132 DWORD fdwSupport)130 PACMFILTERDETAILSW pafdw, 131 DWORD dwInstance, 132 DWORD fdwSupport) 133 133 { 134 134 struct MSACM_FilterEnumWtoA_Instance* pafei; … … 136 136 pafei = (struct MSACM_FilterEnumWtoA_Instance*)dwInstance; 137 137 138 pafei->pafda->dwFilterIndex = pafdw->dwFilterIndex; 139 pafei->pafda->dwFilterTag = pafdw->dwFilterTag; 140 pafei->pafda->fdwSupport = pafdw->fdwSupport; 138 pafei->pafda->dwFilterIndex = pafdw->dwFilterIndex; 139 pafei->pafda->dwFilterTag = pafdw->dwFilterTag; 140 pafei->pafda->fdwSupport = pafdw->fdwSupport; 141 141 WideCharToMultiByte( CP_ACP, 0, pafdw->szFilter, -1, pafei->pafda->szFilter, 142 142 sizeof(pafei->pafda->szFilter), NULL, NULL ); 143 143 144 return (pafei->fnCallback)(hadid, pafei->pafda, 145 pafei->dwInstance, fdwSupport);144 return (pafei->fnCallback)(hadid, pafei->pafda, 145 pafei->dwInstance, fdwSupport); 146 146 } 147 147 … … 149 149 * acmFilterEnumA (MSACM32.17) 150 150 */ 151 MMRESULT WINAPI acmFilterEnumA(HACMDRIVER had, PACMFILTERDETAILSA pafda, 152 ACMFILTERENUMCBA fnCallback, DWORD dwInstance, 153 DWORD fdwEnum)154 { 155 ACMFILTERDETAILSW afdw;151 MMRESULT WINAPI acmFilterEnumA(HACMDRIVER had, PACMFILTERDETAILSA pafda, 152 ACMFILTERENUMCBA fnCallback, DWORD dwInstance, 153 DWORD fdwEnum) 154 { 155 ACMFILTERDETAILSW afdw; 156 156 struct MSACM_FilterEnumWtoA_Instance afei; 157 157 … … 167 167 afei.fnCallback = fnCallback; 168 168 169 return acmFilterEnumW(had, &afdw, MSACM_FilterEnumCallbackWtoA, 170 (DWORD)&afei, fdwEnum);171 } 172 173 static BOOL MSACM_FilterEnumHelper(PWINE_ACMDRIVERID padid, HACMDRIVER had, 174 PACMFILTERDETAILSW pafd, 175 ACMFILTERENUMCBW fnCallback, DWORD dwInstance, 176 DWORD fdwEnum)177 { 178 ACMDRIVERDETAILSW add;179 ACMFILTERTAGDETAILSW aftd;180 int i, j;169 return acmFilterEnumW(had, &afdw, MSACM_FilterEnumCallbackWtoA, 170 (DWORD)&afei, fdwEnum); 171 } 172 173 static BOOL MSACM_FilterEnumHelper(PWINE_ACMDRIVERID padid, HACMDRIVER had, 174 PACMFILTERDETAILSW pafd, 175 ACMFILTERENUMCBW fnCallback, DWORD dwInstance, 176 DWORD fdwEnum) 177 { 178 ACMDRIVERDETAILSW add; 179 ACMFILTERTAGDETAILSW aftd; 180 int i, j; 181 181 182 182 add.cbStruct = sizeof(add); 183 183 184 184 if (acmDriverDetailsW((HACMDRIVERID)padid, &add, 0) != MMSYSERR_NOERROR) return FALSE; 185 185 186 186 for (i = 0; i < add.cFilterTags; i++) { 187 memset(&aftd, 0, sizeof(aftd));188 aftd.cbStruct = sizeof(aftd);189 aftd.dwFilterTagIndex = i;190 if (acmFilterTagDetailsW(had, &aftd, ACM_FILTERTAGDETAILSF_INDEX) != MMSYSERR_NOERROR)191 continue;192 193 if ((fdwEnum & ACM_FILTERENUMF_DWFILTERTAG) && 194 aftd.dwFilterTag != pafd->pwfltr->dwFilterTag)195 continue;196 197 for (j = 0; j < aftd.cStandardFilters; j++) {198 pafd->dwFilterIndex = j;199 pafd->dwFilterTag = aftd.dwFilterTag;200 if (acmFilterDetailsW(had, pafd, ACM_FILTERDETAILSF_INDEX) != MMSYSERR_NOERROR) 201 continue;202 203 if (!(fnCallback)((HACMDRIVERID)padid, pafd, dwInstance, add.fdwSupport))204 return FALSE; 205 }187 memset(&aftd, 0, sizeof(aftd)); 188 aftd.cbStruct = sizeof(aftd); 189 aftd.dwFilterTagIndex = i; 190 if (acmFilterTagDetailsW(had, &aftd, ACM_FILTERTAGDETAILSF_INDEX) != MMSYSERR_NOERROR) 191 continue; 192 193 if ((fdwEnum & ACM_FILTERENUMF_DWFILTERTAG) && 194 aftd.dwFilterTag != pafd->pwfltr->dwFilterTag) 195 continue; 196 197 for (j = 0; j < aftd.cStandardFilters; j++) { 198 pafd->dwFilterIndex = j; 199 pafd->dwFilterTag = aftd.dwFilterTag; 200 if (acmFilterDetailsW(had, pafd, ACM_FILTERDETAILSF_INDEX) != MMSYSERR_NOERROR) 201 continue; 202 203 if (!(fnCallback)((HACMDRIVERID)padid, pafd, dwInstance, add.fdwSupport)) 204 return FALSE; 205 } 206 206 } 207 207 return TRUE; … … 211 211 * acmFilterEnumW (MSACM32.18) 212 212 */ 213 MMRESULT WINAPI acmFilterEnumW(HACMDRIVER had, PACMFILTERDETAILSW pafd, 214 ACMFILTERENUMCBW fnCallback, DWORD dwInstance, 215 DWORD fdwEnum)216 { 217 PWINE_ACMDRIVERID padid;218 BOOL ret;213 MMRESULT WINAPI acmFilterEnumW(HACMDRIVER had, PACMFILTERDETAILSW pafd, 214 ACMFILTERENUMCBW fnCallback, DWORD dwInstance, 215 DWORD fdwEnum) 216 { 217 PWINE_ACMDRIVERID padid; 218 BOOL ret; 219 219 220 220 TRACE("(0x%08x, %p, %p, %ld, %ld)\n", 221 had, pafd, fnCallback, dwInstance, fdwEnum);221 had, pafd, fnCallback, dwInstance, fdwEnum); 222 222 223 223 if (pafd->cbStruct < sizeof(*pafd)) return MMSYSERR_INVALPARAM; 224 224 225 225 if (fdwEnum & ~(ACM_FILTERENUMF_DWFILTERTAG)) 226 FIXME("Unsupported fdwEnum values\n");226 FIXME("Unsupported fdwEnum values\n"); 227 227 228 228 if (had) { 229 HACMDRIVERID hadid; 230 231 if (acmDriverID(had, &hadid, 0) != MMSYSERR_NOERROR) 232 return MMSYSERR_INVALHANDLE; 233 MSACM_FilterEnumHelper(MSACM_GetDriverID(hadid), had, pafd, 234 fnCallback, dwInstance, fdwEnum); 229 HACMDRIVERID hadid; 230 231 if (acmDriverID(had, &hadid, 0) != MMSYSERR_NOERROR) 232 return MMSYSERR_INVALHANDLE; 233 MSACM_FilterEnumHelper(MSACM_GetDriverID(hadid), had, pafd, 234 fnCallback, dwInstance, fdwEnum); 235 return MMSYSERR_NOERROR; 236 } 237 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) { 238 /* should check for codec only */ 239 if (!padid->bEnabled || acmDriverOpen(&had, (HACMDRIVERID)padid, 0) != MMSYSERR_NOERROR) 240 continue; 241 ret = MSACM_FilterEnumHelper(padid, had, pafd, 242 fnCallback, dwInstance, fdwEnum); 243 acmDriverClose(had, 0); 244 if (!ret) break; 245 } 235 246 return MMSYSERR_NOERROR; 236 }237 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {238 /* should check for codec only */239 if (!padid->bEnabled || acmDriverOpen(&had, (HACMDRIVERID)padid, 0) != MMSYSERR_NOERROR)240 continue;241 ret = MSACM_FilterEnumHelper(padid, had, pafd,242 fnCallback, dwInstance, fdwEnum);243 acmDriverClose(had, 0);244 if (!ret) break;245 }246 return MMSYSERR_NOERROR;247 247 } 248 248 … … 250 250 * acmFilterTagDetailsA (MSACM32.19) 251 251 */ 252 MMRESULT WINAPI acmFilterTagDetailsA(HACMDRIVER had, PACMFILTERTAGDETAILSA paftda, 253 DWORD fdwDetails)254 { 255 ACMFILTERTAGDETAILSW aftdw;256 MMRESULT mmr;252 MMRESULT WINAPI acmFilterTagDetailsA(HACMDRIVER had, PACMFILTERTAGDETAILSA paftda, 253 DWORD fdwDetails) 254 { 255 ACMFILTERTAGDETAILSW aftdw; 256 MMRESULT mmr; 257 257 258 258 memset(&aftdw, 0, sizeof(aftdw)); … … 263 263 mmr = acmFilterTagDetailsW(had, &aftdw, fdwDetails); 264 264 if (mmr == MMSYSERR_NOERROR) { 265 paftda->dwFilterTag = aftdw.dwFilterTag; 266 paftda->dwFilterTagIndex = aftdw.dwFilterTagIndex;267 paftda->cbFilterSize = aftdw.cbFilterSize; 268 paftda->fdwSupport = aftdw.fdwSupport; 269 paftda->cStandardFilters = aftdw.cStandardFilters; 265 paftda->dwFilterTag = aftdw.dwFilterTag; 266 paftda->dwFilterTagIndex = aftdw.dwFilterTagIndex; 267 paftda->cbFilterSize = aftdw.cbFilterSize; 268 paftda->fdwSupport = aftdw.fdwSupport; 269 paftda->cStandardFilters = aftdw.cStandardFilters; 270 270 WideCharToMultiByte( CP_ACP, 0, aftdw.szFilterTag, -1, paftda->szFilterTag, 271 271 sizeof(paftda->szFilterTag), NULL, NULL ); … … 277 277 * acmFilterTagDetailsW (MSACM32.20) 278 278 */ 279 MMRESULT WINAPI acmFilterTagDetailsW(HACMDRIVER had, PACMFILTERTAGDETAILSW paftd, 280 DWORD fdwDetails)281 { 282 PWINE_ACMDRIVERID padid;283 MMRESULT mmr;279 MMRESULT WINAPI acmFilterTagDetailsW(HACMDRIVER had, PACMFILTERTAGDETAILSW paftd, 280 DWORD fdwDetails) 281 { 282 PWINE_ACMDRIVERID padid; 283 MMRESULT mmr; 284 284 285 285 TRACE("(0x%08x, %p, %ld)\n", had, paftd, fdwDetails); 286 286 287 287 if (fdwDetails & ~(ACM_FILTERTAGDETAILSF_FILTERTAG|ACM_FILTERTAGDETAILSF_INDEX| 288 ACM_FILTERTAGDETAILSF_LARGESTSIZE))289 return MMSYSERR_INVALFLAG;288 ACM_FILTERTAGDETAILSF_LARGESTSIZE)) 289 return MMSYSERR_INVALFLAG; 290 290 291 291 switch (fdwDetails) { 292 292 case ACM_FILTERTAGDETAILSF_FILTERTAG: 293 if (had == (HACMDRIVER)NULL) {294 mmr = ACMERR_NOTPOSSIBLE;295 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {296 /* should check for codec only */297 if (padid->bEnabled && acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) {298 mmr = MSACM_Message(had, ACMDM_FILTERTAG_DETAILS,299 (LPARAM)paftd, (LPARAM)fdwDetails);300 acmDriverClose(had, 0);301 if (mmr == MMSYSERR_NOERROR) break;302 }303 }304 } else {305 mmr = MSACM_Message(had, ACMDM_FILTERTAG_DETAILS,306 (LPARAM)paftd, (LPARAM)fdwDetails);307 }308 break;293 if (had == (HACMDRIVER)NULL) { 294 mmr = ACMERR_NOTPOSSIBLE; 295 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) { 296 /* should check for codec only */ 297 if (padid->bEnabled && acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) { 298 mmr = MSACM_Message(had, ACMDM_FILTERTAG_DETAILS, 299 (LPARAM)paftd, (LPARAM)fdwDetails); 300 acmDriverClose(had, 0); 301 if (mmr == MMSYSERR_NOERROR) break; 302 } 303 } 304 } else { 305 mmr = MSACM_Message(had, ACMDM_FILTERTAG_DETAILS, 306 (LPARAM)paftd, (LPARAM)fdwDetails); 307 } 308 break; 309 309 310 310 case ACM_FILTERTAGDETAILSF_INDEX: 311 /* FIXME should check paftd->dwFilterTagIndex < add.cFilterTags */312 mmr = MSACM_Message(had, ACMDM_FILTERTAG_DETAILS,313 (LPARAM)paftd, (LPARAM)fdwDetails);314 break;311 /* FIXME should check paftd->dwFilterTagIndex < add.cFilterTags */ 312 mmr = MSACM_Message(had, ACMDM_FILTERTAG_DETAILS, 313 (LPARAM)paftd, (LPARAM)fdwDetails); 314 break; 315 315 316 316 case ACM_FILTERTAGDETAILSF_LARGESTSIZE: 317 if (had == (HACMDRIVER)NULL) {318 ACMFILTERTAGDETAILSWtmp;319 DWORDft = paftd->dwFilterTag;320 321 mmr = ACMERR_NOTPOSSIBLE;322 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {323 /* should check for codec only */324 if (padid->bEnabled && 325 acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) {326 327 memset(&tmp, 0, sizeof(tmp));328 tmp.cbStruct = sizeof(tmp);329 tmp.dwFilterTag = ft;330 331 if (MSACM_Message(had, ACMDM_FILTERTAG_DETAILS,332 (LPARAM)&tmp, 333 (LPARAM)fdwDetails) == MMSYSERR_NOERROR) {334 if (mmr == ACMERR_NOTPOSSIBLE ||335 paftd->cbFilterSize < tmp.cbFilterSize) {336 *paftd = tmp;337 mmr = MMSYSERR_NOERROR;338 } 339 }340 acmDriverClose(had, 0);341 }342 }343 } else {344 mmr = MSACM_Message(had, ACMDM_FILTERTAG_DETAILS,345 (LPARAM)paftd, (LPARAM)fdwDetails);346 }347 break;317 if (had == (HACMDRIVER)NULL) { 318 ACMFILTERTAGDETAILSW tmp; 319 DWORD ft = paftd->dwFilterTag; 320 321 mmr = ACMERR_NOTPOSSIBLE; 322 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) { 323 /* should check for codec only */ 324 if (padid->bEnabled && 325 acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) { 326 327 memset(&tmp, 0, sizeof(tmp)); 328 tmp.cbStruct = sizeof(tmp); 329 tmp.dwFilterTag = ft; 330 331 if (MSACM_Message(had, ACMDM_FILTERTAG_DETAILS, 332 (LPARAM)&tmp, 333 (LPARAM)fdwDetails) == MMSYSERR_NOERROR) { 334 if (mmr == ACMERR_NOTPOSSIBLE || 335 paftd->cbFilterSize < tmp.cbFilterSize) { 336 *paftd = tmp; 337 mmr = MMSYSERR_NOERROR; 338 } 339 } 340 acmDriverClose(had, 0); 341 } 342 } 343 } else { 344 mmr = MSACM_Message(had, ACMDM_FILTERTAG_DETAILS, 345 (LPARAM)paftd, (LPARAM)fdwDetails); 346 } 347 break; 348 348 349 349 default: 350 WARN("Unsupported fdwDetails=%08lx\n", fdwDetails);351 mmr = MMSYSERR_ERROR;352 } 353 354 if (mmr == MMSYSERR_NOERROR && 355 paftd->dwFilterTag == WAVE_FORMAT_PCM && paftd->szFilterTag[0] == 0)350 WARN("Unsupported fdwDetails=%08lx\n", fdwDetails); 351 mmr = MMSYSERR_ERROR; 352 } 353 354 if (mmr == MMSYSERR_NOERROR && 355 paftd->dwFilterTag == WAVE_FORMAT_PCM && paftd->szFilterTag[0] == 0) 356 356 MultiByteToWideChar( CP_ACP, 0, "PCM", -1, paftd->szFilterTag, 357 357 sizeof(paftd->szFilterTag)/sizeof(WCHAR) ); … … 361 361 362 362 struct MSACM_FilterTagEnumWtoA_Instance { 363 PACMFILTERTAGDETAILSA paftda;364 DWORD dwInstance;365 ACMFILTERTAGENUMCBA fnCallback;363 PACMFILTERTAGDETAILSA paftda; 364 DWORD dwInstance; 365 ACMFILTERTAGENUMCBA fnCallback; 366 366 }; 367 367 368 368 static BOOL CALLBACK MSACM_FilterTagEnumCallbackWtoA(HACMDRIVERID hadid, 369 PACMFILTERTAGDETAILSW paftdw, 370 DWORD dwInstance, 371 DWORD fdwSupport)369 PACMFILTERTAGDETAILSW paftdw, 370 DWORD dwInstance, 371 DWORD fdwSupport) 372 372 { 373 373 struct MSACM_FilterTagEnumWtoA_Instance* paftei; … … 375 375 paftei = (struct MSACM_FilterTagEnumWtoA_Instance*)dwInstance; 376 376 377 paftei->paftda->dwFilterTagIndex = paftdw->dwFilterTagIndex; 378 paftei->paftda->dwFilterTag = paftdw->dwFilterTag; 379 paftei->paftda->cbFilterSize = paftdw->cbFilterSize; 380 paftei->paftda->fdwSupport = paftdw->fdwSupport; 381 paftei->paftda->cStandardFilters = paftdw->cStandardFilters; 377 paftei->paftda->dwFilterTagIndex = paftdw->dwFilterTagIndex; 378 paftei->paftda->dwFilterTag = paftdw->dwFilterTag; 379 paftei->paftda->cbFilterSize = paftdw->cbFilterSize; 380 paftei->paftda->fdwSupport = paftdw->fdwSupport; 381 paftei->paftda->cStandardFilters = paftdw->cStandardFilters; 382 382 WideCharToMultiByte( CP_ACP, 0, paftdw->szFilterTag, -1, paftei->paftda->szFilterTag, 383 383 sizeof(paftei->paftda->szFilterTag), NULL, NULL ); 384 384 385 return (paftei->fnCallback)(hadid, paftei->paftda, 386 paftei->dwInstance, fdwSupport);385 return (paftei->fnCallback)(hadid, paftei->paftda, 386 paftei->dwInstance, fdwSupport); 387 387 } 388 388 … … 391 391 */ 392 392 MMRESULT WINAPI acmFilterTagEnumA(HACMDRIVER had, PACMFILTERTAGDETAILSA paftda, 393 ACMFILTERTAGENUMCBA fnCallback, DWORD dwInstance, 394 DWORD fdwEnum)395 { 396 ACMFILTERTAGDETAILSW aftdw;393 ACMFILTERTAGENUMCBA fnCallback, DWORD dwInstance, 394 DWORD fdwEnum) 395 { 396 ACMFILTERTAGDETAILSW aftdw; 397 397 struct MSACM_FilterTagEnumWtoA_Instance aftei; 398 398 … … 406 406 aftei.fnCallback = fnCallback; 407 407 408 return acmFilterTagEnumW(had, &aftdw, MSACM_FilterTagEnumCallbackWtoA, 409 (DWORD)&aftei, fdwEnum);408 return acmFilterTagEnumW(had, &aftdw, MSACM_FilterTagEnumCallbackWtoA, 409 (DWORD)&aftei, fdwEnum); 410 410 } 411 411 … … 414 414 */ 415 415 MMRESULT WINAPI acmFilterTagEnumW(HACMDRIVER had, PACMFILTERTAGDETAILSW paftd, 416 ACMFILTERTAGENUMCBW fnCallback, DWORD dwInstance, 417 DWORD fdwEnum)418 { 419 PWINE_ACMDRIVERID padid;420 ACMDRIVERDETAILSW add;421 int i;416 ACMFILTERTAGENUMCBW fnCallback, DWORD dwInstance, 417 DWORD fdwEnum) 418 { 419 PWINE_ACMDRIVERID padid; 420 ACMDRIVERDETAILSW add; 421 int i; 422 422 423 423 TRACE("(0x%08x, %p, %p, %ld, %ld)\n", 424 had, paftd, fnCallback, dwInstance, fdwEnum); 424 had, paftd, fnCallback, dwInstance, fdwEnum); 425 425 426 426 if (paftd->cbStruct < sizeof(*paftd)) return MMSYSERR_INVALPARAM; 427 427 428 428 if (had) FIXME("had != NULL, not supported\n"); 429 429 430 430 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) { 431 /* should check for codec only */432 if (padid->bEnabled && acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == MMSYSERR_NOERROR) {433 add.cbStruct = sizeof(add);434 435 if (acmDriverDetailsW((HACMDRIVERID)padid, &add, 0) == MMSYSERR_NOERROR) {436 for (i = 0; i < add.cFilterTags; i++) {437 paftd->dwFilterTagIndex = i;438 if (acmFilterTagDetailsW(had, paftd, ACM_FILTERTAGDETAILSF_INDEX) == MMSYSERR_NOERROR) {439 if (!(fnCallback)((HACMDRIVERID)padid, paftd, dwInstance, 440 add.fdwSupport)) {441 padid = NULL;442 break;443 }444 }445 }446 }447 }448 acmDriverClose(had, 0);431 /* should check for codec only */ 432 if (padid->bEnabled && acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == MMSYSERR_NOERROR) { 433 add.cbStruct = sizeof(add); 434 435 if (acmDriverDetailsW((HACMDRIVERID)padid, &add, 0) == MMSYSERR_NOERROR) { 436 for (i = 0; i < add.cFilterTags; i++) { 437 paftd->dwFilterTagIndex = i; 438 if (acmFilterTagDetailsW(had, paftd, ACM_FILTERTAGDETAILSF_INDEX) == MMSYSERR_NOERROR) { 439 if (!(fnCallback)((HACMDRIVERID)padid, paftd, dwInstance, 440 add.fdwSupport)) { 441 padid = NULL; 442 break; 443 } 444 } 445 } 446 } 447 } 448 acmDriverClose(had, 0); 449 449 } 450 450 return MMSYSERR_NOERROR; -
trunk/src/msacm32/format.c
r6648 r6712 1 1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */ 2 /* $Id: format.c,v 1.2 2001-09-05 13:11:25 bird Exp $ */ 2 3 3 /* 4 4 * MSACM32 library 5 5 * 6 6 * Copyright 1998 Patrik Stridvall 7 * 2000Eric Pouech7 * 2000 Eric Pouech 8 8 */ 9 9 … … 24 24 DEFAULT_DEBUG_CHANNEL(msacm); 25 25 26 static PACMFORMATCHOOSEAafc;26 static PACMFORMATCHOOSEA afc; 27 27 28 28 struct MSACM_FillFormatData { 29 HWND hWnd;30 #define WINE_ACMFF_TAG 031 #define WINE_ACMFF_FORMAT 132 #define WINE_ACMFF_WFX 233 int mode;34 char szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS];35 PACMFORMATCHOOSEA afc;36 DWORD ret;29 HWND hWnd; 30 #define WINE_ACMFF_TAG 0 31 #define WINE_ACMFF_FORMAT 1 32 #define WINE_ACMFF_WFX 2 33 int mode; 34 char szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS]; 35 PACMFORMATCHOOSEA afc; 36 DWORD ret; 37 37 }; 38 38 39 static BOOL CALLBACK MSACM_FillFormatTagsCB(HACMDRIVERID hadid, 40 PACMFORMATTAGDETAILSA paftd,41 DWORD dwInstance, DWORD fdwSupport)42 { 43 struct MSACM_FillFormatData* affd = (struct MSACM_FillFormatData*)dwInstance;39 static BOOL CALLBACK MSACM_FillFormatTagsCB(HACMDRIVERID hadid, 40 PACMFORMATTAGDETAILSA paftd, 41 DWORD dwInstance, DWORD fdwSupport) 42 { 43 struct MSACM_FillFormatData* affd = (struct MSACM_FillFormatData*)dwInstance; 44 44 45 45 switch (affd->mode) { 46 46 case WINE_ACMFF_TAG: 47 if (SendDlgItemMessageA(affd->hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 48 CB_FINDSTRINGEXACT, 49 (WPARAM)-1, (LPARAM)paftd->szFormatTag) == CB_ERR)50 SendDlgItemMessageA(affd->hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 51 CB_ADDSTRING, 0, (DWORD)paftd->szFormatTag);52 break;47 if (SendDlgItemMessageA(affd->hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 48 CB_FINDSTRINGEXACT, 49 (WPARAM)-1, (LPARAM)paftd->szFormatTag) == CB_ERR) 50 SendDlgItemMessageA(affd->hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 51 CB_ADDSTRING, 0, (DWORD)paftd->szFormatTag); 52 break; 53 53 case WINE_ACMFF_FORMAT: 54 if (strcmp(affd->szFormatTag, paftd->szFormatTag) == 0) {55 HACMDRIVERhad;56 57 if (acmDriverOpen(&had, hadid, 0) == MMSYSERR_NOERROR) {58 ACMFORMATDETAILSAafd;59 inti, idx;60 MMRESULTmmr;61 charbuffer[64];62 63 afd.cbStruct = sizeof(afd);64 afd.dwFormatTag = paftd->dwFormatTag;65 afd.pwfx = HeapAlloc(GetProcessHeap(), 0, paftd->cbFormatSize);66 afd.pwfx->wFormatTag = paftd->dwFormatTag;67 afd.pwfx->cbSize = paftd->cbFormatSize;68 afd.cbwfx = paftd->cbFormatSize;69 70 for (i = 0; i < paftd->cStandardFormats; i++) {71 afd.dwFormatIndex = i;72 mmr = acmFormatDetailsA(had, &afd, ACM_FORMATDETAILSF_INDEX);73 if (mmr == MMSYSERR_NOERROR) {74 strcpy(buffer, afd.szFormat);75 for (idx = strlen(buffer); 76 idx < ACMFORMATTAGDETAILS_FORMATTAG_CHARS; idx++)77 buffer[idx] = ' ';78 wsprintfA(buffer + ACMFORMATTAGDETAILS_FORMATTAG_CHARS, 79 "%d Ko/s", 80 (afd.pwfx->nAvgBytesPerSec + 512) / 1024);81 SendDlgItemMessageA(affd->hWnd, 82 IDD_ACMFORMATCHOOSE_CMB_FORMAT, 83 CB_ADDSTRING, 0, (DWORD)buffer);84 }85 }86 acmDriverClose(had, 0);87 SendDlgItemMessageA(affd->hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMAT, 88 CB_SETCURSEL, 0, 0);89 } 90 }91 break;54 if (strcmp(affd->szFormatTag, paftd->szFormatTag) == 0) { 55 HACMDRIVER had; 56 57 if (acmDriverOpen(&had, hadid, 0) == MMSYSERR_NOERROR) { 58 ACMFORMATDETAILSA afd; 59 int i, idx; 60 MMRESULT mmr; 61 char buffer[64]; 62 63 afd.cbStruct = sizeof(afd); 64 afd.dwFormatTag = paftd->dwFormatTag; 65 afd.pwfx = HeapAlloc(GetProcessHeap(), 0, paftd->cbFormatSize); 66 afd.pwfx->wFormatTag = paftd->dwFormatTag; 67 afd.pwfx->cbSize = paftd->cbFormatSize; 68 afd.cbwfx = paftd->cbFormatSize; 69 70 for (i = 0; i < paftd->cStandardFormats; i++) { 71 afd.dwFormatIndex = i; 72 mmr = acmFormatDetailsA(had, &afd, ACM_FORMATDETAILSF_INDEX); 73 if (mmr == MMSYSERR_NOERROR) { 74 strcpy(buffer, afd.szFormat); 75 for (idx = strlen(buffer); 76 idx < ACMFORMATTAGDETAILS_FORMATTAG_CHARS; idx++) 77 buffer[idx] = ' '; 78 wsprintfA(buffer + ACMFORMATTAGDETAILS_FORMATTAG_CHARS, 79 "%d Ko/s", 80 (afd.pwfx->nAvgBytesPerSec + 512) / 1024); 81 SendDlgItemMessageA(affd->hWnd, 82 IDD_ACMFORMATCHOOSE_CMB_FORMAT, 83 CB_ADDSTRING, 0, (DWORD)buffer); 84 } 85 } 86 acmDriverClose(had, 0); 87 SendDlgItemMessageA(affd->hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMAT, 88 CB_SETCURSEL, 0, 0); 89 } 90 } 91 break; 92 92 case WINE_ACMFF_WFX: 93 if (strcmp(affd->szFormatTag, paftd->szFormatTag) == 0) {94 HACMDRIVERhad;95 96 if (acmDriverOpen(&had, hadid, 0) == MMSYSERR_NOERROR) {97 ACMFORMATDETAILSAafd;98 99 afd.cbStruct = sizeof(afd);100 afd.dwFormatTag = paftd->dwFormatTag;101 afd.pwfx = affd->afc->pwfx;102 afd.cbwfx = affd->afc->cbwfx;103 104 afd.dwFormatIndex = SendDlgItemMessageA(affd->hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMAT, CB_GETCURSEL, 0, 0);;105 affd->ret = acmFormatDetailsA(had, &afd, ACM_FORMATDETAILSF_INDEX);106 acmDriverClose(had, 0);107 return TRUE;108 } 109 }110 break;93 if (strcmp(affd->szFormatTag, paftd->szFormatTag) == 0) { 94 HACMDRIVER had; 95 96 if (acmDriverOpen(&had, hadid, 0) == MMSYSERR_NOERROR) { 97 ACMFORMATDETAILSA afd; 98 99 afd.cbStruct = sizeof(afd); 100 afd.dwFormatTag = paftd->dwFormatTag; 101 afd.pwfx = affd->afc->pwfx; 102 afd.cbwfx = affd->afc->cbwfx; 103 104 afd.dwFormatIndex = SendDlgItemMessageA(affd->hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMAT, CB_GETCURSEL, 0, 0);; 105 affd->ret = acmFormatDetailsA(had, &afd, ACM_FORMATDETAILSF_INDEX); 106 acmDriverClose(had, 0); 107 return TRUE; 108 } 109 } 110 break; 111 111 default: 112 FIXME("Unknown mode (%d)\n", affd->mode);113 break;112 FIXME("Unknown mode (%d)\n", affd->mode); 113 break; 114 114 } 115 115 return TRUE; … … 118 118 static BOOL MSACM_FillFormatTags(HWND hWnd) 119 119 { 120 ACMFORMATTAGDETAILSA aftd;121 struct MSACM_FillFormatData affd;120 ACMFORMATTAGDETAILSA aftd; 121 struct MSACM_FillFormatData affd; 122 122 123 123 memset(&aftd, 0, sizeof(aftd)); … … 134 134 static BOOL MSACM_FillFormat(HWND hWnd) 135 135 { 136 ACMFORMATTAGDETAILSA aftd;137 struct MSACM_FillFormatData affd;136 ACMFORMATTAGDETAILSA aftd; 137 struct MSACM_FillFormatData affd; 138 138 139 139 SendDlgItemMessageA(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMAT, CB_RESETCONTENT, 0, 0); … … 144 144 affd.hWnd = hWnd; 145 145 affd.mode = WINE_ACMFF_FORMAT; 146 SendDlgItemMessageA(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 147 CB_GETLBTEXT,148 SendDlgItemMessageA(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 149 CB_GETCURSEL, 0, 0),150 (DWORD)affd.szFormatTag);151 146 SendDlgItemMessageA(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 147 CB_GETLBTEXT, 148 SendDlgItemMessageA(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 149 CB_GETCURSEL, 0, 0), 150 (DWORD)affd.szFormatTag); 151 152 152 acmFormatTagEnumA((HACMDRIVER)0, &aftd, MSACM_FillFormatTagsCB, (DWORD)&affd, 0); 153 153 SendDlgItemMessageA(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMAT, CB_SETCURSEL, 0, 0); … … 157 157 static MMRESULT MSACM_GetWFX(HWND hWnd, PACMFORMATCHOOSEA afc) 158 158 { 159 ACMFORMATTAGDETAILSA aftd;160 struct MSACM_FillFormatData affd;159 ACMFORMATTAGDETAILSA aftd; 160 struct MSACM_FillFormatData affd; 161 161 162 162 memset(&aftd, 0, sizeof(aftd)); … … 172 172 } 173 173 174 static BOOL WINAPI FormatChooseDlgProc(HWND hWnd, UINT msg, 175 WPARAM wParam, LPARAM lParam)176 { 177 174 static BOOL WINAPI FormatChooseDlgProc(HWND hWnd, UINT msg, 175 WPARAM wParam, LPARAM lParam) 176 { 177 178 178 TRACE("hwnd=%i msg=%i 0x%08x 0x%08lx\n", hWnd, msg, wParam, lParam ); 179 179 180 180 switch (msg) { 181 181 case WM_INITDIALOG: 182 afc = (PACMFORMATCHOOSEA)lParam;183 MSACM_FillFormatTags(hWnd);184 MSACM_FillFormat(hWnd);185 if ((afc->fdwStyle & ~(ACMFORMATCHOOSE_STYLEF_CONTEXTHELP|186 ACMFORMATCHOOSE_STYLEF_SHOWHELP)) != 0)187 FIXME("Unsupported style %08lx\n", ((PACMFORMATCHOOSEA)lParam)->fdwStyle);188 if (!(afc->fdwStyle & ACMFORMATCHOOSE_STYLEF_SHOWHELP))189 ShowWindow(GetDlgItem(hWnd, IDD_ACMFORMATCHOOSE_BTN_HELP), SW_HIDE);190 return TRUE;191 182 afc = (PACMFORMATCHOOSEA)lParam; 183 MSACM_FillFormatTags(hWnd); 184 MSACM_FillFormat(hWnd); 185 if ((afc->fdwStyle & ~(ACMFORMATCHOOSE_STYLEF_CONTEXTHELP| 186 ACMFORMATCHOOSE_STYLEF_SHOWHELP)) != 0) 187 FIXME("Unsupported style %08lx\n", ((PACMFORMATCHOOSEA)lParam)->fdwStyle); 188 if (!(afc->fdwStyle & ACMFORMATCHOOSE_STYLEF_SHOWHELP)) 189 ShowWindow(GetDlgItem(hWnd, IDD_ACMFORMATCHOOSE_BTN_HELP), SW_HIDE); 190 return TRUE; 191 192 192 case WM_COMMAND: 193 switch (LOWORD(wParam)) {194 case IDOK:195 EndDialog(hWnd, MSACM_GetWFX(hWnd, afc));196 return TRUE;197 case IDCANCEL:198 EndDialog(hWnd, ACMERR_CANCELED);199 return TRUE;200 case IDD_ACMFORMATCHOOSE_CMB_FORMATTAG:201 switch (HIWORD(wParam)) {202 case CBN_SELCHANGE:203 MSACM_FillFormat(hWnd);204 break;205 default:206 TRACE("Dropped dlgNotif (fmtTag): 0x%08x 0x%08lx\n", 207 HIWORD(wParam), lParam);208 break;209 }210 break;211 case IDD_ACMFORMATCHOOSE_BTN_HELP:212 if (afc->fdwStyle & ACMFORMATCHOOSE_STYLEF_SHOWHELP)213 SendMessageA(afc->hwndOwner, 214 RegisterWindowMessageA(ACMHELPMSGSTRINGA), 0L, 0L);215 break;216 217 default:218 TRACE("Dropped dlgCmd: ctl=%d ntf=0x%04x 0x%08lx\n", 219 LOWORD(wParam), HIWORD(wParam), lParam);220 break;221 }222 break;193 switch (LOWORD(wParam)) { 194 case IDOK: 195 EndDialog(hWnd, MSACM_GetWFX(hWnd, afc)); 196 return TRUE; 197 case IDCANCEL: 198 EndDialog(hWnd, ACMERR_CANCELED); 199 return TRUE; 200 case IDD_ACMFORMATCHOOSE_CMB_FORMATTAG: 201 switch (HIWORD(wParam)) { 202 case CBN_SELCHANGE: 203 MSACM_FillFormat(hWnd); 204 break; 205 default: 206 TRACE("Dropped dlgNotif (fmtTag): 0x%08x 0x%08lx\n", 207 HIWORD(wParam), lParam); 208 break; 209 } 210 break; 211 case IDD_ACMFORMATCHOOSE_BTN_HELP: 212 if (afc->fdwStyle & ACMFORMATCHOOSE_STYLEF_SHOWHELP) 213 SendMessageA(afc->hwndOwner, 214 RegisterWindowMessageA(ACMHELPMSGSTRINGA), 0L, 0L); 215 break; 216 217 default: 218 TRACE("Dropped dlgCmd: ctl=%d ntf=0x%04x 0x%08lx\n", 219 LOWORD(wParam), HIWORD(wParam), lParam); 220 break; 221 } 222 break; 223 223 case WM_CONTEXTMENU: 224 if (afc->fdwStyle & ACMFORMATCHOOSE_STYLEF_CONTEXTHELP)225 SendMessageA(afc->hwndOwner, 226 RegisterWindowMessageA(ACMHELPMSGCONTEXTMENUA), 227 wParam, lParam);228 break;224 if (afc->fdwStyle & ACMFORMATCHOOSE_STYLEF_CONTEXTHELP) 225 SendMessageA(afc->hwndOwner, 226 RegisterWindowMessageA(ACMHELPMSGCONTEXTMENUA), 227 wParam, lParam); 228 break; 229 229 #if defined(WM_CONTEXTHELP) 230 230 case WM_CONTEXTHELP: 231 if (afc->fdwStyle & ACMFORMATCHOOSE_STYLEF_CONTEXTHELP)232 SendMessageA(afc->hwndOwner, 233 RegisterWindowMessageA(ACMHELPMSGCONTEXTHELPA), 234 wParam, lParam);235 break;236 #endif 231 if (afc->fdwStyle & ACMFORMATCHOOSE_STYLEF_CONTEXTHELP) 232 SendMessageA(afc->hwndOwner, 233 RegisterWindowMessageA(ACMHELPMSGCONTEXTHELPA), 234 wParam, lParam); 235 break; 236 #endif 237 237 default: 238 TRACE("Dropped dlgMsg: hwnd=%i msg=%i 0x%08x 0x%08lx\n", 239 hWnd, msg, wParam, lParam );240 break;238 TRACE("Dropped dlgMsg: hwnd=%i msg=%i 0x%08x 0x%08lx\n", 239 hWnd, msg, wParam, lParam ); 240 break; 241 241 } 242 242 return FALSE; … … 249 249 { 250 250 return DialogBoxParamA(MSACM_hInstance32, MAKEINTRESOURCEA(DLG_ACMFORMATCHOOSE_ID), 251 pafmtc->hwndOwner, FormatChooseDlgProc, (INT)pafmtc);251 pafmtc->hwndOwner, FormatChooseDlgProc, (INT)pafmtc); 252 252 } 253 253 … … 265 265 * acmFormatDetailsA (MSACM32.25) 266 266 */ 267 MMRESULT WINAPI acmFormatDetailsA(HACMDRIVER had, PACMFORMATDETAILSA pafd, 268 DWORD fdwDetails)269 { 270 ACMFORMATDETAILSW afdw;271 MMRESULT mmr;267 MMRESULT WINAPI acmFormatDetailsA(HACMDRIVER had, PACMFORMATDETAILSA pafd, 268 DWORD fdwDetails) 269 { 270 ACMFORMATDETAILSW afdw; 271 MMRESULT mmr; 272 272 273 273 memset(&afdw, 0, sizeof(afdw)); 274 274 afdw.cbStruct = sizeof(afdw); 275 275 afdw.dwFormatIndex = pafd->dwFormatIndex; 276 afdw.dwFormatTag = pafd->dwFormatTag; 277 afdw.pwfx = pafd->pwfx; 278 afdw.cbwfx = pafd->cbwfx; 276 afdw.dwFormatTag = pafd->dwFormatTag; 277 afdw.pwfx = pafd->pwfx; 278 afdw.cbwfx = pafd->cbwfx; 279 279 280 280 mmr = acmFormatDetailsW(had, &afdw, fdwDetails); 281 281 if (mmr == MMSYSERR_NOERROR) { 282 pafd->dwFormatTag = afdw.dwFormatTag; 283 pafd->fdwSupport = afdw.fdwSupport; 282 pafd->dwFormatTag = afdw.dwFormatTag; 283 pafd->fdwSupport = afdw.fdwSupport; 284 284 WideCharToMultiByte( CP_ACP, 0, afdw.szFormat, -1, 285 285 pafd->szFormat, sizeof(pafd->szFormat), NULL, NULL ); … … 291 291 * acmFormatDetailsW (MSACM32.26) 292 292 */ 293 MMRESULT WINAPI acmFormatDetailsW(HACMDRIVER had, PACMFORMATDETAILSW pafd, 294 DWORD fdwDetails)295 { 296 MMRESULT mmr;297 static WCHAR fmt1[] = {'%','d',' ','H','z',0};298 static WCHAR fmt2[] = {';',' ','%','d',' ','b','i','t','s',0};299 ACMFORMATTAGDETAILSA aftd;293 MMRESULT WINAPI acmFormatDetailsW(HACMDRIVER had, PACMFORMATDETAILSW pafd, 294 DWORD fdwDetails) 295 { 296 MMRESULT mmr; 297 static WCHAR fmt1[] = {'%','d',' ','H','z',0}; 298 static WCHAR fmt2[] = {';',' ','%','d',' ','b','i','t','s',0}; 299 ACMFORMATTAGDETAILSA aftd; 300 300 301 301 TRACE("(0x%08x, %p, %ld)\n", had, pafd, fdwDetails); … … 305 305 306 306 if (pafd->cbStruct < sizeof(*pafd)) return MMSYSERR_INVALPARAM; 307 307 308 308 switch (fdwDetails) { 309 309 case ACM_FORMATDETAILSF_FORMAT: 310 if (pafd->dwFormatTag != pafd->pwfx->wFormatTag) {311 mmr = MMSYSERR_INVALPARAM;312 break;313 }314 if (had == (HACMDRIVER)NULL) {315 PWINE_ACMDRIVERIDpadid;316 317 mmr = ACMERR_NOTPOSSIBLE;318 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {319 /* should check for codec only */320 if (padid->bEnabled && 321 acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) {322 mmr = MSACM_Message(had, ACMDM_FORMAT_DETAILS,323 (LPARAM)pafd, (LPARAM)fdwDetails);324 acmDriverClose(had, 0);325 if (mmr == MMSYSERR_NOERROR) break;326 }327 } 328 } else {329 mmr = MSACM_Message(had, ACMDM_FORMAT_DETAILS,330 (LPARAM)pafd, (LPARAM)fdwDetails);331 }332 break;310 if (pafd->dwFormatTag != pafd->pwfx->wFormatTag) { 311 mmr = MMSYSERR_INVALPARAM; 312 break; 313 } 314 if (had == (HACMDRIVER)NULL) { 315 PWINE_ACMDRIVERID padid; 316 317 mmr = ACMERR_NOTPOSSIBLE; 318 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) { 319 /* should check for codec only */ 320 if (padid->bEnabled && 321 acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) { 322 mmr = MSACM_Message(had, ACMDM_FORMAT_DETAILS, 323 (LPARAM)pafd, (LPARAM)fdwDetails); 324 acmDriverClose(had, 0); 325 if (mmr == MMSYSERR_NOERROR) break; 326 } 327 } 328 } else { 329 mmr = MSACM_Message(had, ACMDM_FORMAT_DETAILS, 330 (LPARAM)pafd, (LPARAM)fdwDetails); 331 } 332 break; 333 333 case ACM_FORMATDETAILSF_INDEX: 334 /* should check pafd->dwFormatIndex < aftd->cStandardFormats */335 mmr = MSACM_Message(had, ACMDM_FORMAT_DETAILS,336 (LPARAM)pafd, (LPARAM)fdwDetails);337 break;334 /* should check pafd->dwFormatIndex < aftd->cStandardFormats */ 335 mmr = MSACM_Message(had, ACMDM_FORMAT_DETAILS, 336 (LPARAM)pafd, (LPARAM)fdwDetails); 337 break; 338 338 default: 339 WARN("Unknown fdwDetails %08lx\n", fdwDetails);340 mmr = MMSYSERR_INVALFLAG;341 break;339 WARN("Unknown fdwDetails %08lx\n", fdwDetails); 340 mmr = MMSYSERR_INVALFLAG; 341 break; 342 342 } 343 343 344 344 if (mmr == MMSYSERR_NOERROR && pafd->szFormat[0] == (WCHAR)0) { 345 wsprintfW(pafd->szFormat, fmt1, pafd->pwfx->nSamplesPerSec);346 if (pafd->pwfx->wBitsPerSample) {347 wsprintfW(pafd->szFormat + lstrlenW(pafd->szFormat), fmt2, 348 pafd->pwfx->wBitsPerSample);349 }345 wsprintfW(pafd->szFormat, fmt1, pafd->pwfx->nSamplesPerSec); 346 if (pafd->pwfx->wBitsPerSample) { 347 wsprintfW(pafd->szFormat + lstrlenW(pafd->szFormat), fmt2, 348 pafd->pwfx->wBitsPerSample); 349 } 350 350 MultiByteToWideChar( CP_ACP, 0, (pafd->pwfx->nChannels == 1) ? "; Mono" : "; Stereo", -1, 351 351 pafd->szFormat + strlenW(pafd->szFormat), … … 358 358 359 359 struct MSACM_FormatEnumWtoA_Instance { 360 PACMFORMATDETAILSA pafda;361 DWORD dwInstance;362 ACMFORMATENUMCBA fnCallback;360 PACMFORMATDETAILSA pafda; 361 DWORD dwInstance; 362 ACMFORMATENUMCBA fnCallback; 363 363 }; 364 364 365 365 static BOOL CALLBACK MSACM_FormatEnumCallbackWtoA(HACMDRIVERID hadid, 366 PACMFORMATDETAILSW pafdw, 367 DWORD dwInstance, 368 DWORD fdwSupport)366 PACMFORMATDETAILSW pafdw, 367 DWORD dwInstance, 368 DWORD fdwSupport) 369 369 { 370 370 struct MSACM_FormatEnumWtoA_Instance* pafei; … … 372 372 pafei = (struct MSACM_FormatEnumWtoA_Instance*)dwInstance; 373 373 374 pafei->pafda->dwFormatIndex = pafdw->dwFormatIndex; 375 pafei->pafda->dwFormatTag = pafdw->dwFormatTag; 376 pafei->pafda->fdwSupport = pafdw->fdwSupport; 374 pafei->pafda->dwFormatIndex = pafdw->dwFormatIndex; 375 pafei->pafda->dwFormatTag = pafdw->dwFormatTag; 376 pafei->pafda->fdwSupport = pafdw->fdwSupport; 377 377 WideCharToMultiByte( CP_ACP, 0, pafdw->szFormat, -1, 378 378 pafei->pafda->szFormat, sizeof(pafei->pafda->szFormat), NULL, NULL ); 379 379 380 return (pafei->fnCallback)(hadid, pafei->pafda, 381 pafei->dwInstance, fdwSupport);380 return (pafei->fnCallback)(hadid, pafei->pafda, 381 pafei->dwInstance, fdwSupport); 382 382 } 383 383 … … 386 386 */ 387 387 MMRESULT WINAPI acmFormatEnumA(HACMDRIVER had, PACMFORMATDETAILSA pafda, 388 ACMFORMATENUMCBA fnCallback, DWORD dwInstance, 389 DWORD fdwEnum)390 { 391 ACMFORMATDETAILSW afdw;388 ACMFORMATENUMCBA fnCallback, DWORD dwInstance, 389 DWORD fdwEnum) 390 { 391 ACMFORMATDETAILSW afdw; 392 392 struct MSACM_FormatEnumWtoA_Instance afei; 393 393 … … 403 403 afei.fnCallback = fnCallback; 404 404 405 return acmFormatEnumW(had, &afdw, MSACM_FormatEnumCallbackWtoA, 406 (DWORD)&afei, fdwEnum);405 return acmFormatEnumW(had, &afdw, MSACM_FormatEnumCallbackWtoA, 406 (DWORD)&afei, fdwEnum); 407 407 } 408 408 … … 410 410 * acmFormatEnumW (MSACM32.28) 411 411 */ 412 static BOOL MSACM_FormatEnumHelper(PWINE_ACMDRIVERID padid, HACMDRIVER had, 413 PACMFORMATDETAILSW pafd, PWAVEFORMATEX pwfxRef, 414 ACMFORMATENUMCBW fnCallback, DWORD dwInstance, 415 DWORD fdwEnum)416 { 417 ACMDRIVERDETAILSW add;418 ACMFORMATTAGDETAILSW aftd;419 int i, j;412 static BOOL MSACM_FormatEnumHelper(PWINE_ACMDRIVERID padid, HACMDRIVER had, 413 PACMFORMATDETAILSW pafd, PWAVEFORMATEX pwfxRef, 414 ACMFORMATENUMCBW fnCallback, DWORD dwInstance, 415 DWORD fdwEnum) 416 { 417 ACMDRIVERDETAILSW add; 418 ACMFORMATTAGDETAILSW aftd; 419 int i, j; 420 420 421 421 add.cbStruct = sizeof(add); 422 422 423 423 if (acmDriverDetailsW((HACMDRIVERID)padid, &add, 0) != MMSYSERR_NOERROR) return FALSE; 424 424 425 425 for (i = 0; i < add.cFormatTags; i++) { 426 memset(&aftd, 0, sizeof(aftd));427 aftd.cbStruct = sizeof(aftd);428 aftd.dwFormatTagIndex = i;429 if (acmFormatTagDetailsW(had, &aftd, ACM_FORMATTAGDETAILSF_INDEX) != MMSYSERR_NOERROR)430 continue;431 432 if ((fdwEnum & ACM_FORMATENUMF_WFORMATTAG) && aftd.dwFormatTag != pwfxRef->wFormatTag)433 continue;434 435 for (j = 0; j < aftd.cStandardFormats; j++) {436 pafd->dwFormatIndex = j;437 pafd->dwFormatTag = aftd.dwFormatTag;438 if (acmFormatDetailsW(had, pafd, ACM_FORMATDETAILSF_INDEX) != MMSYSERR_NOERROR) 439 continue;440 441 if ((fdwEnum & ACM_FORMATENUMF_NCHANNELS) && 442 pafd->pwfx->nChannels != pwfxRef->nChannels)443 continue;444 if ((fdwEnum & ACM_FORMATENUMF_NSAMPLESPERSEC) && 445 pafd->pwfx->nSamplesPerSec != pwfxRef->nSamplesPerSec)446 continue;447 if ((fdwEnum & ACM_FORMATENUMF_WBITSPERSAMPLE) && 448 pafd->pwfx->wBitsPerSample != pwfxRef->wBitsPerSample)449 continue;450 if ((fdwEnum & ACM_FORMATENUMF_HARDWARE) &&451 !(pafd->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_HARDWARE))452 continue;453 454 /* more checks to be done on fdwEnum */455 456 if (!(fnCallback)((HACMDRIVERID)padid, pafd, dwInstance, add.fdwSupport))457 return FALSE; 458 }459 /* the "formats" used by the filters are also reported */426 memset(&aftd, 0, sizeof(aftd)); 427 aftd.cbStruct = sizeof(aftd); 428 aftd.dwFormatTagIndex = i; 429 if (acmFormatTagDetailsW(had, &aftd, ACM_FORMATTAGDETAILSF_INDEX) != MMSYSERR_NOERROR) 430 continue; 431 432 if ((fdwEnum & ACM_FORMATENUMF_WFORMATTAG) && aftd.dwFormatTag != pwfxRef->wFormatTag) 433 continue; 434 435 for (j = 0; j < aftd.cStandardFormats; j++) { 436 pafd->dwFormatIndex = j; 437 pafd->dwFormatTag = aftd.dwFormatTag; 438 if (acmFormatDetailsW(had, pafd, ACM_FORMATDETAILSF_INDEX) != MMSYSERR_NOERROR) 439 continue; 440 441 if ((fdwEnum & ACM_FORMATENUMF_NCHANNELS) && 442 pafd->pwfx->nChannels != pwfxRef->nChannels) 443 continue; 444 if ((fdwEnum & ACM_FORMATENUMF_NSAMPLESPERSEC) && 445 pafd->pwfx->nSamplesPerSec != pwfxRef->nSamplesPerSec) 446 continue; 447 if ((fdwEnum & ACM_FORMATENUMF_WBITSPERSAMPLE) && 448 pafd->pwfx->wBitsPerSample != pwfxRef->wBitsPerSample) 449 continue; 450 if ((fdwEnum & ACM_FORMATENUMF_HARDWARE) && 451 !(pafd->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_HARDWARE)) 452 continue; 453 454 /* more checks to be done on fdwEnum */ 455 456 if (!(fnCallback)((HACMDRIVERID)padid, pafd, dwInstance, add.fdwSupport)) 457 return FALSE; 458 } 459 /* the "formats" used by the filters are also reported */ 460 460 } 461 461 return TRUE; … … 465 465 466 466 MMRESULT WINAPI acmFormatEnumW(HACMDRIVER had, PACMFORMATDETAILSW pafd, 467 ACMFORMATENUMCBW fnCallback, DWORD dwInstance, 468 DWORD fdwEnum)469 { 470 PWINE_ACMDRIVERID padid;471 WAVEFORMATEX wfxRef;472 BOOL ret;467 ACMFORMATENUMCBW fnCallback, DWORD dwInstance, 468 DWORD fdwEnum) 469 { 470 PWINE_ACMDRIVERID padid; 471 WAVEFORMATEX wfxRef; 472 BOOL ret; 473 473 474 474 TRACE("(0x%08x, %p, %p, %ld, %ld)\n", 475 had, pafd, fnCallback, dwInstance, fdwEnum);475 had, pafd, fnCallback, dwInstance, fdwEnum); 476 476 477 477 if (pafd->cbStruct < sizeof(*pafd)) return MMSYSERR_INVALPARAM; 478 478 479 479 if (fdwEnum & (ACM_FORMATENUMF_WFORMATTAG|ACM_FORMATENUMF_NCHANNELS| 480 ACM_FORMATENUMF_NSAMPLESPERSEC|ACM_FORMATENUMF_WBITSPERSAMPLE|481 ACM_FORMATENUMF_CONVERT|ACM_FORMATENUMF_SUGGEST))480 ACM_FORMATENUMF_NSAMPLESPERSEC|ACM_FORMATENUMF_WBITSPERSAMPLE| 481 ACM_FORMATENUMF_CONVERT|ACM_FORMATENUMF_SUGGEST)) 482 482 wfxRef = *pafd->pwfx; 483 483 484 if ((fdwEnum & ACM_FORMATENUMF_HARDWARE) && 485 !(fdwEnum & (ACM_FORMATENUMF_INPUT|ACM_FORMATENUMF_OUTPUT)))486 return MMSYSERR_INVALPARAM;484 if ((fdwEnum & ACM_FORMATENUMF_HARDWARE) && 485 !(fdwEnum & (ACM_FORMATENUMF_INPUT|ACM_FORMATENUMF_OUTPUT))) 486 return MMSYSERR_INVALPARAM; 487 487 488 488 if ((fdwEnum & ACM_FORMATENUMF_WFORMATTAG) && 489 (pafd->dwFormatTag != pafd->pwfx->wFormatTag))490 return MMSYSERR_INVALPARAM;489 (pafd->dwFormatTag != pafd->pwfx->wFormatTag)) 490 return MMSYSERR_INVALPARAM; 491 491 492 492 if (fdwEnum & (ACM_FORMATENUMF_CONVERT|ACM_FORMATENUMF_SUGGEST| 493 ACM_FORMATENUMF_INPUT|ACM_FORMATENUMF_OUTPUT))494 FIXME("Unsupported fdwEnum values %08lx\n", fdwEnum);493 ACM_FORMATENUMF_INPUT|ACM_FORMATENUMF_OUTPUT)) 494 FIXME("Unsupported fdwEnum values %08lx\n", fdwEnum); 495 495 496 496 if (had) { 497 HACMDRIVERID hadid; 498 499 if (acmDriverID(had, &hadid, 0) != MMSYSERR_NOERROR) 500 return MMSYSERR_INVALHANDLE; 501 MSACM_FormatEnumHelper(MSACM_GetDriverID(hadid), had, pafd, &wfxRef, 502 fnCallback, dwInstance, fdwEnum); 497 HACMDRIVERID hadid; 498 499 if (acmDriverID(had, &hadid, 0) != MMSYSERR_NOERROR) 500 return MMSYSERR_INVALHANDLE; 501 MSACM_FormatEnumHelper(MSACM_GetDriverID(hadid), had, pafd, &wfxRef, 502 fnCallback, dwInstance, fdwEnum); 503 return MMSYSERR_NOERROR; 504 } 505 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) { 506 /* should check for codec only */ 507 if (!padid->bEnabled || acmDriverOpen(&had, (HACMDRIVERID)padid, 0) != MMSYSERR_NOERROR) 508 continue; 509 ret = MSACM_FormatEnumHelper(padid, had, pafd, &wfxRef, 510 fnCallback, dwInstance, fdwEnum); 511 acmDriverClose(had, 0); 512 if (!ret) break; 513 } 503 514 return MMSYSERR_NOERROR; 504 }505 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {506 /* should check for codec only */507 if (!padid->bEnabled || acmDriverOpen(&had, (HACMDRIVERID)padid, 0) != MMSYSERR_NOERROR)508 continue;509 ret = MSACM_FormatEnumHelper(padid, had, pafd, &wfxRef,510 fnCallback, dwInstance, fdwEnum);511 acmDriverClose(had, 0);512 if (!ret) break;513 }514 return MMSYSERR_NOERROR;515 515 } 516 516 … … 518 518 * acmFormatSuggest (MSACM32.29) 519 519 */ 520 MMRESULT WINAPI acmFormatSuggest(HACMDRIVER had, PWAVEFORMATEX pwfxSrc, 521 PWAVEFORMATEX pwfxDst, DWORD cbwfxDst, DWORD fdwSuggest)522 { 523 ACMDRVFORMATSUGGEST adfg;524 MMRESULT mmr;525 526 TRACE("(0x%08x, %p, %p, %ld, %ld)\n", 527 had, pwfxSrc, pwfxDst, cbwfxDst, fdwSuggest);520 MMRESULT WINAPI acmFormatSuggest(HACMDRIVER had, PWAVEFORMATEX pwfxSrc, 521 PWAVEFORMATEX pwfxDst, DWORD cbwfxDst, DWORD fdwSuggest) 522 { 523 ACMDRVFORMATSUGGEST adfg; 524 MMRESULT mmr; 525 526 TRACE("(0x%08x, %p, %p, %ld, %ld)\n", 527 had, pwfxSrc, pwfxDst, cbwfxDst, fdwSuggest); 528 528 529 529 if (fdwSuggest & ~(ACM_FORMATSUGGESTF_NCHANNELS|ACM_FORMATSUGGESTF_NSAMPLESPERSEC| 530 ACM_FORMATSUGGESTF_WBITSPERSAMPLE|ACM_FORMATSUGGESTF_WFORMATTAG))531 return MMSYSERR_INVALFLAG;530 ACM_FORMATSUGGESTF_WBITSPERSAMPLE|ACM_FORMATSUGGESTF_WFORMATTAG)) 531 return MMSYSERR_INVALFLAG; 532 532 533 533 adfg.cbStruct = sizeof(adfg); … … 535 535 adfg.pwfxSrc = pwfxSrc; 536 536 adfg.cbwfxSrc = (pwfxSrc->wFormatTag == WAVE_FORMAT_PCM) ? 537 sizeof(WAVEFORMATEX) : pwfxSrc->cbSize;537 sizeof(WAVEFORMATEX) : pwfxSrc->cbSize; 538 538 adfg.pwfxDst = pwfxDst; 539 539 adfg.cbwfxDst = cbwfxDst; 540 540 541 541 if (had == (HACMDRIVER)NULL) { 542 PWINE_ACMDRIVERIDpadid;543 544 /* MS doc says: ACM finds the best suggestion. 545 * Well, first found will be the "best"546 */547 mmr = ACMERR_NOTPOSSIBLE;548 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {549 /* should check for codec only */550 if (!padid->bEnabled ||551 acmDriverOpen(&had, (HACMDRIVERID)padid, 0) != MMSYSERR_NOERROR)552 continue;553 554 if (MSACM_Message(had, ACMDM_FORMAT_SUGGEST, 555 (LPARAM)&adfg, 0L) == MMSYSERR_NOERROR) {556 mmr = MMSYSERR_NOERROR;557 break;558 }559 acmDriverClose(had, 0);560 }542 PWINE_ACMDRIVERID padid; 543 544 /* MS doc says: ACM finds the best suggestion. 545 * Well, first found will be the "best" 546 */ 547 mmr = ACMERR_NOTPOSSIBLE; 548 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) { 549 /* should check for codec only */ 550 if (!padid->bEnabled || 551 acmDriverOpen(&had, (HACMDRIVERID)padid, 0) != MMSYSERR_NOERROR) 552 continue; 553 554 if (MSACM_Message(had, ACMDM_FORMAT_SUGGEST, 555 (LPARAM)&adfg, 0L) == MMSYSERR_NOERROR) { 556 mmr = MMSYSERR_NOERROR; 557 break; 558 } 559 acmDriverClose(had, 0); 560 } 561 561 } else { 562 mmr = MSACM_Message(had, ACMDM_FORMAT_SUGGEST, (LPARAM)&adfg, 0L);562 mmr = MSACM_Message(had, ACMDM_FORMAT_SUGGEST, (LPARAM)&adfg, 0L); 563 563 } 564 564 return mmr; … … 568 568 * acmFormatTagDetailsA (MSACM32.30) 569 569 */ 570 MMRESULT WINAPI acmFormatTagDetailsA(HACMDRIVER had, PACMFORMATTAGDETAILSA paftda, 571 DWORD fdwDetails)572 { 573 ACMFORMATTAGDETAILSW aftdw;574 MMRESULT mmr;570 MMRESULT WINAPI acmFormatTagDetailsA(HACMDRIVER had, PACMFORMATTAGDETAILSA paftda, 571 DWORD fdwDetails) 572 { 573 ACMFORMATTAGDETAILSW aftdw; 574 MMRESULT mmr; 575 575 576 576 memset(&aftdw, 0, sizeof(aftdw)); … … 581 581 mmr = acmFormatTagDetailsW(had, &aftdw, fdwDetails); 582 582 if (mmr == MMSYSERR_NOERROR) { 583 paftda->dwFormatTag = aftdw.dwFormatTag; 584 paftda->dwFormatTagIndex = aftdw.dwFormatTagIndex;585 paftda->cbFormatSize = aftdw.cbFormatSize; 586 paftda->fdwSupport = aftdw.fdwSupport; 587 paftda->cStandardFormats = aftdw.cStandardFormats; 583 paftda->dwFormatTag = aftdw.dwFormatTag; 584 paftda->dwFormatTagIndex = aftdw.dwFormatTagIndex; 585 paftda->cbFormatSize = aftdw.cbFormatSize; 586 paftda->fdwSupport = aftdw.fdwSupport; 587 paftda->cStandardFormats = aftdw.cStandardFormats; 588 588 WideCharToMultiByte( CP_ACP, 0, aftdw.szFormatTag, -1, paftda->szFormatTag, 589 589 sizeof(paftda->szFormatTag), NULL, NULL ); … … 595 595 * acmFormatTagDetailsW (MSACM32.31) 596 596 */ 597 MMRESULT WINAPI acmFormatTagDetailsW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd, 598 DWORD fdwDetails)599 { 600 PWINE_ACMDRIVERID padid;601 MMRESULT mmr;597 MMRESULT WINAPI acmFormatTagDetailsW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd, 598 DWORD fdwDetails) 599 { 600 PWINE_ACMDRIVERID padid; 601 MMRESULT mmr; 602 602 603 603 TRACE("(0x%08x, %p, %ld)\n", had, paftd, fdwDetails); 604 604 605 605 if (fdwDetails & ~(ACM_FORMATTAGDETAILSF_FORMATTAG|ACM_FORMATTAGDETAILSF_INDEX| 606 ACM_FORMATTAGDETAILSF_LARGESTSIZE))607 return MMSYSERR_INVALFLAG;606 ACM_FORMATTAGDETAILSF_LARGESTSIZE)) 607 return MMSYSERR_INVALFLAG; 608 608 609 609 switch (fdwDetails) { 610 610 case ACM_FORMATTAGDETAILSF_FORMATTAG: 611 if (had == (HACMDRIVER)NULL) {612 mmr = ACMERR_NOTPOSSIBLE;613 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {614 /* should check for codec only */615 if (padid->bEnabled && acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) {616 mmr = MSACM_Message(had, ACMDM_FORMATTAG_DETAILS,617 (LPARAM)paftd, (LPARAM)fdwDetails);618 acmDriverClose(had, 0);619 if (mmr == MMSYSERR_NOERROR) break;620 }621 }622 } else {623 mmr = MSACM_Message(had, ACMDM_FORMATTAG_DETAILS,624 (LPARAM)paftd, (LPARAM)fdwDetails);625 }626 break;611 if (had == (HACMDRIVER)NULL) { 612 mmr = ACMERR_NOTPOSSIBLE; 613 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) { 614 /* should check for codec only */ 615 if (padid->bEnabled && acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) { 616 mmr = MSACM_Message(had, ACMDM_FORMATTAG_DETAILS, 617 (LPARAM)paftd, (LPARAM)fdwDetails); 618 acmDriverClose(had, 0); 619 if (mmr == MMSYSERR_NOERROR) break; 620 } 621 } 622 } else { 623 mmr = MSACM_Message(had, ACMDM_FORMATTAG_DETAILS, 624 (LPARAM)paftd, (LPARAM)fdwDetails); 625 } 626 break; 627 627 628 628 case ACM_FORMATTAGDETAILSF_INDEX: 629 /* FIXME should check paftd->dwFormatTagIndex < add.cFormatTags */630 mmr = MSACM_Message(had, ACMDM_FORMATTAG_DETAILS,631 (LPARAM)paftd, (LPARAM)fdwDetails);632 break;629 /* FIXME should check paftd->dwFormatTagIndex < add.cFormatTags */ 630 mmr = MSACM_Message(had, ACMDM_FORMATTAG_DETAILS, 631 (LPARAM)paftd, (LPARAM)fdwDetails); 632 break; 633 633 634 634 case ACM_FORMATTAGDETAILSF_LARGESTSIZE: 635 if (had == (HACMDRIVER)NULL) {636 ACMFORMATTAGDETAILSWtmp;637 DWORDft = paftd->dwFormatTag;638 639 mmr = ACMERR_NOTPOSSIBLE;640 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {641 /* should check for codec only */642 if (padid->bEnabled && 643 acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) {644 645 memset(&tmp, 0, sizeof(tmp));646 tmp.cbStruct = sizeof(tmp);647 tmp.dwFormatTag = ft;648 649 if (MSACM_Message(had, ACMDM_FORMATTAG_DETAILS,650 (LPARAM)&tmp, 651 (LPARAM)fdwDetails) == MMSYSERR_NOERROR) {652 if (mmr == ACMERR_NOTPOSSIBLE ||653 paftd->cbFormatSize < tmp.cbFormatSize) {654 *paftd = tmp;655 mmr = MMSYSERR_NOERROR;656 } 657 }658 acmDriverClose(had, 0);659 }660 }661 } else {662 mmr = MSACM_Message(had, ACMDM_FORMATTAG_DETAILS,663 (LPARAM)paftd, (LPARAM)fdwDetails);664 }665 break;635 if (had == (HACMDRIVER)NULL) { 636 ACMFORMATTAGDETAILSW tmp; 637 DWORD ft = paftd->dwFormatTag; 638 639 mmr = ACMERR_NOTPOSSIBLE; 640 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) { 641 /* should check for codec only */ 642 if (padid->bEnabled && 643 acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) { 644 645 memset(&tmp, 0, sizeof(tmp)); 646 tmp.cbStruct = sizeof(tmp); 647 tmp.dwFormatTag = ft; 648 649 if (MSACM_Message(had, ACMDM_FORMATTAG_DETAILS, 650 (LPARAM)&tmp, 651 (LPARAM)fdwDetails) == MMSYSERR_NOERROR) { 652 if (mmr == ACMERR_NOTPOSSIBLE || 653 paftd->cbFormatSize < tmp.cbFormatSize) { 654 *paftd = tmp; 655 mmr = MMSYSERR_NOERROR; 656 } 657 } 658 acmDriverClose(had, 0); 659 } 660 } 661 } else { 662 mmr = MSACM_Message(had, ACMDM_FORMATTAG_DETAILS, 663 (LPARAM)paftd, (LPARAM)fdwDetails); 664 } 665 break; 666 666 667 667 default: 668 WARN("Unsupported fdwDetails=%08lx\n", fdwDetails);669 mmr = MMSYSERR_ERROR;670 } 671 672 if (mmr == MMSYSERR_NOERROR && 673 paftd->dwFormatTag == WAVE_FORMAT_PCM && paftd->szFormatTag[0] == 0)668 WARN("Unsupported fdwDetails=%08lx\n", fdwDetails); 669 mmr = MMSYSERR_ERROR; 670 } 671 672 if (mmr == MMSYSERR_NOERROR && 673 paftd->dwFormatTag == WAVE_FORMAT_PCM && paftd->szFormatTag[0] == 0) 674 674 MultiByteToWideChar( CP_ACP, 0, "PCM", -1, paftd->szFormatTag, 675 675 sizeof(paftd->szFormatTag)/sizeof(WCHAR) ); … … 679 679 680 680 struct MSACM_FormatTagEnumWtoA_Instance { 681 PACMFORMATTAGDETAILSA paftda;682 DWORD dwInstance;683 ACMFORMATTAGENUMCBA fnCallback;681 PACMFORMATTAGDETAILSA paftda; 682 DWORD dwInstance; 683 ACMFORMATTAGENUMCBA fnCallback; 684 684 }; 685 685 686 686 static BOOL CALLBACK MSACM_FormatTagEnumCallbackWtoA(HACMDRIVERID hadid, 687 PACMFORMATTAGDETAILSW paftdw, 688 DWORD dwInstance, 689 DWORD fdwSupport)687 PACMFORMATTAGDETAILSW paftdw, 688 DWORD dwInstance, 689 DWORD fdwSupport) 690 690 { 691 691 struct MSACM_FormatTagEnumWtoA_Instance* paftei; … … 693 693 paftei = (struct MSACM_FormatTagEnumWtoA_Instance*)dwInstance; 694 694 695 paftei->paftda->dwFormatTagIndex = paftdw->dwFormatTagIndex; 696 paftei->paftda->dwFormatTag = paftdw->dwFormatTag; 697 paftei->paftda->cbFormatSize = paftdw->cbFormatSize; 698 paftei->paftda->fdwSupport = paftdw->fdwSupport; 699 paftei->paftda->cStandardFormats = paftdw->cStandardFormats; 695 paftei->paftda->dwFormatTagIndex = paftdw->dwFormatTagIndex; 696 paftei->paftda->dwFormatTag = paftdw->dwFormatTag; 697 paftei->paftda->cbFormatSize = paftdw->cbFormatSize; 698 paftei->paftda->fdwSupport = paftdw->fdwSupport; 699 paftei->paftda->cStandardFormats = paftdw->cStandardFormats; 700 700 WideCharToMultiByte( CP_ACP, 0, paftdw->szFormatTag, -1, paftei->paftda->szFormatTag, 701 701 sizeof(paftei->paftda->szFormatTag), NULL, NULL ); 702 702 703 return (paftei->fnCallback)(hadid, paftei->paftda, 704 paftei->dwInstance, fdwSupport);703 return (paftei->fnCallback)(hadid, paftei->paftda, 704 paftei->dwInstance, fdwSupport); 705 705 } 706 706 … … 709 709 */ 710 710 MMRESULT WINAPI acmFormatTagEnumA(HACMDRIVER had, PACMFORMATTAGDETAILSA paftda, 711 ACMFORMATTAGENUMCBA fnCallback, DWORD dwInstance, 712 DWORD fdwEnum)713 { 714 ACMFORMATTAGDETAILSW aftdw;711 ACMFORMATTAGENUMCBA fnCallback, DWORD dwInstance, 712 DWORD fdwEnum) 713 { 714 ACMFORMATTAGDETAILSW aftdw; 715 715 struct MSACM_FormatTagEnumWtoA_Instance aftei; 716 716 … … 724 724 aftei.fnCallback = fnCallback; 725 725 726 return acmFormatTagEnumW(had, &aftdw, MSACM_FormatTagEnumCallbackWtoA, 727 (DWORD)&aftei, fdwEnum);726 return acmFormatTagEnumW(had, &aftdw, MSACM_FormatTagEnumCallbackWtoA, 727 (DWORD)&aftei, fdwEnum); 728 728 } 729 729 … … 732 732 */ 733 733 MMRESULT WINAPI acmFormatTagEnumW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd, 734 ACMFORMATTAGENUMCBW fnCallback, DWORD dwInstance, 735 DWORD fdwEnum)736 { 737 PWINE_ACMDRIVERID padid;738 ACMDRIVERDETAILSW add;739 int i;740 BOOL bPcmDone = FALSE;734 ACMFORMATTAGENUMCBW fnCallback, DWORD dwInstance, 735 DWORD fdwEnum) 736 { 737 PWINE_ACMDRIVERID padid; 738 ACMDRIVERDETAILSW add; 739 int i; 740 BOOL bPcmDone = FALSE; 741 741 742 742 TRACE("(0x%08x, %p, %p, %ld, %ld)\n", 743 had, paftd, fnCallback, dwInstance, fdwEnum); 743 had, paftd, fnCallback, dwInstance, fdwEnum); 744 744 745 745 if (paftd->cbStruct < sizeof(*paftd)) return MMSYSERR_INVALPARAM; 746 746 747 747 if (had) FIXME("had != NULL, not supported\n"); 748 748 749 749 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) { 750 /* should check for codec only */751 if (padid->bEnabled && acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == MMSYSERR_NOERROR) {752 add.cbStruct = sizeof(add);753 754 if (acmDriverDetailsW((HACMDRIVERID)padid, &add, 0) == MMSYSERR_NOERROR) {755 for (i = 0; i < add.cFormatTags; i++) {756 paftd->dwFormatTagIndex = i;757 if (acmFormatTagDetailsW(had, paftd, ACM_FORMATTAGDETAILSF_INDEX) == MMSYSERR_NOERROR) {758 if (paftd->dwFormatTag == WAVE_FORMAT_PCM) {759 /* FIXME (EPP): I'm not sure this is the correct 760 * algorithm (should make more sense to apply the same761 * for all already loaded formats, but this will do 762 * for now763 */764 if (bPcmDone) continue;765 bPcmDone = TRUE;766 }767 if (!(fnCallback)((HACMDRIVERID)padid, paftd, dwInstance, 768 add.fdwSupport)) {769 padid = NULL;770 break;771 }772 }773 }774 }775 }776 acmDriverClose(had, 0);750 /* should check for codec only */ 751 if (padid->bEnabled && acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == MMSYSERR_NOERROR) { 752 add.cbStruct = sizeof(add); 753 754 if (acmDriverDetailsW((HACMDRIVERID)padid, &add, 0) == MMSYSERR_NOERROR) { 755 for (i = 0; i < add.cFormatTags; i++) { 756 paftd->dwFormatTagIndex = i; 757 if (acmFormatTagDetailsW(had, paftd, ACM_FORMATTAGDETAILSF_INDEX) == MMSYSERR_NOERROR) { 758 if (paftd->dwFormatTag == WAVE_FORMAT_PCM) { 759 /* FIXME (EPP): I'm not sure this is the correct 760 * algorithm (should make more sense to apply the same 761 * for all already loaded formats, but this will do 762 * for now 763 */ 764 if (bPcmDone) continue; 765 bPcmDone = TRUE; 766 } 767 if (!(fnCallback)((HACMDRIVERID)padid, paftd, dwInstance, 768 add.fdwSupport)) { 769 padid = NULL; 770 break; 771 } 772 } 773 } 774 } 775 } 776 acmDriverClose(had, 0); 777 777 } 778 778 return MMSYSERR_NOERROR; -
trunk/src/msacm32/initterm.cpp
r6648 r6712 1 /* $Id: initterm.cpp,v 1.7 2001-09-05 13:11:25 bird Exp $ 2 * 1 /* 3 2 * DLL entry point 4 3 * … … 54 53 case DLL_THREAD_ATTACH: 55 54 case DLL_THREAD_DETACH: 56 return MSACM32_LibMain(hinstDLL, fdwReason, fImpLoad);55 return MSACM32_LibMain(hinstDLL, fdwReason, fImpLoad); 57 56 58 57 case DLL_PROCESS_DETACH: 59 MSACM32_LibMain(hinstDLL, fdwReason, fImpLoad);60 ctordtorTerm();61 return TRUE;58 MSACM32_LibMain(hinstDLL, fdwReason, fImpLoad); 59 ctordtorTerm(); 60 return TRUE; 62 61 } 63 62 return FALSE; … … 89 88 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/ 90 89 91 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab);92 if(dllHandle == 0) 93 return 0UL;90 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab); 91 if(dllHandle == 0) 92 return 0UL; 94 93 95 94 break; 96 95 case 1 : 97 96 if(dllHandle) { 98 UnregisterLxDll(dllHandle);97 UnregisterLxDll(dllHandle); 99 98 } 100 99 break; -
trunk/src/msacm32/internal.c
r6648 r6712 1 1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */ 2 /* $Id: internal.c,v 1.2 2001-09-05 13:11:26 bird Exp $ */ 2 3 3 /* 4 4 * MSACM32 library 5 5 * 6 6 * Copyright 1998 Patrik Stridvall 7 * 1999Eric Pouech7 * 1999 Eric Pouech 8 8 */ 9 9 … … 34 34 35 35 /*********************************************************************** 36 * MSACM_RegisterDriver() 36 * MSACM_RegisterDriver() 37 37 */ 38 38 PWINE_ACMDRIVERID MSACM_RegisterDriver(LPSTR pszDriverAlias, LPSTR pszFileName, 39 HINSTANCE hinstModule)40 { 39 HINSTANCE hinstModule) 40 { 41 41 PWINE_ACMDRIVERID padid; 42 42 … … 64 64 padid->pPrevACMDriverID = MSACM_pLastACMDriverID; 65 65 if (MSACM_pLastACMDriverID) 66 MSACM_pLastACMDriverID->pNextACMDriverID = padid;66 MSACM_pLastACMDriverID->pNextACMDriverID = padid; 67 67 MSACM_pLastACMDriverID = padid; 68 68 if (!MSACM_pFirstACMDriverID) 69 MSACM_pFirstACMDriverID = padid;70 69 MSACM_pFirstACMDriverID = padid; 70 71 71 return padid; 72 72 } 73 73 74 74 /*********************************************************************** 75 * MSACM_RegisterAllDrivers() 75 * MSACM_RegisterAllDrivers() 76 76 */ 77 77 void MSACM_RegisterAllDrivers(void) … … 80 80 DWORD dwBufferLength; 81 81 82 /* FIXME 82 /* FIXME 83 83 * What if the user edits system.ini while the program is running? 84 84 * Does Windows handle that? 85 85 */ 86 86 if (MSACM_pFirstACMDriverID) 87 return;88 87 return; 88 89 89 /* FIXME: Do not work! How do I determine the section length? */ 90 90 dwBufferLength = 1024; 91 /* EPP GetPrivateProfileSectionA("drivers32", NULL, 0, "system.ini"); */92 91 /* EPP GetPrivateProfileSectionA("drivers32", NULL, 0, "system.ini"); */ 92 93 93 pszBuffer = (LPSTR) HeapAlloc(MSACM_hHeap, 0, dwBufferLength); 94 94 if (GetPrivateProfileSectionA("drivers32", pszBuffer, dwBufferLength, "system.ini")) { 95 char* s = pszBuffer; 96 while (*s) { 97 if (!strncasecmp("MSACM.", s, 6)) { 98 char *s2 = s; 99 while (*s2 != '\0' && *s2 != '=') s2++; 100 if (*s2) { 101 *s2 = '\0'; 102 MSACM_RegisterDriver(s, s2 + 1, 0); 103 *s2 = '='; 104 } 105 } 106 s += strlen(s) + 1; /* Either next char or \0 */ 95 char* s = pszBuffer; 96 while (*s) { 97 if (!strncasecmp("MSACM.", s, 6)) { 98 char *s2 = s; 99 while (*s2 != '\0' && *s2 != '=') s2++; 100 if (*s2) { 101 *s2 = '\0'; 102 MSACM_RegisterDriver(s, s2 + 1, 0); 103 *s2 = '='; 104 } 105 } 106 s += strlen(s) + 1; /* Either next char or \0 */ 107 } 107 108 } 108 } 109 109 110 110 HeapFree(MSACM_hHeap, 0, pszBuffer); 111 111 … … 119 119 { 120 120 PWINE_ACMDRIVERID pNextACMDriverID; 121 121 122 122 while (p->pACMDriverList) 123 acmDriverClose((HACMDRIVER) p->pACMDriverList, 0);124 123 acmDriverClose((HACMDRIVER) p->pACMDriverList, 0); 124 125 125 if (p->pszDriverAlias) 126 HeapFree(MSACM_hHeap, 0, p->pszDriverAlias);126 HeapFree(MSACM_hHeap, 0, p->pszDriverAlias); 127 127 if (p->pszFileName) 128 HeapFree(MSACM_hHeap, 0, p->pszFileName);129 128 HeapFree(MSACM_hHeap, 0, p->pszFileName); 129 130 130 if (p == MSACM_pFirstACMDriverID) 131 MSACM_pFirstACMDriverID = p->pNextACMDriverID;131 MSACM_pFirstACMDriverID = p->pNextACMDriverID; 132 132 if (p == MSACM_pLastACMDriverID) 133 MSACM_pLastACMDriverID = p->pPrevACMDriverID;133 MSACM_pLastACMDriverID = p->pPrevACMDriverID; 134 134 135 135 if (p->pPrevACMDriverID) 136 p->pPrevACMDriverID->pNextACMDriverID = p->pNextACMDriverID;136 p->pPrevACMDriverID->pNextACMDriverID = p->pNextACMDriverID; 137 137 if (p->pNextACMDriverID) 138 p->pNextACMDriverID->pPrevACMDriverID = p->pPrevACMDriverID;139 138 p->pNextACMDriverID->pPrevACMDriverID = p->pPrevACMDriverID; 139 140 140 pNextACMDriverID = p->pNextACMDriverID; 141 141 142 142 HeapFree(MSACM_hHeap, 0, p); 143 143 144 144 return pNextACMDriverID; 145 145 } … … 162 162 PWINE_ACMOBJ MSACM_GetObj(HACMOBJ hObj, DWORD type) 163 163 { 164 PWINE_ACMOBJ pao = (PWINE_ACMOBJ)hObj;164 PWINE_ACMOBJ pao = (PWINE_ACMOBJ)hObj; 165 165 166 166 if (pao == NULL || IsBadReadPtr(pao, sizeof(WINE_ACMOBJ)) || 167 ((type != WINE_ACMOBJ_DONTCARE) && (type != pao->dwType)))168 return NULL;167 ((type != WINE_ACMOBJ_DONTCARE) && (type != pao->dwType))) 168 return NULL; 169 169 return pao; 170 170 } 171 171 172 172 /*********************************************************************** 173 * MSACM_GetDriverID() 173 * MSACM_GetDriverID() 174 174 */ 175 175 PWINE_ACMDRIVERID MSACM_GetDriverID(HACMDRIVERID hDriverID) … … 191 191 MMRESULT MSACM_Message(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARAM lParam2) 192 192 { 193 PWINE_ACMDRIVER pad = MSACM_GetDriver(had);193 PWINE_ACMDRIVER pad = MSACM_GetDriver(had); 194 194 195 195 return pad ? SendDriverMessage(pad->hDrvr, uMsg, lParam1, lParam2) : MMSYSERR_INVALHANDLE; -
trunk/src/msacm32/msacm32_main.c
r6648 r6712 1 1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */ 2 /* $Id: msacm32_main.c,v 1.2 2001-09-05 13:11:26 bird Exp $ */ 2 3 3 /* 4 4 * MSACM32 library 5 5 * 6 6 * Copyright 1998 Patrik Stridvall 7 * 1999Eric Pouech7 * 1999 Eric Pouech 8 8 */ 9 9 … … 17 17 18 18 DEFAULT_DEBUG_CHANNEL(msacm); 19 19 20 20 /**********************************************************************/ 21 22 HINSTANCE MSACM_hInstance32 = 0;21 22 HINSTANCE MSACM_hInstance32 = 0; 23 23 24 24 /*********************************************************************** 25 * MSACM_LibMain (MSACM32.init) 25 * MSACM_LibMain (MSACM32.init) 26 26 */ 27 27 BOOL WINAPI MSACM32_LibMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved) … … 34 34 MSACM_hInstance32 = hInstDLL; 35 35 MSACM_RegisterAllDrivers(); 36 break;36 break; 37 37 case DLL_PROCESS_DETACH: 38 38 MSACM_UnregisterAllDrivers(); … … 40 40 MSACM_hHeap = (HANDLE) NULL; 41 41 MSACM_hInstance32 = (HINSTANCE)NULL; 42 break;42 break; 43 43 case DLL_THREAD_ATTACH: 44 break;44 break; 45 45 case DLL_THREAD_DETACH: 46 break;46 break; 47 47 default: 48 break;48 break; 49 49 } 50 50 return TRUE; … … 67 67 { 68 68 case VER_PLATFORM_WIN32_NT: 69 return 0x04000565; /* 4.0.1381 */69 return 0x04000565; /* 4.0.1381 */ 70 70 default: 71 71 FIXME("%ld not supported",version.dwPlatformId); 72 72 case VER_PLATFORM_WIN32_WINDOWS: 73 return 0x04000000; /* 4.0.0 */73 return 0x04000000; /* 4.0.0 */ 74 74 } 75 75 } … … 86 86 MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric) 87 87 { 88 PWINE_ACMOBJ pao = MSACM_GetObj(hao, WINE_ACMOBJ_DONTCARE);89 BOOL bLocal = TRUE;90 PWINE_ACMDRIVERID padid;91 DWORD val = 0;92 MMRESULT mmr = MMSYSERR_NOERROR;88 PWINE_ACMOBJ pao = MSACM_GetObj(hao, WINE_ACMOBJ_DONTCARE); 89 BOOL bLocal = TRUE; 90 PWINE_ACMDRIVERID padid; 91 DWORD val = 0; 92 MMRESULT mmr = MMSYSERR_NOERROR; 93 93 94 94 TRACE("(0x%08x, %d, %p);\n", hao, uMetric, pMetric); 95 95 96 96 switch (uMetric) { 97 97 case ACM_METRIC_COUNT_DRIVERS: 98 bLocal = FALSE;99 /* fall thru */98 bLocal = FALSE; 99 /* fall thru */ 100 100 case ACM_METRIC_COUNT_LOCAL_DRIVERS: 101 if (!pao)102 return MMSYSERR_INVALHANDLE;103 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)104 if (padid->bEnabled /* && (local(padid) || !bLocal) */)105 val++;106 *(LPDWORD)pMetric = val;107 break;101 if (!pao) 102 return MMSYSERR_INVALHANDLE; 103 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) 104 if (padid->bEnabled /* && (local(padid) || !bLocal) */) 105 val++; 106 *(LPDWORD)pMetric = val; 107 break; 108 108 109 109 case ACM_METRIC_COUNT_CODECS: 110 if (!pao)111 return MMSYSERR_INVALHANDLE;112 bLocal = FALSE;113 /* fall thru */110 if (!pao) 111 return MMSYSERR_INVALHANDLE; 112 bLocal = FALSE; 113 /* fall thru */ 114 114 case ACM_METRIC_COUNT_LOCAL_CODECS: 115 /* FIXME: don't know how to differentiate codec, converters & filters yet */116 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)117 if (padid->bEnabled /* && (local(padid) || !bLocal) */)118 val++;119 *(LPDWORD)pMetric = val;120 break;115 /* FIXME: don't know how to differentiate codec, converters & filters yet */ 116 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) 117 if (padid->bEnabled /* && (local(padid) || !bLocal) */) 118 val++; 119 *(LPDWORD)pMetric = val; 120 break; 121 121 122 122 case ACM_METRIC_COUNT_CONVERTERS: 123 bLocal = FALSE;124 /* fall thru */123 bLocal = FALSE; 124 /* fall thru */ 125 125 case ACM_METRIC_COUNT_LOCAL_CONVERTERS: 126 /* FIXME: don't know how to differentiate codec, converters & filters yet */127 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)128 if (padid->bEnabled /* && (local(padid) || !bLocal) */)129 val++;130 *(LPDWORD)pMetric = val;131 break;126 /* FIXME: don't know how to differentiate codec, converters & filters yet */ 127 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) 128 if (padid->bEnabled /* && (local(padid) || !bLocal) */) 129 val++; 130 *(LPDWORD)pMetric = val; 131 break; 132 132 133 133 case ACM_METRIC_COUNT_FILTERS: 134 bLocal = FALSE;135 /* fall thru */134 bLocal = FALSE; 135 /* fall thru */ 136 136 case ACM_METRIC_COUNT_LOCAL_FILTERS: 137 /* FIXME: don't know how to differentiate codec, converters & filters yet */138 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)139 if (padid->bEnabled /* && (local(padid) || !bLocal) */)140 val++;141 *(LPDWORD)pMetric = val;142 break;137 /* FIXME: don't know how to differentiate codec, converters & filters yet */ 138 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) 139 if (padid->bEnabled /* && (local(padid) || !bLocal) */) 140 val++; 141 *(LPDWORD)pMetric = val; 142 break; 143 143 144 144 case ACM_METRIC_COUNT_DISABLED: 145 bLocal = FALSE;146 /* fall thru */145 bLocal = FALSE; 146 /* fall thru */ 147 147 case ACM_METRIC_COUNT_LOCAL_DISABLED: 148 if (!pao) 149 return MMSYSERR_INVALHANDLE; 150 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) 151 if (!padid->bEnabled /* && (local(padid) || !bLocal) */) 152 val++; 153 *(LPDWORD)pMetric = val; 154 break; 148 if (!pao) 149 return MMSYSERR_INVALHANDLE; 150 for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) 151 if (!padid->bEnabled /* && (local(padid) || !bLocal) */) 152 val++; 153 *(LPDWORD)pMetric = val; 154 break; 155 156 case ACM_METRIC_MAX_SIZE_FORMAT: 157 { 158 ACMFORMATTAGDETAILSW aftd; 155 159 156 case ACM_METRIC_MAX_SIZE_FORMAT: 157 { 158 ACMFORMATTAGDETAILSW aftd; 160 aftd.cbStruct = sizeof(aftd); 161 aftd.dwFormatTag = WAVE_FORMAT_UNKNOWN; 159 162 160 aftd.cbStruct = sizeof(aftd); 161 aftd.dwFormatTag = WAVE_FORMAT_UNKNOWN; 162 163 if (hao == (HACMOBJ)NULL) { 164 mmr = acmFormatTagDetailsW((HACMDRIVER)NULL, &aftd, ACM_FORMATTAGDETAILSF_LARGESTSIZE); 165 } else if (MSACM_GetObj(hao, WINE_ACMOBJ_DRIVER)) { 166 mmr = acmFormatTagDetailsW((HACMDRIVER)hao, &aftd, ACM_FORMATTAGDETAILSF_LARGESTSIZE); 167 } else if (MSACM_GetObj(hao, WINE_ACMOBJ_DRIVERID)) { 168 HACMDRIVER had; 169 170 if (acmDriverOpen(&had, (HACMDRIVERID)hao, 0) == 0) { 171 mmr = acmFormatTagDetailsW((HACMDRIVER)hao, &aftd, ACM_FORMATTAGDETAILSF_LARGESTSIZE); 172 acmDriverClose(had, 0); 173 } 174 } else { 175 mmr = MMSYSERR_INVALHANDLE; 176 } 177 if (mmr == MMSYSERR_NOERROR) *(LPDWORD)pMetric = aftd.cbFormatSize; 178 } 163 if (hao == (HACMOBJ)NULL) { 164 mmr = acmFormatTagDetailsW((HACMDRIVER)NULL, &aftd, ACM_FORMATTAGDETAILSF_LARGESTSIZE); 165 } else if (MSACM_GetObj(hao, WINE_ACMOBJ_DRIVER)) { 166 mmr = acmFormatTagDetailsW((HACMDRIVER)hao, &aftd, ACM_FORMATTAGDETAILSF_LARGESTSIZE); 167 } else if (MSACM_GetObj(hao, WINE_ACMOBJ_DRIVERID)) { 168 HACMDRIVER had; 169 170 if (acmDriverOpen(&had, (HACMDRIVERID)hao, 0) == 0) { 171 mmr = acmFormatTagDetailsW((HACMDRIVER)hao, &aftd, ACM_FORMATTAGDETAILSF_LARGESTSIZE); 172 acmDriverClose(had, 0); 173 } 174 } else { 175 mmr = MMSYSERR_INVALHANDLE; 176 } 177 if (mmr == MMSYSERR_NOERROR) *(LPDWORD)pMetric = aftd.cbFormatSize; 178 } 179 179 break; 180 180 … … 186 186 case ACM_METRIC_DRIVER_PRIORITY: 187 187 default: 188 FIXME("(0x%08x, %d, %p): stub\n", hao, uMetric, pMetric);189 mmr = MMSYSERR_NOTSUPPORTED;188 FIXME("(0x%08x, %d, %p): stub\n", hao, uMetric, pMetric); 189 mmr = MMSYSERR_NOTSUPPORTED; 190 190 } 191 191 return mmr; -
trunk/src/msacm32/pcmconverter.c
r6648 r6712 1 1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */ 2 /* $Id: pcmconverter.c,v 1.2 2001-09-05 13:11:26 bird Exp $ */ 2 3 3 /* 4 4 * MSACM32 library 5 5 * 6 * Copyright 2000 Eric Pouech7 * 8 * FIXME / TODO list9 * + most of the computation should be done in fixed point arithmetic10 * instead of floating point (16 bits for integral part, and 16 bits11 * for fractional part for example)12 * + implement PCM_FormatSuggest function13 * + get rid of hack for PCM_DriverProc (msacm32.dll shouldn't export14 * a DriverProc, but this would require implementing a generic15 * embedded driver handling scheme in msacm32.dll which isn't done yet6 * Copyright 2000 Eric Pouech 7 * 8 * FIXME / TODO list 9 * + most of the computation should be done in fixed point arithmetic 10 * instead of floating point (16 bits for integral part, and 16 bits 11 * for fractional part for example) 12 * + implement PCM_FormatSuggest function 13 * + get rid of hack for PCM_DriverProc (msacm32.dll shouldn't export 14 * a DriverProc, but this would require implementing a generic 15 * embedded driver handling scheme in msacm32.dll which isn't done yet 16 16 */ 17 17 … … 35 35 * PCM_drvOpen 36 36 */ 37 static DWORDPCM_drvOpen(LPCSTR str)37 static DWORD PCM_drvOpen(LPCSTR str) 38 38 { 39 39 return 1; … … 43 43 * PCM_drvClose 44 44 */ 45 static DWORDPCM_drvClose(DWORD dwDevID)45 static DWORD PCM_drvClose(DWORD dwDevID) 46 46 { 47 47 return 1; 48 48 } 49 49 50 #define NUM_PCM_FORMATS(sizeof(PCM_Formats) / sizeof(PCM_Formats[0]))51 #define NUM_OF(a,b)(((a)+(b)-1)/(b))50 #define NUM_PCM_FORMATS (sizeof(PCM_Formats) / sizeof(PCM_Formats[0])) 51 #define NUM_OF(a,b) (((a)+(b)-1)/(b)) 52 52 53 53 /* flags for fdwDriver */ 54 #define PCM_RESAMPLE 154 #define PCM_RESAMPLE 1 55 55 56 56 /* data used while converting */ … … 58 58 /* conversion routine, depending if rate conversion is required */ 59 59 union { 60 void (*cvtKeepRate)(const unsigned char*, int, unsigned char*);61 void (*cvtChangeRate)(struct tagAcmPcmData*, const unsigned char*, 62 LPDWORD, unsigned char*, LPDWORD);60 void (*cvtKeepRate)(const unsigned char*, int, unsigned char*); 61 void (*cvtChangeRate)(struct tagAcmPcmData*, const unsigned char*, 62 LPDWORD, unsigned char*, LPDWORD); 63 63 } cvt; 64 64 /* the following fields are used only with rate conversion) */ 65 DWORD srcPos;/* position in source stream */66 double dstPos;/* position in destination stream */67 double dstIncr; /* value to increment dst stream when src stream68 is incremented by 1 */65 DWORD srcPos; /* position in source stream */ 66 double dstPos; /* position in destination stream */ 67 double dstIncr; /* value to increment dst stream when src stream 68 is incremented by 1 */ 69 69 /* last source stream value read */ 70 70 union { 71 unsigned char b;/* 8 bit value */72 short s;/* 16 bit value */71 unsigned char b; /* 8 bit value */ 72 short s; /* 16 bit value */ 73 73 } last[2]; /* two channels max (stereo) */ 74 74 } AcmPcmData; … … 77 77 * also helps given a unique index to each of the supported formats 78 78 */ 79 static struct {80 int nChannels;81 int nBits;82 int rate;79 static struct { 80 int nChannels; 81 int nBits; 82 int rate; 83 83 } PCM_Formats[] = { 84 84 {1, 8, 8000}, {2, 8, 8000}, {1, 16, 8000}, {2, 16, 8000}, … … 91 91 * PCM_GetFormatIndex 92 92 */ 93 static DWORDPCM_GetFormatIndex(LPWAVEFORMATEX wfx)93 static DWORD PCM_GetFormatIndex(LPWAVEFORMATEX wfx) 94 94 { 95 95 int i; 96 96 97 97 for (i = 0; i < NUM_PCM_FORMATS; i++) { 98 if (wfx->nChannels == PCM_Formats[i].nChannels &&99 wfx->nSamplesPerSec == PCM_Formats[i].rate &&100 wfx->wBitsPerSample == PCM_Formats[i].nBits)101 return i;98 if (wfx->nChannels == PCM_Formats[i].nChannels && 99 wfx->nSamplesPerSec == PCM_Formats[i].rate && 100 wfx->wBitsPerSample == PCM_Formats[i].nBits) 101 return i; 102 102 } 103 103 return 0xFFFFFFFF; … … 107 107 * 108 108 * parameters: 109 * + 8 bit unsigned vs 16 bit signed110 * + mono vs stereo (1 or 2 channels)111 * + sampling rate (8.0, 11.025, 22.05, 44.1 kHz are defined, but algo shall work112 * in all cases)109 * + 8 bit unsigned vs 16 bit signed 110 * + mono vs stereo (1 or 2 channels) 111 * + sampling rate (8.0, 11.025, 22.05, 44.1 kHz are defined, but algo shall work 112 * in all cases) 113 113 * 114 114 * mono => stereo: copy the same sample on Left & Right channels 115 115 * stereo =) mono: use the average value of samples from Left & Right channels 116 116 * resampling; we lookup for each destination sample the two source adjacent samples 117 * were src <= dst < src+1 (dst is increased by a fractional value which is118 * equivalent to the increment by one on src); then we use a linear119 * interpolation between src and src+1117 * were src <= dst < src+1 (dst is increased by a fractional value which is 118 * equivalent to the increment by one on src); then we use a linear 119 * interpolation between src and src+1 120 120 */ 121 121 … … 125 125 * Converts a 8 bit sample to a 16 bit one 126 126 */ 127 static inline short C816(unsigned char b) 127 static inline short C816(unsigned char b) 128 128 { 129 129 return (short)(b ^ 0x80) * 256; … … 135 135 * Converts a 16 bit sample to a 8 bit one (data loss !!) 136 136 */ 137 static inline unsigned char C168(short s) 137 static inline unsigned char C168(short s) 138 138 { 139 139 return HIBYTE(s) ^ (unsigned char)0x80; … … 164 164 * M16 165 165 * 166 * Convert the (l,r) 16 bit stereo sample into a 16 bit mono 166 * Convert the (l,r) 16 bit stereo sample into a 16 bit mono 167 167 * (takes the mid-point of the two values) 168 168 */ … … 175 175 * M8 176 176 * 177 * Convert the (l,r) 8 bit stereo sample into a 8 bit mono 177 * Convert the (l,r) 8 bit stereo sample into a 8 bit mono 178 178 * (takes the mid-point of the two values) 179 179 */ … … 194 194 */ 195 195 196 static void cvtMM88K(const unsigned char* src, int ns, unsigned char* dst)196 static void cvtMM88K(const unsigned char* src, int ns, unsigned char* dst) 197 197 { 198 198 memcpy(dst, src, ns); 199 199 } 200 200 201 static void cvtSS88K(const unsigned char* src, int ns, unsigned char* dst)201 static void cvtSS88K(const unsigned char* src, int ns, unsigned char* dst) 202 202 { 203 203 memcpy(dst, src, ns * 2); 204 204 } 205 205 206 static void cvtMM1616K(const unsigned char* src, int ns, unsigned char* dst)206 static void cvtMM1616K(const unsigned char* src, int ns, unsigned char* dst) 207 207 { 208 208 memcpy(dst, src, ns * 2); 209 209 } 210 210 211 static void cvtSS1616K(const unsigned char* src, int ns, unsigned char* dst)211 static void cvtSS1616K(const unsigned char* src, int ns, unsigned char* dst) 212 212 { 213 213 memcpy(dst, src, ns * 4); 214 214 } 215 215 216 static void cvtMS88K(const unsigned char* src, int ns, unsigned char* dst)217 { 218 while (ns--) { 219 *dst++ = *src;220 *dst++ = *src++;221 } 222 } 223 224 static void cvtMS816K(const unsigned char* src, int ns, unsigned char* dst)225 { 226 short v;227 228 while (ns--) { 229 v = C816(*src++);230 W16(dst, v);dst += 2;231 W16(dst, v);dst += 2;232 } 233 } 234 235 static void cvtMS168K(const unsigned char* src, int ns, unsigned char* dst)216 static void cvtMS88K(const unsigned char* src, int ns, unsigned char* dst) 217 { 218 while (ns--) { 219 *dst++ = *src; 220 *dst++ = *src++; 221 } 222 } 223 224 static void cvtMS816K(const unsigned char* src, int ns, unsigned char* dst) 225 { 226 short v; 227 228 while (ns--) { 229 v = C816(*src++); 230 W16(dst, v); dst += 2; 231 W16(dst, v); dst += 2; 232 } 233 } 234 235 static void cvtMS168K(const unsigned char* src, int ns, unsigned char* dst) 236 236 { 237 237 unsigned char v; 238 239 while (ns--) { 240 v = C168(R16(src));src += 2;241 *dst++ = v;242 *dst++ = v;243 } 244 } 245 246 static void cvtMS1616K(const unsigned char* src, int ns, unsigned char* dst)247 { 248 short v;249 250 while (ns--) { 251 v = R16(src);src += 2;252 W16(dst, v);dst += 2;253 W16(dst, v);dst += 2;254 } 255 } 256 257 static void cvtSM88K(const unsigned char* src, int ns, unsigned char* dst)258 { 259 while (ns--) { 260 *dst++ = M8(src[0], src[1]);261 src += 2;262 } 263 } 264 265 static void cvtSM816K(const unsigned char* src, int ns, unsigned char* dst)266 { 267 short v;268 269 while (ns--) { 270 v = M16(C816(src[0]), C816(src[1]));271 src += 2;272 W16(dst, v);dst += 2;273 } 274 } 275 276 static void cvtSM168K(const unsigned char* src, int ns, unsigned char* dst)277 { 278 while (ns--) { 279 *dst++ = C168(M16(R16(src), R16(src + 2)));280 src += 4;281 } 282 } 283 284 static void cvtSM1616K(const unsigned char* src, int ns, unsigned char* dst)285 { 286 while (ns--) { 287 W16(dst, M16(R16(src),R16(src+2)));dst += 2;288 src += 4;289 } 290 } 291 292 static void cvtMM816K(const unsigned char* src, int ns, unsigned char* dst)293 { 294 while (ns--) { 295 W16(dst, C816(*src++));dst += 2;296 } 297 } 298 299 static void cvtSS816K(const unsigned char* src, int ns, unsigned char* dst)300 { 301 while (ns--) { 302 W16(dst, C816(*src++));dst += 2;303 W16(dst, C816(*src++));dst += 2;304 } 305 } 306 307 static void cvtMM168K(const unsigned char* src, int ns, unsigned char* dst)308 { 309 while (ns--) { 310 *dst++ = C168(R16(src));src += 2;311 } 312 } 313 314 static void cvtSS168K(const unsigned char* src, int ns, unsigned char* dst)315 { 316 while (ns--) { 317 *dst++ = C168(R16(src));src += 2;318 *dst++ = C168(R16(src));src += 2;319 } 320 } 321 322 static void (*PCM_ConvertKeepRate[16])(const unsigned char*, int, unsigned char*) = {323 cvtSS88K, cvtSM88K, cvtMS88K, cvtMM88K,324 cvtSS816K, cvtSM816K, cvtMS816K, cvtMM816K,325 cvtSS168K, cvtSM168K, cvtMS168K, cvtMM168K,238 239 while (ns--) { 240 v = C168(R16(src)); src += 2; 241 *dst++ = v; 242 *dst++ = v; 243 } 244 } 245 246 static void cvtMS1616K(const unsigned char* src, int ns, unsigned char* dst) 247 { 248 short v; 249 250 while (ns--) { 251 v = R16(src); src += 2; 252 W16(dst, v); dst += 2; 253 W16(dst, v); dst += 2; 254 } 255 } 256 257 static void cvtSM88K(const unsigned char* src, int ns, unsigned char* dst) 258 { 259 while (ns--) { 260 *dst++ = M8(src[0], src[1]); 261 src += 2; 262 } 263 } 264 265 static void cvtSM816K(const unsigned char* src, int ns, unsigned char* dst) 266 { 267 short v; 268 269 while (ns--) { 270 v = M16(C816(src[0]), C816(src[1])); 271 src += 2; 272 W16(dst, v); dst += 2; 273 } 274 } 275 276 static void cvtSM168K(const unsigned char* src, int ns, unsigned char* dst) 277 { 278 while (ns--) { 279 *dst++ = C168(M16(R16(src), R16(src + 2))); 280 src += 4; 281 } 282 } 283 284 static void cvtSM1616K(const unsigned char* src, int ns, unsigned char* dst) 285 { 286 while (ns--) { 287 W16(dst, M16(R16(src),R16(src+2))); dst += 2; 288 src += 4; 289 } 290 } 291 292 static void cvtMM816K(const unsigned char* src, int ns, unsigned char* dst) 293 { 294 while (ns--) { 295 W16(dst, C816(*src++)); dst += 2; 296 } 297 } 298 299 static void cvtSS816K(const unsigned char* src, int ns, unsigned char* dst) 300 { 301 while (ns--) { 302 W16(dst, C816(*src++)); dst += 2; 303 W16(dst, C816(*src++)); dst += 2; 304 } 305 } 306 307 static void cvtMM168K(const unsigned char* src, int ns, unsigned char* dst) 308 { 309 while (ns--) { 310 *dst++ = C168(R16(src)); src += 2; 311 } 312 } 313 314 static void cvtSS168K(const unsigned char* src, int ns, unsigned char* dst) 315 { 316 while (ns--) { 317 *dst++ = C168(R16(src)); src += 2; 318 *dst++ = C168(R16(src)); src += 2; 319 } 320 } 321 322 static void (*PCM_ConvertKeepRate[16])(const unsigned char*, int, unsigned char*) = { 323 cvtSS88K, cvtSM88K, cvtMS88K, cvtMM88K, 324 cvtSS816K, cvtSM816K, cvtMS816K, cvtMM816K, 325 cvtSS168K, cvtSM168K, cvtMS168K, cvtMM168K, 326 326 cvtSS1616K, cvtSM1616K, cvtMS1616K, cvtMM1616K, 327 327 }; … … 333 333 * Linear interpolation is used 334 334 */ 335 static inline doubleI(double v1, double v2, double r)335 static inline double I(double v1, double v2, double r) 336 336 { 337 337 if (0.0 >= r || r > 1.0) FIXME("r!! %f\n", r); … … 339 339 } 340 340 341 static void cvtSS88C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc,342 unsigned char* dst, LPDWORD ndst)343 { 344 double r;345 346 while (*nsrc != 0 && *ndst != 0) { 347 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) {348 if (*nsrc == 0) return;349 apd->last[0].b = *src++;350 apd->last[1].b = *src++;351 apd->srcPos++;352 (*nsrc)--;353 }354 /* now do the interpolation */355 *dst++ = I(apd->last[0].b, src[0], r);356 *dst++ = I(apd->last[1].b, src[1], r);357 apd->dstPos += apd->dstIncr;358 (*ndst)--;341 static void cvtSS88C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, 342 unsigned char* dst, LPDWORD ndst) 343 { 344 double r; 345 346 while (*nsrc != 0 && *ndst != 0) { 347 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { 348 if (*nsrc == 0) return; 349 apd->last[0].b = *src++; 350 apd->last[1].b = *src++; 351 apd->srcPos++; 352 (*nsrc)--; 353 } 354 /* now do the interpolation */ 355 *dst++ = I(apd->last[0].b, src[0], r); 356 *dst++ = I(apd->last[1].b, src[1], r); 357 apd->dstPos += apd->dstIncr; 358 (*ndst)--; 359 359 } 360 360 } … … 368 368 * 369 369 */ 370 static void cvtSM88C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc,371 unsigned char* dst, LPDWORD ndst)372 { 373 double r;374 375 while (*nsrc != 0 && *ndst != 0) { 376 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) {377 if (*nsrc == 0) return;378 apd->last[0].b = *src++;379 apd->last[1].b = *src++;380 apd->srcPos++;381 (*nsrc)--;382 }383 /* now do the interpolation */384 *dst++ = I(M8(apd->last[0].b, apd->last[1].b), M8(src[0], src[1]), r);385 apd->dstPos += apd->dstIncr;386 (*ndst)--;387 } 388 } 389 390 static void cvtMS88C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc,391 unsigned char* dst, LPDWORD ndst)392 { 393 double r;394 395 while (*nsrc != 0 && *ndst != 0) { 396 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) {397 if (*nsrc == 0) return;398 apd->last[0].b = *src++;399 apd->srcPos++;400 (*nsrc)--;401 }402 /* now do the interpolation */403 dst[0] = dst[1] = I(apd->last[0].b, src[0], r);404 dst += 2;405 apd->dstPos += apd->dstIncr;406 (*ndst)--;407 } 408 } 409 410 static void cvtMM88C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc,411 unsigned char* dst, LPDWORD ndst)412 { 413 double r;414 415 while (*nsrc != 0 && *ndst != 0) { 416 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) {417 if (*nsrc == 0) return;418 apd->last[0].b = *src++;419 apd->srcPos++;420 (*nsrc)--;421 }422 /* now do the interpolation */423 *dst++ = I(apd->last[0].b, src[0], r);424 apd->dstPos += apd->dstIncr;425 (*ndst)--;426 } 427 } 428 429 static void cvtSS816C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc,430 unsigned char* dst, LPDWORD ndst)431 { 432 double r;433 434 while (*nsrc != 0 && *ndst != 0) { 435 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) {436 if (*nsrc == 0) return;437 apd->last[0].b = *src++;438 apd->last[1].b = *src++;439 apd->srcPos++;440 (*nsrc)--;441 }442 /* now do the interpolation */443 W16(dst, I(C816(apd->last[0].b), C816(src[0]), r));dst += 2;444 W16(dst, I(C816(apd->last[1].b), C816(src[1]), r));dst += 2;445 apd->dstPos += apd->dstIncr;446 (*ndst)--;447 } 448 } 449 450 static void cvtSM816C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc,451 unsigned char* dst, LPDWORD ndst)452 { 453 double r;454 455 while (*nsrc != 0 && *ndst != 0) { 456 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) {457 if (*nsrc == 0) return;458 apd->last[0].b = *src++;459 apd->last[1].b = *src++;460 apd->srcPos++;461 (*nsrc)--;462 }463 /* now do the interpolation */464 W16(dst, I(M16(C816(apd->last[0].b), C816(apd->last[1].b)),465 M16(C816(src[0]), C816(src[1])), r));466 dst += 2;467 apd->dstPos += apd->dstIncr;468 (*ndst)--;469 } 470 } 471 472 static void cvtMS816C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc,473 unsigned char* dst, LPDWORD ndst)474 { 475 double r;476 short v;477 478 while (*nsrc != 0 && *ndst != 0) { 479 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) {480 if (*nsrc == 0) return;481 apd->last[0].b = *src++;482 apd->srcPos++;483 (*nsrc)--;484 }485 /* now do the interpolation */486 v = I(C816(apd->last[0].b), C816(src[0]), r);487 W16(dst, v);dst += 2;488 W16(dst, v);dst += 2;489 apd->dstPos += apd->dstIncr;490 (*ndst)--;491 } 492 } 493 494 static void cvtMM816C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc,495 unsigned char* dst, LPDWORD ndst)496 { 497 double r;498 499 while (*nsrc != 0 && *ndst != 0) { 500 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) {501 if (*nsrc == 0) return;502 apd->last[0].b = *src++;503 apd->srcPos++;504 (*nsrc)--;505 }506 /* now do the interpolation */507 W16(dst, I(C816(apd->last[0].b), C816(src[0]), r));508 dst += 2;509 apd->dstPos += apd->dstIncr;510 (*ndst)--;511 } 512 } 513 514 static void cvtSS168C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc,515 unsigned char* dst, LPDWORD ndst)516 { 517 double r;518 519 while (*nsrc != 0 && *ndst != 0) { 520 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) {521 if (*nsrc == 0) return;522 apd->last[0].s = R16(src);src += 2;523 apd->last[1].s = R16(src);src += 2;524 apd->srcPos++;525 (*nsrc)--;526 }527 /* now do the interpolation */528 *dst++ = C168(I(apd->last[0].s, R16(src) , r));529 *dst++ = C168(I(apd->last[1].s, R16(src+2), r));530 apd->dstPos += apd->dstIncr;531 (*ndst)--;532 } 533 } 534 535 static void cvtSM168C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc,536 unsigned char* dst, LPDWORD ndst)537 { 538 double r;539 540 while (*nsrc != 0 && *ndst != 0) { 541 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) {542 if (*nsrc == 0) return;543 apd->last[0].s = R16(src);src += 2;544 apd->last[1].s = R16(src);src += 2;545 apd->srcPos++;546 (*nsrc)--;547 }548 /* now do the interpolation */549 *dst++ = C168(I(M16(apd->last[0].s, apd->last[1].s), 550 M16(R16(src), R16(src + 2)), r));551 apd->dstPos += apd->dstIncr;552 (*ndst)--;553 } 554 } 555 556 557 static void cvtMS168C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc,558 unsigned char* dst, LPDWORD ndst)559 { 560 double r;561 562 while (*nsrc != 0 && *ndst != 0) { 563 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) {564 if (*nsrc == 0) return;565 apd->last[0].s = R16(src);src += 2;566 apd->srcPos++;567 (*nsrc)--;568 }569 /* now do the interpolation */570 dst[0] = dst[1] = C168(I(apd->last[0].s, R16(src), r));dst += 2;571 apd->dstPos += apd->dstIncr;572 (*ndst)--;573 } 574 } 575 576 577 static void cvtMM168C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc,578 unsigned char* dst, LPDWORD ndst)579 { 580 double r;581 582 while (*nsrc != 0 && *ndst != 0) { 583 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) {584 if (*nsrc == 0) return;585 apd->last[0].s = R16(src);src += 2;586 apd->srcPos++;587 (*nsrc)--;588 }589 /* now do the interpolation */590 *dst++ = C168(I(apd->last[0].s, R16(src), r));591 apd->dstPos += apd->dstIncr;592 (*ndst)--;593 } 594 } 595 596 static void cvtSS1616C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc,597 unsigned char* dst, LPDWORD ndst)598 { 599 double r;600 601 while (*nsrc != 0 && *ndst != 0) { 602 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) {603 if (*nsrc == 0) return;604 apd->last[0].s = R16(src);src += 2;605 apd->last[1].s = R16(src);src += 2;606 apd->srcPos++;607 (*nsrc)--;608 }609 /* now do the interpolation */610 W16(dst, I(apd->last[0].s, R16(src) , r));dst += 2;611 W16(dst, I(apd->last[1].s, R16(src+2), r));dst += 2;612 apd->dstPos += apd->dstIncr;613 (*ndst)--;614 } 615 } 616 617 static void cvtSM1616C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc,618 unsigned char* dst, LPDWORD ndst)619 { 620 double r;621 622 while (*nsrc != 0 && *ndst != 0) { 623 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) {624 if (*nsrc == 0) return;625 apd->last[0].s = R16(src);src += 2;626 apd->last[1].s = R16(src);src += 2;627 apd->srcPos++;628 (*nsrc)--;629 }630 /* now do the interpolation */631 W16(dst, I(M16(apd->last[0].s, apd->last[1].s),632 M16(R16(src), R16(src+2)), r));633 dst += 2;634 apd->dstPos += apd->dstIncr;635 (*ndst)--;636 } 637 } 638 639 static void cvtMS1616C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc,640 unsigned char* dst, LPDWORD ndst)641 { 642 double r;643 short v;644 645 while (*nsrc != 0 && *ndst != 0) { 646 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) {647 if (*nsrc == 0) return;648 apd->last[0].s = R16(src);src += 2;649 apd->srcPos++;650 (*nsrc)--;651 }652 /* now do the interpolation */653 v = I(apd->last[0].s, R16(src), r);654 W16(dst, v);dst += 2;655 W16(dst, v);dst += 2;656 apd->dstPos += apd->dstIncr;657 (*ndst)--;658 } 659 } 660 661 static void cvtMM1616C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc,662 unsigned char* dst, LPDWORD ndst)663 { 664 double r;665 666 while (*nsrc != 0 && *ndst != 0) { 667 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) {668 if (*nsrc == 0) return;669 apd->last[0].s = R16(src);src += 2;670 apd->srcPos++;671 (*nsrc)--;672 }673 /* now do the interpolation */674 W16(dst, I(apd->last[0].s, R16(src), r));dst += 2;675 apd->dstPos += apd->dstIncr;676 (*ndst)--;677 } 678 } 679 680 static void (*PCM_ConvertChangeRate[16])(AcmPcmData* apd,681 const unsigned char* src, LPDWORD nsrc, 682 unsigned char* dst, LPDWORD ndst) = {370 static void cvtSM88C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, 371 unsigned char* dst, LPDWORD ndst) 372 { 373 double r; 374 375 while (*nsrc != 0 && *ndst != 0) { 376 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { 377 if (*nsrc == 0) return; 378 apd->last[0].b = *src++; 379 apd->last[1].b = *src++; 380 apd->srcPos++; 381 (*nsrc)--; 382 } 383 /* now do the interpolation */ 384 *dst++ = I(M8(apd->last[0].b, apd->last[1].b), M8(src[0], src[1]), r); 385 apd->dstPos += apd->dstIncr; 386 (*ndst)--; 387 } 388 } 389 390 static void cvtMS88C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, 391 unsigned char* dst, LPDWORD ndst) 392 { 393 double r; 394 395 while (*nsrc != 0 && *ndst != 0) { 396 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { 397 if (*nsrc == 0) return; 398 apd->last[0].b = *src++; 399 apd->srcPos++; 400 (*nsrc)--; 401 } 402 /* now do the interpolation */ 403 dst[0] = dst[1] = I(apd->last[0].b, src[0], r); 404 dst += 2; 405 apd->dstPos += apd->dstIncr; 406 (*ndst)--; 407 } 408 } 409 410 static void cvtMM88C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, 411 unsigned char* dst, LPDWORD ndst) 412 { 413 double r; 414 415 while (*nsrc != 0 && *ndst != 0) { 416 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { 417 if (*nsrc == 0) return; 418 apd->last[0].b = *src++; 419 apd->srcPos++; 420 (*nsrc)--; 421 } 422 /* now do the interpolation */ 423 *dst++ = I(apd->last[0].b, src[0], r); 424 apd->dstPos += apd->dstIncr; 425 (*ndst)--; 426 } 427 } 428 429 static void cvtSS816C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, 430 unsigned char* dst, LPDWORD ndst) 431 { 432 double r; 433 434 while (*nsrc != 0 && *ndst != 0) { 435 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { 436 if (*nsrc == 0) return; 437 apd->last[0].b = *src++; 438 apd->last[1].b = *src++; 439 apd->srcPos++; 440 (*nsrc)--; 441 } 442 /* now do the interpolation */ 443 W16(dst, I(C816(apd->last[0].b), C816(src[0]), r)); dst += 2; 444 W16(dst, I(C816(apd->last[1].b), C816(src[1]), r)); dst += 2; 445 apd->dstPos += apd->dstIncr; 446 (*ndst)--; 447 } 448 } 449 450 static void cvtSM816C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, 451 unsigned char* dst, LPDWORD ndst) 452 { 453 double r; 454 455 while (*nsrc != 0 && *ndst != 0) { 456 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { 457 if (*nsrc == 0) return; 458 apd->last[0].b = *src++; 459 apd->last[1].b = *src++; 460 apd->srcPos++; 461 (*nsrc)--; 462 } 463 /* now do the interpolation */ 464 W16(dst, I(M16(C816(apd->last[0].b), C816(apd->last[1].b)), 465 M16(C816(src[0]), C816(src[1])), r)); 466 dst += 2; 467 apd->dstPos += apd->dstIncr; 468 (*ndst)--; 469 } 470 } 471 472 static void cvtMS816C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, 473 unsigned char* dst, LPDWORD ndst) 474 { 475 double r; 476 short v; 477 478 while (*nsrc != 0 && *ndst != 0) { 479 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { 480 if (*nsrc == 0) return; 481 apd->last[0].b = *src++; 482 apd->srcPos++; 483 (*nsrc)--; 484 } 485 /* now do the interpolation */ 486 v = I(C816(apd->last[0].b), C816(src[0]), r); 487 W16(dst, v); dst += 2; 488 W16(dst, v); dst += 2; 489 apd->dstPos += apd->dstIncr; 490 (*ndst)--; 491 } 492 } 493 494 static void cvtMM816C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, 495 unsigned char* dst, LPDWORD ndst) 496 { 497 double r; 498 499 while (*nsrc != 0 && *ndst != 0) { 500 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { 501 if (*nsrc == 0) return; 502 apd->last[0].b = *src++; 503 apd->srcPos++; 504 (*nsrc)--; 505 } 506 /* now do the interpolation */ 507 W16(dst, I(C816(apd->last[0].b), C816(src[0]), r)); 508 dst += 2; 509 apd->dstPos += apd->dstIncr; 510 (*ndst)--; 511 } 512 } 513 514 static void cvtSS168C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, 515 unsigned char* dst, LPDWORD ndst) 516 { 517 double r; 518 519 while (*nsrc != 0 && *ndst != 0) { 520 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { 521 if (*nsrc == 0) return; 522 apd->last[0].s = R16(src); src += 2; 523 apd->last[1].s = R16(src); src += 2; 524 apd->srcPos++; 525 (*nsrc)--; 526 } 527 /* now do the interpolation */ 528 *dst++ = C168(I(apd->last[0].s, R16(src) , r)); 529 *dst++ = C168(I(apd->last[1].s, R16(src+2), r)); 530 apd->dstPos += apd->dstIncr; 531 (*ndst)--; 532 } 533 } 534 535 static void cvtSM168C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, 536 unsigned char* dst, LPDWORD ndst) 537 { 538 double r; 539 540 while (*nsrc != 0 && *ndst != 0) { 541 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { 542 if (*nsrc == 0) return; 543 apd->last[0].s = R16(src); src += 2; 544 apd->last[1].s = R16(src); src += 2; 545 apd->srcPos++; 546 (*nsrc)--; 547 } 548 /* now do the interpolation */ 549 *dst++ = C168(I(M16(apd->last[0].s, apd->last[1].s), 550 M16(R16(src), R16(src + 2)), r)); 551 apd->dstPos += apd->dstIncr; 552 (*ndst)--; 553 } 554 } 555 556 557 static void cvtMS168C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, 558 unsigned char* dst, LPDWORD ndst) 559 { 560 double r; 561 562 while (*nsrc != 0 && *ndst != 0) { 563 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { 564 if (*nsrc == 0) return; 565 apd->last[0].s = R16(src); src += 2; 566 apd->srcPos++; 567 (*nsrc)--; 568 } 569 /* now do the interpolation */ 570 dst[0] = dst[1] = C168(I(apd->last[0].s, R16(src), r)); dst += 2; 571 apd->dstPos += apd->dstIncr; 572 (*ndst)--; 573 } 574 } 575 576 577 static void cvtMM168C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, 578 unsigned char* dst, LPDWORD ndst) 579 { 580 double r; 581 582 while (*nsrc != 0 && *ndst != 0) { 583 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { 584 if (*nsrc == 0) return; 585 apd->last[0].s = R16(src); src += 2; 586 apd->srcPos++; 587 (*nsrc)--; 588 } 589 /* now do the interpolation */ 590 *dst++ = C168(I(apd->last[0].s, R16(src), r)); 591 apd->dstPos += apd->dstIncr; 592 (*ndst)--; 593 } 594 } 595 596 static void cvtSS1616C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, 597 unsigned char* dst, LPDWORD ndst) 598 { 599 double r; 600 601 while (*nsrc != 0 && *ndst != 0) { 602 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { 603 if (*nsrc == 0) return; 604 apd->last[0].s = R16(src); src += 2; 605 apd->last[1].s = R16(src); src += 2; 606 apd->srcPos++; 607 (*nsrc)--; 608 } 609 /* now do the interpolation */ 610 W16(dst, I(apd->last[0].s, R16(src) , r)); dst += 2; 611 W16(dst, I(apd->last[1].s, R16(src+2), r)); dst += 2; 612 apd->dstPos += apd->dstIncr; 613 (*ndst)--; 614 } 615 } 616 617 static void cvtSM1616C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, 618 unsigned char* dst, LPDWORD ndst) 619 { 620 double r; 621 622 while (*nsrc != 0 && *ndst != 0) { 623 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { 624 if (*nsrc == 0) return; 625 apd->last[0].s = R16(src); src += 2; 626 apd->last[1].s = R16(src); src += 2; 627 apd->srcPos++; 628 (*nsrc)--; 629 } 630 /* now do the interpolation */ 631 W16(dst, I(M16(apd->last[0].s, apd->last[1].s), 632 M16(R16(src), R16(src+2)), r)); 633 dst += 2; 634 apd->dstPos += apd->dstIncr; 635 (*ndst)--; 636 } 637 } 638 639 static void cvtMS1616C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, 640 unsigned char* dst, LPDWORD ndst) 641 { 642 double r; 643 short v; 644 645 while (*nsrc != 0 && *ndst != 0) { 646 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { 647 if (*nsrc == 0) return; 648 apd->last[0].s = R16(src); src += 2; 649 apd->srcPos++; 650 (*nsrc)--; 651 } 652 /* now do the interpolation */ 653 v = I(apd->last[0].s, R16(src), r); 654 W16(dst, v); dst += 2; 655 W16(dst, v); dst += 2; 656 apd->dstPos += apd->dstIncr; 657 (*ndst)--; 658 } 659 } 660 661 static void cvtMM1616C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, 662 unsigned char* dst, LPDWORD ndst) 663 { 664 double r; 665 666 while (*nsrc != 0 && *ndst != 0) { 667 while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { 668 if (*nsrc == 0) return; 669 apd->last[0].s = R16(src); src += 2; 670 apd->srcPos++; 671 (*nsrc)--; 672 } 673 /* now do the interpolation */ 674 W16(dst, I(apd->last[0].s, R16(src), r)); dst += 2; 675 apd->dstPos += apd->dstIncr; 676 (*ndst)--; 677 } 678 } 679 680 static void (*PCM_ConvertChangeRate[16])(AcmPcmData* apd, 681 const unsigned char* src, LPDWORD nsrc, 682 unsigned char* dst, LPDWORD ndst) = { 683 683 cvtSS88C, cvtSM88C, cvtMS88C, cvtMM88C, 684 cvtSS816C, cvtSM816C, cvtMS816C, cvtMM816C,685 cvtSS168C, cvtSM168C, cvtMS168C, cvtMM168C,684 cvtSS816C, cvtSM816C, cvtMS816C, cvtMM816C, 685 cvtSS168C, cvtSM168C, cvtMS168C, cvtMM168C, 686 686 cvtSS1616C, cvtSM1616C, cvtMS1616C, cvtMM1616C, 687 687 }; … … 691 691 * 692 692 */ 693 static LRESULT PCM_DriverDetails(PACMDRIVERDETAILSW add)693 static LRESULT PCM_DriverDetails(PACMDRIVERDETAILSW add) 694 694 { 695 695 add->fccType = ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC; … … 712 712 add->szLicensing, sizeof(add->szLicensing)/sizeof(WCHAR) ); 713 713 add->szFeatures[0] = 0; 714 714 715 715 return MMSYSERR_NOERROR; 716 716 } … … 720 720 * 721 721 */ 722 static LRESULTPCM_FormatTagDetails(PACMFORMATTAGDETAILSW aftd, DWORD dwQuery)722 static LRESULT PCM_FormatTagDetails(PACMFORMATTAGDETAILSW aftd, DWORD dwQuery) 723 723 { 724 724 switch (dwQuery) { 725 725 case ACM_FORMATTAGDETAILSF_INDEX: 726 if (aftd->dwFormatTagIndex != 0) return ACMERR_NOTPOSSIBLE;727 break;728 case ACM_FORMATTAGDETAILSF_FORMATTAG: 729 if (aftd->dwFormatTag != WAVE_FORMAT_PCM) return ACMERR_NOTPOSSIBLE;730 break;726 if (aftd->dwFormatTagIndex != 0) return ACMERR_NOTPOSSIBLE; 727 break; 728 case ACM_FORMATTAGDETAILSF_FORMATTAG: 729 if (aftd->dwFormatTag != WAVE_FORMAT_PCM) return ACMERR_NOTPOSSIBLE; 730 break; 731 731 case ACM_FORMATTAGDETAILSF_LARGESTSIZE: 732 if (aftd->dwFormatTag != WAVE_FORMAT_UNKNOWN && 733 aftd->dwFormatTag != WAVE_FORMAT_UNKNOWN)734 return ACMERR_NOTPOSSIBLE;735 break;732 if (aftd->dwFormatTag != WAVE_FORMAT_UNKNOWN && 733 aftd->dwFormatTag != WAVE_FORMAT_UNKNOWN) 734 return ACMERR_NOTPOSSIBLE; 735 break; 736 736 default: 737 WARN("Unsupported query %08lx\n", dwQuery);738 return MMSYSERR_NOTSUPPORTED;739 } 740 737 WARN("Unsupported query %08lx\n", dwQuery); 738 return MMSYSERR_NOTSUPPORTED; 739 } 740 741 741 aftd->dwFormatTagIndex = 0; 742 742 aftd->dwFormatTag = WAVE_FORMAT_PCM; … … 745 745 aftd->cStandardFormats = NUM_PCM_FORMATS; 746 746 aftd->szFormatTag[0] = 0; 747 747 748 748 return MMSYSERR_NOERROR; 749 749 } … … 753 753 * 754 754 */ 755 static LRESULTPCM_FormatDetails(PACMFORMATDETAILSW afd, DWORD dwQuery)755 static LRESULT PCM_FormatDetails(PACMFORMATDETAILSW afd, DWORD dwQuery) 756 756 { 757 757 switch (dwQuery) { 758 758 case ACM_FORMATDETAILSF_FORMAT: 759 afd->dwFormatIndex = PCM_GetFormatIndex(afd->pwfx);760 if (afd->dwFormatIndex == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE;761 break;759 afd->dwFormatIndex = PCM_GetFormatIndex(afd->pwfx); 760 if (afd->dwFormatIndex == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE; 761 break; 762 762 case ACM_FORMATDETAILSF_INDEX: 763 assert(afd->dwFormatIndex < NUM_PCM_FORMATS);764 afd->pwfx->wFormatTag = WAVE_FORMAT_PCM;765 afd->pwfx->nChannels = PCM_Formats[afd->dwFormatIndex].nChannels;766 afd->pwfx->nSamplesPerSec = PCM_Formats[afd->dwFormatIndex].rate;767 afd->pwfx->wBitsPerSample = PCM_Formats[afd->dwFormatIndex].nBits;768 /* native MSACM uses a PCMWAVEFORMAT structure, so cbSize is not accessible769 * afd->pwfx->cbSize = 0; 770 */771 afd->pwfx->nBlockAlign = 772 (afd->pwfx->nChannels * afd->pwfx->wBitsPerSample) / 8;773 afd->pwfx->nAvgBytesPerSec = 774 afd->pwfx->nSamplesPerSec * afd->pwfx->nBlockAlign;775 break;763 assert(afd->dwFormatIndex < NUM_PCM_FORMATS); 764 afd->pwfx->wFormatTag = WAVE_FORMAT_PCM; 765 afd->pwfx->nChannels = PCM_Formats[afd->dwFormatIndex].nChannels; 766 afd->pwfx->nSamplesPerSec = PCM_Formats[afd->dwFormatIndex].rate; 767 afd->pwfx->wBitsPerSample = PCM_Formats[afd->dwFormatIndex].nBits; 768 /* native MSACM uses a PCMWAVEFORMAT structure, so cbSize is not accessible 769 * afd->pwfx->cbSize = 0; 770 */ 771 afd->pwfx->nBlockAlign = 772 (afd->pwfx->nChannels * afd->pwfx->wBitsPerSample) / 8; 773 afd->pwfx->nAvgBytesPerSec = 774 afd->pwfx->nSamplesPerSec * afd->pwfx->nBlockAlign; 775 break; 776 776 default: 777 WARN("Unsupported query %08lx\n", dwQuery);778 return MMSYSERR_NOTSUPPORTED; 779 } 780 777 WARN("Unsupported query %08lx\n", dwQuery); 778 return MMSYSERR_NOTSUPPORTED; 779 } 780 781 781 afd->dwFormatTag = WAVE_FORMAT_PCM; 782 782 afd->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CONVERTER; 783 783 afd->szFormat[0] = 0; /* let MSACM format this for us... */ 784 784 785 785 return MMSYSERR_NOERROR; 786 786 } … … 790 790 * 791 791 */ 792 static LRESULTPCM_FormatSuggest(PACMDRVFORMATSUGGEST adfs)792 static LRESULT PCM_FormatSuggest(PACMDRVFORMATSUGGEST adfs) 793 793 { 794 794 FIXME("(%p);\n", adfs); … … 800 800 * 801 801 */ 802 static voidPCM_Reset(AcmPcmData* apd, int srcNumBits)802 static void PCM_Reset(AcmPcmData* apd, int srcNumBits) 803 803 { 804 804 apd->srcPos = 0; … … 806 806 /* initialize with neutral value */ 807 807 if (srcNumBits == 16) { 808 apd->last[0].s = 0;809 apd->last[1].s = 0;808 apd->last[0].s = 0; 809 apd->last[1].s = 0; 810 810 } else { 811 apd->last[0].b = (BYTE)0x80;812 apd->last[1].b = (BYTE)0x80;811 apd->last[0].b = (BYTE)0x80; 812 apd->last[1].b = (BYTE)0x80; 813 813 } 814 814 } … … 818 818 * 819 819 */ 820 static LRESULTPCM_StreamOpen(PACMDRVSTREAMINSTANCE adsi)821 { 822 AcmPcmData* apd;823 int idx = 0;820 static LRESULT PCM_StreamOpen(PACMDRVSTREAMINSTANCE adsi) 821 { 822 AcmPcmData* apd; 823 int idx = 0; 824 824 825 825 assert(!(adsi->fdwOpen & ACM_STREAMOPENF_ASYNC)); 826 826 827 827 if (PCM_GetFormatIndex(adsi->pwfxSrc) == 0xFFFFFFFF || 828 PCM_GetFormatIndex(adsi->pwfxDst) == 0xFFFFFFFF)829 return ACMERR_NOTPOSSIBLE;828 PCM_GetFormatIndex(adsi->pwfxDst) == 0xFFFFFFFF) 829 return ACMERR_NOTPOSSIBLE; 830 830 831 831 apd = HeapAlloc(GetProcessHeap(), 0, sizeof(AcmPcmData)); … … 834 834 adsi->dwDriver = (DWORD)apd; 835 835 adsi->fdwDriver = 0; 836 836 837 837 if (adsi->pwfxSrc->wBitsPerSample == 16) idx += 8; 838 838 if (adsi->pwfxDst->wBitsPerSample == 16) idx += 4; … … 841 841 842 842 if (adsi->pwfxSrc->nSamplesPerSec == adsi->pwfxDst->nSamplesPerSec) { 843 apd->cvt.cvtKeepRate = PCM_ConvertKeepRate[idx];843 apd->cvt.cvtKeepRate = PCM_ConvertKeepRate[idx]; 844 844 } else { 845 adsi->fdwDriver |= PCM_RESAMPLE;846 apd->dstIncr = (double)(adsi->pwfxSrc->nSamplesPerSec) /847 (double)(adsi->pwfxDst->nSamplesPerSec);848 PCM_Reset(apd, adsi->pwfxSrc->wBitsPerSample);849 apd->cvt.cvtChangeRate = PCM_ConvertChangeRate[idx];845 adsi->fdwDriver |= PCM_RESAMPLE; 846 apd->dstIncr = (double)(adsi->pwfxSrc->nSamplesPerSec) / 847 (double)(adsi->pwfxDst->nSamplesPerSec); 848 PCM_Reset(apd, adsi->pwfxSrc->wBitsPerSample); 849 apd->cvt.cvtChangeRate = PCM_ConvertChangeRate[idx]; 850 850 } 851 851 … … 857 857 * 858 858 */ 859 static LRESULTPCM_StreamClose(PACMDRVSTREAMINSTANCE adsi)859 static LRESULT PCM_StreamClose(PACMDRVSTREAMINSTANCE adsi) 860 860 { 861 861 HeapFree(GetProcessHeap(), 0, (void*)adsi->dwDriver); … … 867 867 * 868 868 */ 869 static inline DWORDPCM_round(DWORD a, DWORD b, DWORD c)869 static inline DWORD PCM_round(DWORD a, DWORD b, DWORD c) 870 870 { 871 871 assert(a && b && c); … … 878 878 * 879 879 */ 880 static LRESULT PCM_StreamSize(PACMDRVSTREAMINSTANCE adsi, PACMDRVSTREAMSIZE adss)880 static LRESULT PCM_StreamSize(PACMDRVSTREAMINSTANCE adsi, PACMDRVSTREAMSIZE adss) 881 881 { 882 882 switch (adss->fdwSize) { 883 883 case ACM_STREAMSIZEF_DESTINATION: 884 /* cbDstLength => cbSrcLength */885 adss->cbSrcLength = PCM_round(adss->cbDstLength, 886 adsi->pwfxSrc->nAvgBytesPerSec, 887 adsi->pwfxDst->nAvgBytesPerSec);888 break;884 /* cbDstLength => cbSrcLength */ 885 adss->cbSrcLength = PCM_round(adss->cbDstLength, 886 adsi->pwfxSrc->nAvgBytesPerSec, 887 adsi->pwfxDst->nAvgBytesPerSec); 888 break; 889 889 case ACM_STREAMSIZEF_SOURCE: 890 /* cbSrcLength => cbDstLength */891 adss->cbDstLength = PCM_round(adss->cbSrcLength, 892 adsi->pwfxDst->nAvgBytesPerSec, 893 adsi->pwfxSrc->nAvgBytesPerSec);894 break;890 /* cbSrcLength => cbDstLength */ 891 adss->cbDstLength = PCM_round(adss->cbSrcLength, 892 adsi->pwfxDst->nAvgBytesPerSec, 893 adsi->pwfxSrc->nAvgBytesPerSec); 894 break; 895 895 default: 896 WARN("Unsupported query %08lx\n", adss->fdwSize);897 return MMSYSERR_NOTSUPPORTED; 896 WARN("Unsupported query %08lx\n", adss->fdwSize); 897 return MMSYSERR_NOTSUPPORTED; 898 898 } 899 899 return MMSYSERR_NOERROR; … … 906 906 static LRESULT PCM_StreamConvert(PACMDRVSTREAMINSTANCE adsi, PACMDRVSTREAMHEADER adsh) 907 907 { 908 AcmPcmData* apd = (AcmPcmData*)adsi->dwDriver;909 DWORD nsrc = NUM_OF(adsh->cbSrcLength, adsi->pwfxSrc->nBlockAlign);910 DWORD ndst = NUM_OF(adsh->cbDstLength, adsi->pwfxDst->nBlockAlign);911 912 if (adsh->fdwConvert & 913 ~(ACM_STREAMCONVERTF_BLOCKALIGN|914 ACM_STREAMCONVERTF_END|915 ACM_STREAMCONVERTF_START)) {916 FIXME("Unsupported fdwConvert (%08lx), ignoring it\n", adsh->fdwConvert);908 AcmPcmData* apd = (AcmPcmData*)adsi->dwDriver; 909 DWORD nsrc = NUM_OF(adsh->cbSrcLength, adsi->pwfxSrc->nBlockAlign); 910 DWORD ndst = NUM_OF(adsh->cbDstLength, adsi->pwfxDst->nBlockAlign); 911 912 if (adsh->fdwConvert & 913 ~(ACM_STREAMCONVERTF_BLOCKALIGN| 914 ACM_STREAMCONVERTF_END| 915 ACM_STREAMCONVERTF_START)) { 916 FIXME("Unsupported fdwConvert (%08lx), ignoring it\n", adsh->fdwConvert); 917 917 } 918 918 /* ACM_STREAMCONVERTF_BLOCKALIGN 919 * currently all conversions are block aligned, so do nothing for this flag919 * currently all conversions are block aligned, so do nothing for this flag 920 920 * ACM_STREAMCONVERTF_END 921 * no pending data, so do nothing for this flag921 * no pending data, so do nothing for this flag 922 922 */ 923 if ((adsh->fdwConvert & ACM_STREAMCONVERTF_START) && 924 (adsi->fdwDriver & PCM_RESAMPLE)) {925 PCM_Reset(apd, adsi->pwfxSrc->wBitsPerSample);923 if ((adsh->fdwConvert & ACM_STREAMCONVERTF_START) && 924 (adsi->fdwDriver & PCM_RESAMPLE)) { 925 PCM_Reset(apd, adsi->pwfxSrc->wBitsPerSample); 926 926 } 927 927 928 928 /* do the job */ 929 929 if (adsi->fdwDriver & PCM_RESAMPLE) { 930 DWORDnsrc2 = nsrc;931 DWORDndst2 = ndst;932 933 apd->cvt.cvtChangeRate(apd, adsh->pbSrc, &nsrc2, adsh->pbDst, &ndst2);934 nsrc -= nsrc2;935 ndst -= ndst2;930 DWORD nsrc2 = nsrc; 931 DWORD ndst2 = ndst; 932 933 apd->cvt.cvtChangeRate(apd, adsh->pbSrc, &nsrc2, adsh->pbDst, &ndst2); 934 nsrc -= nsrc2; 935 ndst -= ndst2; 936 936 } else { 937 if (nsrc < ndst) ndst = nsrc; else nsrc = ndst;938 939 /* nsrc is now equal to ndst */940 apd->cvt.cvtKeepRate(adsh->pbSrc, nsrc, adsh->pbDst);937 if (nsrc < ndst) ndst = nsrc; else nsrc = ndst; 938 939 /* nsrc is now equal to ndst */ 940 apd->cvt.cvtKeepRate(adsh->pbSrc, nsrc, adsh->pbDst); 941 941 } 942 942 … … 948 948 949 949 /************************************************************************** 950 * PCM_DriverProc[exported]951 */ 952 LRESULT CALLBACK PCM_DriverProc(DWORD dwDevID, HDRVR hDriv, UINT wMsg,953 LPARAM dwParam1, LPARAM dwParam2)954 { 955 TRACE("(%08lx %08lx %u %08lx %08lx);\n", 956 dwDevID, (DWORD)hDriv, wMsg, dwParam1, dwParam2);957 950 * PCM_DriverProc [exported] 951 */ 952 LRESULT CALLBACK PCM_DriverProc(DWORD dwDevID, HDRVR hDriv, UINT wMsg, 953 LPARAM dwParam1, LPARAM dwParam2) 954 { 955 TRACE("(%08lx %08lx %u %08lx %08lx);\n", 956 dwDevID, (DWORD)hDriv, wMsg, dwParam1, dwParam2); 957 958 958 switch (wMsg) { 959 case DRV_LOAD: return 1;960 case DRV_FREE: return 1;961 case DRV_OPEN: return PCM_drvOpen((LPSTR)dwParam1);962 case DRV_CLOSE: return PCM_drvClose(dwDevID);963 case DRV_ENABLE: return 1;964 case DRV_DISABLE: return 1;965 case DRV_QUERYCONFIGURE: return 1;966 case DRV_CONFIGURE: MessageBoxA(0, "MSACM PCM filter !", "Wine Driver", MB_OK); return 1;967 case DRV_INSTALL: return DRVCNF_RESTART;968 case DRV_REMOVE: return DRVCNF_RESTART;969 959 case DRV_LOAD: return 1; 960 case DRV_FREE: return 1; 961 case DRV_OPEN: return PCM_drvOpen((LPSTR)dwParam1); 962 case DRV_CLOSE: return PCM_drvClose(dwDevID); 963 case DRV_ENABLE: return 1; 964 case DRV_DISABLE: return 1; 965 case DRV_QUERYCONFIGURE: return 1; 966 case DRV_CONFIGURE: MessageBoxA(0, "MSACM PCM filter !", "Wine Driver", MB_OK); return 1; 967 case DRV_INSTALL: return DRVCNF_RESTART; 968 case DRV_REMOVE: return DRVCNF_RESTART; 969 970 970 case ACMDM_DRIVER_NOTIFY: 971 /* no caching from other ACM drivers is done so far */972 return MMSYSERR_NOERROR;973 971 /* no caching from other ACM drivers is done so far */ 972 return MMSYSERR_NOERROR; 973 974 974 case ACMDM_DRIVER_DETAILS: 975 return PCM_DriverDetails((PACMDRIVERDETAILSW)dwParam1);976 975 return PCM_DriverDetails((PACMDRIVERDETAILSW)dwParam1); 976 977 977 case ACMDM_FORMATTAG_DETAILS: 978 return PCM_FormatTagDetails((PACMFORMATTAGDETAILSW)dwParam1, dwParam2);979 978 return PCM_FormatTagDetails((PACMFORMATTAGDETAILSW)dwParam1, dwParam2); 979 980 980 case ACMDM_FORMAT_DETAILS: 981 return PCM_FormatDetails((PACMFORMATDETAILSW)dwParam1, dwParam2);982 981 return PCM_FormatDetails((PACMFORMATDETAILSW)dwParam1, dwParam2); 982 983 983 case ACMDM_FORMAT_SUGGEST: 984 return PCM_FormatSuggest((PACMDRVFORMATSUGGEST)dwParam1);985 984 return PCM_FormatSuggest((PACMDRVFORMATSUGGEST)dwParam1); 985 986 986 case ACMDM_STREAM_OPEN: 987 return PCM_StreamOpen((PACMDRVSTREAMINSTANCE)dwParam1);988 987 return PCM_StreamOpen((PACMDRVSTREAMINSTANCE)dwParam1); 988 989 989 case ACMDM_STREAM_CLOSE: 990 return PCM_StreamClose((PACMDRVSTREAMINSTANCE)dwParam1);991 990 return PCM_StreamClose((PACMDRVSTREAMINSTANCE)dwParam1); 991 992 992 case ACMDM_STREAM_SIZE: 993 return PCM_StreamSize((PACMDRVSTREAMINSTANCE)dwParam1, (PACMDRVSTREAMSIZE)dwParam2);994 993 return PCM_StreamSize((PACMDRVSTREAMINSTANCE)dwParam1, (PACMDRVSTREAMSIZE)dwParam2); 994 995 995 case ACMDM_STREAM_CONVERT: 996 return PCM_StreamConvert((PACMDRVSTREAMINSTANCE)dwParam1, (PACMDRVSTREAMHEADER)dwParam2);997 996 return PCM_StreamConvert((PACMDRVSTREAMINSTANCE)dwParam1, (PACMDRVSTREAMHEADER)dwParam2); 997 998 998 case ACMDM_HARDWARE_WAVE_CAPS_INPUT: 999 999 case ACMDM_HARDWARE_WAVE_CAPS_OUTPUT: 1000 /* this converter is not a hardware driver */1000 /* this converter is not a hardware driver */ 1001 1001 case ACMDM_FILTERTAG_DETAILS: 1002 1002 case ACMDM_FILTER_DETAILS: 1003 /* this converter is not a filter */1003 /* this converter is not a filter */ 1004 1004 case ACMDM_STREAM_RESET: 1005 /* only needed for asynchronous driver... we aren't, so just say it */1005 /* only needed for asynchronous driver... we aren't, so just say it */ 1006 1006 case ACMDM_STREAM_PREPARE: 1007 1007 case ACMDM_STREAM_UNPREPARE: 1008 /* nothing special to do here... so don't do anything */1009 return MMSYSERR_NOTSUPPORTED;1010 1008 /* nothing special to do here... so don't do anything */ 1009 return MMSYSERR_NOTSUPPORTED; 1010 1011 1011 default: 1012 return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);1012 return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2); 1013 1013 } 1014 1014 return 0; -
trunk/src/msacm32/stream.c
r6648 r6712 1 1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */ 2 /* $Id: stream.c,v 1.2 2001-09-05 13:11:26 bird Exp $ */ 2 3 3 /* 4 4 * MSACM32 library 5 5 * 6 6 * Copyright 1998 Patrik Stridvall 7 * 1999Eric Pouech7 * 1999 Eric Pouech 8 8 */ 9 9 10 10 /* TODO 11 * + asynchronous conversion is not implemented12 * + callback/notification13 * * acmStreamMessage14 * + properly close ACM streams11 * + asynchronous conversion is not implemented 12 * + callback/notification 13 * * acmStreamMessage 14 * + properly close ACM streams 15 15 */ 16 16 … … 26 26 27 27 DEFAULT_DEBUG_CHANNEL(msacm); 28 29 static PWINE_ACMSTREAM ACM_GetStream(HACMSTREAM has)28 29 static PWINE_ACMSTREAM ACM_GetStream(HACMSTREAM has) 30 30 { 31 31 return (PWINE_ACMSTREAM)has; … … 37 37 MMRESULT WINAPI acmStreamClose(HACMSTREAM has, DWORD fdwClose) 38 38 { 39 PWINE_ACMSTREAM was;40 MMRESULT ret;41 39 PWINE_ACMSTREAM was; 40 MMRESULT ret; 41 42 42 TRACE("(0x%08x, %ld)\n", has, fdwClose); 43 43 44 44 if ((was = ACM_GetStream(has)) == NULL) { 45 return MMSYSERR_INVALHANDLE;45 return MMSYSERR_INVALHANDLE; 46 46 } 47 47 ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_CLOSE, (DWORD)&was->drvInst, 0); 48 48 if (ret == MMSYSERR_NOERROR) { 49 if (was->hAcmDriver)50 acmDriverClose(was->hAcmDriver, 0L); 51 HeapFree(MSACM_hHeap, 0, was);49 if (was->hAcmDriver) 50 acmDriverClose(was->hAcmDriver, 0L); 51 HeapFree(MSACM_hHeap, 0, was); 52 52 } 53 53 TRACE("=> (%d)\n", ret); … … 58 58 * acmStreamConvert (MSACM32.38) 59 59 */ 60 MMRESULT WINAPI acmStreamConvert(HACMSTREAM has, PACMSTREAMHEADER pash, 61 DWORD fdwConvert)62 { 63 PWINE_ACMSTREAM was;64 MMRESULT ret = MMSYSERR_NOERROR;65 PACMDRVSTREAMHEADER padsh;60 MMRESULT WINAPI acmStreamConvert(HACMSTREAM has, PACMSTREAMHEADER pash, 61 DWORD fdwConvert) 62 { 63 PWINE_ACMSTREAM was; 64 MMRESULT ret = MMSYSERR_NOERROR; 65 PACMDRVSTREAMHEADER padsh; 66 66 67 67 TRACE("(0x%08x, %p, %ld)\n", has, pash, fdwConvert); 68 68 69 69 if ((was = ACM_GetStream(has)) == NULL) 70 return MMSYSERR_INVALHANDLE;70 return MMSYSERR_INVALHANDLE; 71 71 if (!pash || pash->cbStruct < sizeof(ACMSTREAMHEADER)) 72 return MMSYSERR_INVALPARAM;72 return MMSYSERR_INVALPARAM; 73 73 74 74 if (!(pash->fdwStatus & ACMSTREAMHEADER_STATUSF_PREPARED)) 75 return ACMERR_UNPREPARED;75 return ACMERR_UNPREPARED; 76 76 77 77 /* Note: the ACMSTREAMHEADER and ACMDRVSTREAMHEADER structs are of same … … 83 83 /* check that pointers have not been modified */ 84 84 if (padsh->pbPreparedSrc != padsh->pbSrc || 85 padsh->cbPreparedSrcLength < padsh->cbSrcLength ||86 padsh->pbPreparedDst != padsh->pbDst ||87 padsh->cbPreparedDstLength < padsh->cbDstLength) {88 return MMSYSERR_INVALPARAM;89 } 85 padsh->cbPreparedSrcLength < padsh->cbSrcLength || 86 padsh->pbPreparedDst != padsh->pbDst || 87 padsh->cbPreparedDstLength < padsh->cbDstLength) { 88 return MMSYSERR_INVALPARAM; 89 } 90 90 91 91 padsh->fdwConvert = fdwConvert; … … 93 93 ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_CONVERT, (DWORD)&was->drvInst, (DWORD)padsh); 94 94 if (ret == MMSYSERR_NOERROR) { 95 padsh->fdwStatus |= ACMSTREAMHEADER_STATUSF_DONE;95 padsh->fdwStatus |= ACMSTREAMHEADER_STATUSF_DONE; 96 96 } 97 97 TRACE("=> (%d)\n", ret); … … 102 102 * acmStreamMessage (MSACM32.39) 103 103 */ 104 MMRESULT WINAPI acmStreamMessage(HACMSTREAM has, UINT uMsg, LPARAM lParam1, 105 LPARAM lParam2)104 MMRESULT WINAPI acmStreamMessage(HACMSTREAM has, UINT uMsg, LPARAM lParam1, 105 LPARAM lParam2) 106 106 { 107 107 FIXME("(0x%08x, %u, %ld, %ld): stub\n", has, uMsg, lParam1, lParam2); … … 114 114 */ 115 115 MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pwfxSrc, 116 PWAVEFORMATEX pwfxDst, PWAVEFILTER pwfltr, DWORD dwCallback,117 DWORD dwInstance, DWORD fdwOpen)118 { 119 PWINE_ACMSTREAM was;120 PWINE_ACMDRIVER wad;121 MMRESULT ret;122 int wfxSrcSize;123 int wfxDstSize;124 116 PWAVEFORMATEX pwfxDst, PWAVEFILTER pwfltr, DWORD dwCallback, 117 DWORD dwInstance, DWORD fdwOpen) 118 { 119 PWINE_ACMSTREAM was; 120 PWINE_ACMDRIVER wad; 121 MMRESULT ret; 122 int wfxSrcSize; 123 int wfxDstSize; 124 125 125 TRACE("(%p, 0x%08x, %p, %p, %p, %ld, %ld, %ld)\n", 126 phas, had, pwfxSrc, pwfxDst, pwfltr, dwCallback, dwInstance, fdwOpen);127 128 TRACE("src [wFormatTag=%u, nChannels=%u, nSamplesPerSec=%lu, nAvgBytesPerSec=%lu, nBlockAlign=%u, wBitsPerSample=%u, cbSize=%u]\n", 129 pwfxSrc->wFormatTag, pwfxSrc->nChannels, pwfxSrc->nSamplesPerSec, pwfxSrc->nAvgBytesPerSec, 130 pwfxSrc->nBlockAlign, pwfxSrc->wBitsPerSample, pwfxSrc->cbSize);131 132 TRACE("dst [wFormatTag=%u, nChannels=%u, nSamplesPerSec=%lu, nAvgBytesPerSec=%lu, nBlockAlign=%u, wBitsPerSample=%u, cbSize=%u]\n", 133 pwfxDst->wFormatTag, pwfxDst->nChannels, pwfxDst->nSamplesPerSec, pwfxDst->nAvgBytesPerSec, 134 pwfxDst->nBlockAlign, pwfxDst->wBitsPerSample, pwfxDst->cbSize);126 phas, had, pwfxSrc, pwfxDst, pwfltr, dwCallback, dwInstance, fdwOpen); 127 128 TRACE("src [wFormatTag=%u, nChannels=%u, nSamplesPerSec=%lu, nAvgBytesPerSec=%lu, nBlockAlign=%u, wBitsPerSample=%u, cbSize=%u]\n", 129 pwfxSrc->wFormatTag, pwfxSrc->nChannels, pwfxSrc->nSamplesPerSec, pwfxSrc->nAvgBytesPerSec, 130 pwfxSrc->nBlockAlign, pwfxSrc->wBitsPerSample, pwfxSrc->cbSize); 131 132 TRACE("dst [wFormatTag=%u, nChannels=%u, nSamplesPerSec=%lu, nAvgBytesPerSec=%lu, nBlockAlign=%u, wBitsPerSample=%u, cbSize=%u]\n", 133 pwfxDst->wFormatTag, pwfxDst->nChannels, pwfxDst->nSamplesPerSec, pwfxDst->nAvgBytesPerSec, 134 pwfxDst->nBlockAlign, pwfxDst->wBitsPerSample, pwfxDst->cbSize); 135 135 136 136 if ((fdwOpen & ACM_STREAMOPENF_QUERY) && phas) return MMSYSERR_INVALPARAM; … … 143 143 was = HeapAlloc(MSACM_hHeap, 0, sizeof(*was) + wfxSrcSize + wfxDstSize + ((pwfltr) ? sizeof(WAVEFILTER) : 0)); 144 144 if (was == NULL) 145 return MMSYSERR_NOMEM;146 145 return MMSYSERR_NOMEM; 146 147 147 was->drvInst.cbStruct = sizeof(was->drvInst); 148 148 was->drvInst.pwfxSrc = (PWAVEFORMATEX)((LPSTR)was + sizeof(*was)); … … 151 151 memcpy(was->drvInst.pwfxDst, pwfxDst, wfxDstSize); 152 152 if (pwfltr) { 153 was->drvInst.pwfltr = (PWAVEFILTER)((LPSTR)was + sizeof(*was) + wfxSrcSize + wfxDstSize);154 memcpy(was->drvInst.pwfltr, pwfltr, sizeof(WAVEFILTER));153 was->drvInst.pwfltr = (PWAVEFILTER)((LPSTR)was + sizeof(*was) + wfxSrcSize + wfxDstSize); 154 memcpy(was->drvInst.pwfltr, pwfltr, sizeof(WAVEFILTER)); 155 155 } else { 156 was->drvInst.pwfltr = NULL;157 } 158 was->drvInst.dwCallback = dwCallback; 156 was->drvInst.pwfltr = NULL; 157 } 158 was->drvInst.dwCallback = dwCallback; 159 159 was->drvInst.dwInstance = dwInstance; 160 160 was->drvInst.fdwOpen = fdwOpen; 161 was->drvInst.fdwDriver = 0L; 162 was->drvInst.dwDriver = 0L; 161 was->drvInst.fdwDriver = 0L; 162 was->drvInst.dwDriver = 0L; 163 163 was->drvInst.has = (HACMSTREAM)was; 164 164 165 165 if (had) { 166 if (!(wad = MSACM_GetDriver(had))) {167 ret = MMSYSERR_INVALPARAM;168 goto errCleanUp;169 }170 171 was->obj.dwType = WINE_ACMOBJ_STREAM;172 was->obj.pACMDriverID = wad->obj.pACMDriverID;173 was->pDrv = wad;174 was->hAcmDriver = 0; /* not to close it in acmStreamClose */175 176 ret = SendDriverMessage(wad->hDrvr, ACMDM_STREAM_OPEN, (DWORD)&was->drvInst, 0L);177 if (ret != MMSYSERR_NOERROR)178 goto errCleanUp;166 if (!(wad = MSACM_GetDriver(had))) { 167 ret = MMSYSERR_INVALPARAM; 168 goto errCleanUp; 169 } 170 171 was->obj.dwType = WINE_ACMOBJ_STREAM; 172 was->obj.pACMDriverID = wad->obj.pACMDriverID; 173 was->pDrv = wad; 174 was->hAcmDriver = 0; /* not to close it in acmStreamClose */ 175 176 ret = SendDriverMessage(wad->hDrvr, ACMDM_STREAM_OPEN, (DWORD)&was->drvInst, 0L); 177 if (ret != MMSYSERR_NOERROR) 178 goto errCleanUp; 179 179 } else { 180 PWINE_ACMDRIVERID wadi;181 182 ret = ACMERR_NOTPOSSIBLE;183 for (wadi = MSACM_pFirstACMDriverID; wadi; wadi = wadi->pNextACMDriverID) {184 ret = acmDriverOpen(&had, (HACMDRIVERID)wadi, 0L);185 if (ret == MMSYSERR_NOERROR) {186 if ((wad = MSACM_GetDriver(had)) != 0) {187 was->obj.dwType = WINE_ACMOBJ_STREAM;188 was->obj.pACMDriverID = wad->obj.pACMDriverID;189 was->pDrv = wad;190 was->hAcmDriver = had;191 192 ret = SendDriverMessage(wad->hDrvr, ACMDM_STREAM_OPEN, (DWORD)&was->drvInst, 0L);193 if (ret == MMSYSERR_NOERROR) {194 if (fdwOpen & ACM_STREAMOPENF_QUERY) {195 acmDriverClose(had, 0L);196 }197 break;198 }199 }200 /* no match, close this acm driver and try next one */201 acmDriverClose(had, 0L);202 }203 }204 if (ret != MMSYSERR_NOERROR) {205 ret = ACMERR_NOTPOSSIBLE;206 goto errCleanUp;207 }180 PWINE_ACMDRIVERID wadi; 181 182 ret = ACMERR_NOTPOSSIBLE; 183 for (wadi = MSACM_pFirstACMDriverID; wadi; wadi = wadi->pNextACMDriverID) { 184 ret = acmDriverOpen(&had, (HACMDRIVERID)wadi, 0L); 185 if (ret == MMSYSERR_NOERROR) { 186 if ((wad = MSACM_GetDriver(had)) != 0) { 187 was->obj.dwType = WINE_ACMOBJ_STREAM; 188 was->obj.pACMDriverID = wad->obj.pACMDriverID; 189 was->pDrv = wad; 190 was->hAcmDriver = had; 191 192 ret = SendDriverMessage(wad->hDrvr, ACMDM_STREAM_OPEN, (DWORD)&was->drvInst, 0L); 193 if (ret == MMSYSERR_NOERROR) { 194 if (fdwOpen & ACM_STREAMOPENF_QUERY) { 195 acmDriverClose(had, 0L); 196 } 197 break; 198 } 199 } 200 /* no match, close this acm driver and try next one */ 201 acmDriverClose(had, 0L); 202 } 203 } 204 if (ret != MMSYSERR_NOERROR) { 205 ret = ACMERR_NOTPOSSIBLE; 206 goto errCleanUp; 207 } 208 208 } 209 209 ret = MMSYSERR_NOERROR; 210 210 if (!(fdwOpen & ACM_STREAMOPENF_QUERY)) { 211 if (phas) 212 *phas = (HACMSTREAM)was; 213 TRACE("=> (%d)\n", ret); 214 return ret; 215 } 216 errCleanUp: 211 217 if (phas) 212 *phas = (HACMSTREAM)was; 213 TRACE("=> (%d)\n", ret); 214 return ret; 215 } 216 errCleanUp: 217 if (phas) 218 *phas = (HACMSTREAM)0; 218 *phas = (HACMSTREAM)0; 219 219 HeapFree(MSACM_hHeap, 0, was); 220 220 TRACE("=> (%d)\n", ret); … … 226 226 * acmStreamPrepareHeader (MSACM32.41) 227 227 */ 228 MMRESULT WINAPI acmStreamPrepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, 229 DWORD fdwPrepare)230 { 231 PWINE_ACMSTREAM was;232 MMRESULT ret = MMSYSERR_NOERROR;233 PACMDRVSTREAMHEADER padsh;228 MMRESULT WINAPI acmStreamPrepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, 229 DWORD fdwPrepare) 230 { 231 PWINE_ACMSTREAM was; 232 MMRESULT ret = MMSYSERR_NOERROR; 233 PACMDRVSTREAMHEADER padsh; 234 234 235 235 TRACE("(0x%08x, %p, %ld)\n", has, pash, fdwPrepare); 236 236 237 237 if ((was = ACM_GetStream(has)) == NULL) 238 return MMSYSERR_INVALHANDLE;238 return MMSYSERR_INVALHANDLE; 239 239 if (!pash || pash->cbStruct < sizeof(ACMSTREAMHEADER)) 240 return MMSYSERR_INVALPARAM;240 return MMSYSERR_INVALPARAM; 241 241 if (fdwPrepare) 242 ret = MMSYSERR_INVALFLAG;242 ret = MMSYSERR_INVALFLAG; 243 243 244 244 if (pash->fdwStatus & ACMSTREAMHEADER_STATUSF_DONE) 245 return MMSYSERR_NOERROR;245 return MMSYSERR_NOERROR; 246 246 247 247 /* Note: the ACMSTREAMHEADER and ACMDRVSTREAMHEADER structs are of same … … 264 264 ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_PREPARE, (DWORD)&was->drvInst, (DWORD)padsh); 265 265 if (ret == MMSYSERR_NOERROR || ret == MMSYSERR_NOTSUPPORTED) { 266 ret = MMSYSERR_NOERROR;267 padsh->fdwStatus &= ~(ACMSTREAMHEADER_STATUSF_DONE|ACMSTREAMHEADER_STATUSF_INQUEUE);268 padsh->fdwStatus |= ACMSTREAMHEADER_STATUSF_PREPARED;269 padsh->fdwPrepared = padsh->fdwStatus;270 padsh->dwPrepared = 0;271 padsh->pbPreparedSrc = padsh->pbSrc;272 padsh->cbPreparedSrcLength = padsh->cbSrcLength;273 padsh->pbPreparedDst = padsh->pbDst;274 padsh->cbPreparedDstLength = padsh->cbDstLength;266 ret = MMSYSERR_NOERROR; 267 padsh->fdwStatus &= ~(ACMSTREAMHEADER_STATUSF_DONE|ACMSTREAMHEADER_STATUSF_INQUEUE); 268 padsh->fdwStatus |= ACMSTREAMHEADER_STATUSF_PREPARED; 269 padsh->fdwPrepared = padsh->fdwStatus; 270 padsh->dwPrepared = 0; 271 padsh->pbPreparedSrc = padsh->pbSrc; 272 padsh->cbPreparedSrcLength = padsh->cbSrcLength; 273 padsh->pbPreparedDst = padsh->pbDst; 274 padsh->cbPreparedDstLength = padsh->cbDstLength; 275 275 } else { 276 padsh->fdwPrepared = 0;277 padsh->dwPrepared = 0;278 padsh->pbPreparedSrc = 0;279 padsh->cbPreparedSrcLength = 0;280 padsh->pbPreparedDst = 0;281 padsh->cbPreparedDstLength = 0;276 padsh->fdwPrepared = 0; 277 padsh->dwPrepared = 0; 278 padsh->pbPreparedSrc = 0; 279 padsh->cbPreparedSrcLength = 0; 280 padsh->pbPreparedDst = 0; 281 padsh->cbPreparedDstLength = 0; 282 282 } 283 283 TRACE("=> (%d)\n", ret); … … 290 290 MMRESULT WINAPI acmStreamReset(HACMSTREAM has, DWORD fdwReset) 291 291 { 292 PWINE_ACMSTREAM was;293 MMRESULT ret = MMSYSERR_NOERROR;292 PWINE_ACMSTREAM was; 293 MMRESULT ret = MMSYSERR_NOERROR; 294 294 295 295 TRACE("(0x%08x, %ld)\n", has, fdwReset); 296 296 297 297 if (fdwReset) { 298 ret = MMSYSERR_INVALFLAG;298 ret = MMSYSERR_INVALFLAG; 299 299 } else if ((was = ACM_GetStream(has)) == NULL) { 300 return MMSYSERR_INVALHANDLE;300 return MMSYSERR_INVALHANDLE; 301 301 } else if (was->drvInst.fdwOpen & ACM_STREAMOPENF_ASYNC) { 302 ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_RESET, (DWORD)&was->drvInst, 0);302 ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_RESET, (DWORD)&was->drvInst, 0); 303 303 } 304 304 TRACE("=> (%d)\n", ret); … … 309 309 * acmStreamSize (MSACM32.43) 310 310 */ 311 MMRESULT WINAPI acmStreamSize(HACMSTREAM has, DWORD cbInput, 312 LPDWORD pdwOutputBytes, DWORD fdwSize)313 { 314 PWINE_ACMSTREAM was;315 ACMDRVSTREAMSIZE adss;316 MMRESULT ret;317 311 MMRESULT WINAPI acmStreamSize(HACMSTREAM has, DWORD cbInput, 312 LPDWORD pdwOutputBytes, DWORD fdwSize) 313 { 314 PWINE_ACMSTREAM was; 315 ACMDRVSTREAMSIZE adss; 316 MMRESULT ret; 317 318 318 TRACE("(0x%08x, %ld, %p, %ld)\n", has, cbInput, pdwOutputBytes, fdwSize); 319 319 320 320 if ((was = ACM_GetStream(has)) == NULL) { 321 return MMSYSERR_INVALHANDLE;321 return MMSYSERR_INVALHANDLE; 322 322 } 323 323 if ((fdwSize & ~ACM_STREAMSIZEF_QUERYMASK) != 0) { 324 return MMSYSERR_INVALFLAG;324 return MMSYSERR_INVALFLAG; 325 325 } 326 326 327 327 *pdwOutputBytes = 0L; 328 328 329 329 switch (fdwSize & ACM_STREAMSIZEF_QUERYMASK) { 330 330 case ACM_STREAMSIZEF_DESTINATION: 331 adss.cbDstLength = cbInput;332 adss.cbSrcLength = 0;333 break;331 adss.cbDstLength = cbInput; 332 adss.cbSrcLength = 0; 333 break; 334 334 case ACM_STREAMSIZEF_SOURCE: 335 adss.cbSrcLength = cbInput;336 adss.cbDstLength = 0;337 break;338 default: 339 return MMSYSERR_INVALFLAG;340 } 341 335 adss.cbSrcLength = cbInput; 336 adss.cbDstLength = 0; 337 break; 338 default: 339 return MMSYSERR_INVALFLAG; 340 } 341 342 342 adss.cbStruct = sizeof(adss); 343 343 adss.fdwSize = fdwSize; 344 ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_SIZE, 345 (DWORD)&was->drvInst, (DWORD)&adss);344 ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_SIZE, 345 (DWORD)&was->drvInst, (DWORD)&adss); 346 346 if (ret == MMSYSERR_NOERROR) { 347 switch (fdwSize & ACM_STREAMSIZEF_QUERYMASK) {348 case ACM_STREAMSIZEF_DESTINATION:349 *pdwOutputBytes = adss.cbSrcLength;350 break;351 case ACM_STREAMSIZEF_SOURCE:352 *pdwOutputBytes = adss.cbDstLength;353 break;354 }347 switch (fdwSize & ACM_STREAMSIZEF_QUERYMASK) { 348 case ACM_STREAMSIZEF_DESTINATION: 349 *pdwOutputBytes = adss.cbSrcLength; 350 break; 351 case ACM_STREAMSIZEF_SOURCE: 352 *pdwOutputBytes = adss.cbDstLength; 353 break; 354 } 355 355 } 356 356 TRACE("=> (%d) [%lu]\n", ret, *pdwOutputBytes); … … 361 361 * acmStreamUnprepareHeader (MSACM32.44) 362 362 */ 363 MMRESULT WINAPI acmStreamUnprepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, 364 DWORD fdwUnprepare)365 { 366 PWINE_ACMSTREAM was;367 MMRESULT ret = MMSYSERR_NOERROR;368 PACMDRVSTREAMHEADER padsh;363 MMRESULT WINAPI acmStreamUnprepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, 364 DWORD fdwUnprepare) 365 { 366 PWINE_ACMSTREAM was; 367 MMRESULT ret = MMSYSERR_NOERROR; 368 PACMDRVSTREAMHEADER padsh; 369 369 370 370 TRACE("(0x%08x, %p, %ld)\n", has, pash, fdwUnprepare); 371 371 372 372 if ((was = ACM_GetStream(has)) == NULL) 373 return MMSYSERR_INVALHANDLE;373 return MMSYSERR_INVALHANDLE; 374 374 if (!pash || pash->cbStruct < sizeof(ACMSTREAMHEADER)) 375 return MMSYSERR_INVALPARAM;375 return MMSYSERR_INVALPARAM; 376 376 377 377 if (!(pash->fdwStatus & ACMSTREAMHEADER_STATUSF_PREPARED)) 378 return ACMERR_UNPREPARED;378 return ACMERR_UNPREPARED; 379 379 380 380 /* Note: the ACMSTREAMHEADER and ACMDRVSTREAMHEADER structs are of same … … 386 386 /* check that pointers have not been modified */ 387 387 if (padsh->pbPreparedSrc != padsh->pbSrc || 388 padsh->cbPreparedSrcLength < padsh->cbSrcLength ||389 padsh->pbPreparedDst != padsh->pbDst ||390 padsh->cbPreparedDstLength < padsh->cbDstLength) {391 return MMSYSERR_INVALPARAM;392 } 388 padsh->cbPreparedSrcLength < padsh->cbSrcLength || 389 padsh->pbPreparedDst != padsh->pbDst || 390 padsh->cbPreparedDstLength < padsh->cbDstLength) { 391 return MMSYSERR_INVALPARAM; 392 } 393 393 394 394 padsh->fdwConvert = fdwUnprepare; … … 396 396 ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_UNPREPARE, (DWORD)&was->drvInst, (DWORD)padsh); 397 397 if (ret == MMSYSERR_NOERROR || ret == MMSYSERR_NOTSUPPORTED) { 398 ret = MMSYSERR_NOERROR;399 padsh->fdwStatus &= ~(ACMSTREAMHEADER_STATUSF_DONE|ACMSTREAMHEADER_STATUSF_INQUEUE|ACMSTREAMHEADER_STATUSF_PREPARED);400 } 401 TRACE("=> (%d)\n", ret); 402 return ret; 403 } 398 ret = MMSYSERR_NOERROR; 399 padsh->fdwStatus &= ~(ACMSTREAMHEADER_STATUSF_DONE|ACMSTREAMHEADER_STATUSF_INQUEUE|ACMSTREAMHEADER_STATUSF_PREPARED); 400 } 401 TRACE("=> (%d)\n", ret); 402 return ret; 403 } -
trunk/src/msacm32/wineacm.h
r5434 r6712 3 3 #define __WINE_WINEACM_H 4 4 5 #ifndef __WIN32OS2__ 5 #ifdef __WIN32OS2__ 6 #include "windef.h" 7 #else 6 8 #include "wine/windef16.h" 7 9 #include "wine/mmsystem16.h" -
trunk/src/msvfw32/drawdib.c
r6648 r6712 1 /* $Id: drawdib.c,v 1.2 2001-09-05 13:12:34 bird Exp $ */ 2 /* 1 /* 3 2 * Copyright 2000 Bradley Baetz 4 3 * … … 22 21 23 22 typedef struct { 24 HDC hdc;25 INT dxDst;26 INT dyDst;27 LPBITMAPINFOHEADER lpbi;28 INT dxSrc;29 INT dySrc;30 HPALETTE hpal;/* Palette to use for the DIB */31 BOOL begun;/* DrawDibBegin has been called */32 LPBITMAPINFOHEADER lpbiOut;/* Output format */33 HIC hic;/* HIC for decompression */34 HDC hMemDC;/* DC for buffering */35 HBITMAP hOldDib;/* Original Dib */36 HBITMAP hDib;/* DibSection */37 LPVOID lpvbits;/* Buffer for holding decompressed dib */23 HDC hdc; 24 INT dxDst; 25 INT dyDst; 26 LPBITMAPINFOHEADER lpbi; 27 INT dxSrc; 28 INT dySrc; 29 HPALETTE hpal; /* Palette to use for the DIB */ 30 BOOL begun; /* DrawDibBegin has been called */ 31 LPBITMAPINFOHEADER lpbiOut; /* Output format */ 32 HIC hic; /* HIC for decompression */ 33 HDC hMemDC; /* DC for buffering */ 34 HBITMAP hOldDib; /* Original Dib */ 35 HBITMAP hDib; /* DibSection */ 36 LPVOID lpvbits; /* Buffer for holding decompressed dib */ 38 37 } WINE_HDD; 39 38 … … 59 58 60 59 /*********************************************************************** 61 * DrawDibOpen[MSVFW32.@]60 * DrawDibOpen [MSVFW32.@] 62 61 */ 63 62 HDRAWDIB VFWAPI DrawDibOpen(void) { 64 HDRAWDIB hdd;65 66 TRACE("(void)\n");67 hdd = GlobalAlloc16(GHND,sizeof(WINE_HDD));68 TRACE("=> %d\n",hdd);69 return hdd;70 } 71 72 /*********************************************************************** 73 * DrawDibOpen[MSVIDEO.102]63 HDRAWDIB hdd; 64 65 TRACE("(void)\n"); 66 hdd = GlobalAlloc16(GHND,sizeof(WINE_HDD)); 67 TRACE("=> %d\n",hdd); 68 return hdd; 69 } 70 71 /*********************************************************************** 72 * DrawDibOpen [MSVIDEO.102] 74 73 */ 75 74 HDRAWDIB16 VFWAPI DrawDibOpen16(void) { 76 return (HDRAWDIB16)DrawDibOpen();77 } 78 79 /*********************************************************************** 80 * DrawDibClose[MSVFW32.@]75 return (HDRAWDIB16)DrawDibOpen(); 76 } 77 78 /*********************************************************************** 79 * DrawDibClose [MSVFW32.@] 81 80 */ 82 81 BOOL VFWAPI DrawDibClose(HDRAWDIB hdd) { 83 WINE_HDD *whdd = GlobalLock16(hdd);84 85 TRACE("(0x%08lx)\n",(DWORD)hdd);86 87 if (!whdd)88 return FALSE;89 90 if (whdd->begun)91 DrawDibEnd(hdd);92 93 GlobalUnlock16(hdd);94 GlobalFree16(hdd);95 return TRUE;96 } 97 98 /*********************************************************************** 99 * DrawDibClose[MSVIDEO.103]82 WINE_HDD *whdd = GlobalLock16(hdd); 83 84 TRACE("(0x%08lx)\n",(DWORD)hdd); 85 86 if (!whdd) 87 return FALSE; 88 89 if (whdd->begun) 90 DrawDibEnd(hdd); 91 92 GlobalUnlock16(hdd); 93 GlobalFree16(hdd); 94 return TRUE; 95 } 96 97 /*********************************************************************** 98 * DrawDibClose [MSVIDEO.103] 100 99 */ 101 100 BOOL16 VFWAPI DrawDibClose16(HDRAWDIB16 hdd) { 102 return DrawDibClose(hdd);103 } 104 105 /*********************************************************************** 106 * DrawDibEnd[MSVFW32.@]101 return DrawDibClose(hdd); 102 } 103 104 /*********************************************************************** 105 * DrawDibEnd [MSVFW32.@] 107 106 */ 108 107 BOOL VFWAPI DrawDibEnd(HDRAWDIB hdd) { 109 BOOL ret = TRUE;110 WINE_HDD *whdd = GlobalLock16(hdd);111 112 TRACE("(0x%08lx)\n",(DWORD)hdd);113 114 whdd->hpal = 0; /* Do not free this */115 whdd->hdc = 0;116 if (whdd->lpbi) {117 HeapFree(GetProcessHeap(),0,whdd->lpbi);118 whdd->lpbi = NULL;119 }120 if (whdd->lpbiOut) {121 HeapFree(GetProcessHeap(),0,whdd->lpbiOut);122 whdd->lpbiOut = NULL;123 }124 125 whdd->begun = FALSE;126 127 /*if (whdd->lpvbits)128 HeapFree(GetProcessHeap(),0,whdd->lpvbuf);*/129 130 if (whdd->hMemDC) {131 SelectObject(whdd->hMemDC,whdd->hOldDib);132 DeleteDC(whdd->hMemDC);133 }134 135 if (whdd->hDib)136 DeleteObject(whdd->hDib);137 138 if (whdd->hic) {139 ICDecompressEnd(whdd->hic);140 ICClose(whdd->hic);141 }142 143 whdd->lpvbits = NULL;144 145 GlobalUnlock16(hdd);146 return ret;147 } 148 149 /*********************************************************************** 150 * DrawDibEnd[MSVIDEO.105]108 BOOL ret = TRUE; 109 WINE_HDD *whdd = GlobalLock16(hdd); 110 111 TRACE("(0x%08lx)\n",(DWORD)hdd); 112 113 whdd->hpal = 0; /* Do not free this */ 114 whdd->hdc = 0; 115 if (whdd->lpbi) { 116 HeapFree(GetProcessHeap(),0,whdd->lpbi); 117 whdd->lpbi = NULL; 118 } 119 if (whdd->lpbiOut) { 120 HeapFree(GetProcessHeap(),0,whdd->lpbiOut); 121 whdd->lpbiOut = NULL; 122 } 123 124 whdd->begun = FALSE; 125 126 /*if (whdd->lpvbits) 127 HeapFree(GetProcessHeap(),0,whdd->lpvbuf);*/ 128 129 if (whdd->hMemDC) { 130 SelectObject(whdd->hMemDC,whdd->hOldDib); 131 DeleteDC(whdd->hMemDC); 132 } 133 134 if (whdd->hDib) 135 DeleteObject(whdd->hDib); 136 137 if (whdd->hic) { 138 ICDecompressEnd(whdd->hic); 139 ICClose(whdd->hic); 140 } 141 142 whdd->lpvbits = NULL; 143 144 GlobalUnlock16(hdd); 145 return ret; 146 } 147 148 /*********************************************************************** 149 * DrawDibEnd [MSVIDEO.105] 151 150 */ 152 151 BOOL16 VFWAPI DrawDibEnd16(HDRAWDIB16 hdd) { 153 return DrawDibEnd(hdd);152 return DrawDibEnd(hdd); 154 153 } 155 154 … … 158 157 */ 159 158 BOOL VFWAPI DrawDibBegin(HDRAWDIB hdd, 160 HDC hdc,161 INT dxDst,162 INT dyDst,163 LPBITMAPINFOHEADER lpbi,164 INT dxSrc,165 INT dySrc,166 UINT wFlags) {167 BOOL ret = TRUE;168 WINE_HDD *whdd;169 170 TRACE("(%d,0x%lx,%d,%d,%p,%d,%d,0x%08lx)\n",171 hdd,(DWORD)hdc,dxDst,dyDst,lpbi,dxSrc,dySrc,(DWORD)wFlags172 );173 TRACE("lpbi: %ld,%ld/%ld,%d,%d,%ld,%ld,%ld,%ld,%ld,%ld\n",174 lpbi->biSize, lpbi->biWidth, lpbi->biHeight, lpbi->biPlanes, 175 lpbi->biBitCount, lpbi->biCompression, lpbi->biSizeImage, 176 lpbi->biXPelsPerMeter, lpbi->biYPelsPerMeter, lpbi->biClrUsed, 177 lpbi->biClrImportant);178 179 if (wFlags & ~(DDF_BUFFER))180 FIXME("wFlags == 0x%08x not handled\n", wFlags & ~(DDF_BUFFER));181 182 whdd = (WINE_HDD*)GlobalLock16(hdd);183 if (!whdd) return FALSE;184 185 if (whdd->begun)186 DrawDibEnd(hdd);187 188 if (lpbi->biCompression) {189 DWORD size = 0;190 191 whdd->hic = ICOpen(ICTYPE_VIDEO,lpbi->biCompression,ICMODE_DECOMPRESS);192 if (!whdd->hic) {193 WARN("Could not open IC. biCompression == 0x%08lx\n",lpbi->biCompression);194 ret = FALSE;195 }196 197 if (ret) {198 size = ICDecompressGetFormat(whdd->hic,lpbi,NULL);199 if (size == ICERR_UNSUPPORTED) {200 WARN("Codec doesn't support GetFormat, giving up.\n");201 ret = FALSE;202 }203 }204 205 if (ret) {206 whdd->lpbiOut = HeapAlloc(GetProcessHeap(),0,size);207 208 if (ICDecompressGetFormat(whdd->hic,lpbi,whdd->lpbiOut) != ICERR_OK)209 ret = FALSE;210 }211 212 if (ret) {213 /* FIXME: Use Ex functions if available? */214 if (ICDecompressBegin(whdd->hic,lpbi,whdd->lpbiOut) != ICERR_OK)215 ret = FALSE;216 217 TRACE("biSizeImage == %ld\n",whdd->lpbiOut->biSizeImage);218 TRACE("biCompression == %ld\n",whdd->lpbiOut->biCompression);219 TRACE("biBitCount == %d\n",whdd->lpbiOut->biBitCount);220 }221 } else {222 DWORD dwSize;223 /* No compression */224 TRACE("Not compressed!\n");225 dwSize = lpbi->biSize + lpbi->biClrUsed*sizeof(RGBQUAD);226 whdd->lpbiOut = HeapAlloc(GetProcessHeap(),0,dwSize);227 memcpy(whdd->lpbiOut,lpbi,dwSize);228 }229 230 if (ret) {231 /*whdd->lpvbuf = HeapAlloc(GetProcessHeap(),0,whdd->lpbiOut->biSizeImage);*/232 233 whdd->hMemDC = CreateCompatibleDC(hdc);234 TRACE("Creating: %ld,%p\n",whdd->lpbiOut->biSize,whdd->lpvbits);235 whdd->hDib = CreateDIBSection(whdd->hMemDC,(BITMAPINFO *)whdd->lpbiOut,DIB_RGB_COLORS,&(whdd->lpvbits),0,0);236 if (!whdd->hDib) {237 TRACE("Error: %ld\n",GetLastError());238 }239 TRACE("Created: %d,%p\n",whdd->hDib,whdd->lpvbits);240 whdd->hOldDib = SelectObject(whdd->hMemDC,whdd->hDib);241 }242 243 if (ret) {244 whdd->hdc = hdc;245 whdd->dxDst = dxDst;246 whdd->dyDst = dyDst;247 whdd->lpbi = HeapAlloc(GetProcessHeap(),0,lpbi->biSize);248 memcpy(whdd->lpbi,lpbi,lpbi->biSize);249 whdd->dxSrc = dxSrc;250 whdd->dySrc = dySrc;251 whdd->begun = TRUE;252 whdd->hpal = 0;253 } else {254 if (whdd->hic)255 ICClose(whdd->hic);256 if (whdd->lpbiOut) {257 HeapFree(GetProcessHeap(),0,whdd->lpbiOut);258 whdd->lpbiOut = NULL;259 }260 }261 262 GlobalUnlock16(hdd);263 264 return ret;159 HDC hdc, 160 INT dxDst, 161 INT dyDst, 162 LPBITMAPINFOHEADER lpbi, 163 INT dxSrc, 164 INT dySrc, 165 UINT wFlags) { 166 BOOL ret = TRUE; 167 WINE_HDD *whdd; 168 169 TRACE("(%d,0x%lx,%d,%d,%p,%d,%d,0x%08lx)\n", 170 hdd,(DWORD)hdc,dxDst,dyDst,lpbi,dxSrc,dySrc,(DWORD)wFlags 171 ); 172 TRACE("lpbi: %ld,%ld/%ld,%d,%d,%ld,%ld,%ld,%ld,%ld,%ld\n", 173 lpbi->biSize, lpbi->biWidth, lpbi->biHeight, lpbi->biPlanes, 174 lpbi->biBitCount, lpbi->biCompression, lpbi->biSizeImage, 175 lpbi->biXPelsPerMeter, lpbi->biYPelsPerMeter, lpbi->biClrUsed, 176 lpbi->biClrImportant); 177 178 if (wFlags & ~(DDF_BUFFER)) 179 FIXME("wFlags == 0x%08x not handled\n", wFlags & ~(DDF_BUFFER)); 180 181 whdd = (WINE_HDD*)GlobalLock16(hdd); 182 if (!whdd) return FALSE; 183 184 if (whdd->begun) 185 DrawDibEnd(hdd); 186 187 if (lpbi->biCompression) { 188 DWORD size = 0; 189 190 whdd->hic = ICOpen(ICTYPE_VIDEO,lpbi->biCompression,ICMODE_DECOMPRESS); 191 if (!whdd->hic) { 192 WARN("Could not open IC. biCompression == 0x%08lx\n",lpbi->biCompression); 193 ret = FALSE; 194 } 195 196 if (ret) { 197 size = ICDecompressGetFormat(whdd->hic,lpbi,NULL); 198 if (size == ICERR_UNSUPPORTED) { 199 WARN("Codec doesn't support GetFormat, giving up.\n"); 200 ret = FALSE; 201 } 202 } 203 204 if (ret) { 205 whdd->lpbiOut = HeapAlloc(GetProcessHeap(),0,size); 206 207 if (ICDecompressGetFormat(whdd->hic,lpbi,whdd->lpbiOut) != ICERR_OK) 208 ret = FALSE; 209 } 210 211 if (ret) { 212 /* FIXME: Use Ex functions if available? */ 213 if (ICDecompressBegin(whdd->hic,lpbi,whdd->lpbiOut) != ICERR_OK) 214 ret = FALSE; 215 216 TRACE("biSizeImage == %ld\n",whdd->lpbiOut->biSizeImage); 217 TRACE("biCompression == %ld\n",whdd->lpbiOut->biCompression); 218 TRACE("biBitCount == %d\n",whdd->lpbiOut->biBitCount); 219 } 220 } else { 221 DWORD dwSize; 222 /* No compression */ 223 TRACE("Not compressed!\n"); 224 dwSize = lpbi->biSize + lpbi->biClrUsed*sizeof(RGBQUAD); 225 whdd->lpbiOut = HeapAlloc(GetProcessHeap(),0,dwSize); 226 memcpy(whdd->lpbiOut,lpbi,dwSize); 227 } 228 229 if (ret) { 230 /*whdd->lpvbuf = HeapAlloc(GetProcessHeap(),0,whdd->lpbiOut->biSizeImage);*/ 231 232 whdd->hMemDC = CreateCompatibleDC(hdc); 233 TRACE("Creating: %ld,%p\n",whdd->lpbiOut->biSize,whdd->lpvbits); 234 whdd->hDib = CreateDIBSection(whdd->hMemDC,(BITMAPINFO *)whdd->lpbiOut,DIB_RGB_COLORS,&(whdd->lpvbits),0,0); 235 if (!whdd->hDib) { 236 TRACE("Error: %ld\n",GetLastError()); 237 } 238 TRACE("Created: %d,%p\n",whdd->hDib,whdd->lpvbits); 239 whdd->hOldDib = SelectObject(whdd->hMemDC,whdd->hDib); 240 } 241 242 if (ret) { 243 whdd->hdc = hdc; 244 whdd->dxDst = dxDst; 245 whdd->dyDst = dyDst; 246 whdd->lpbi = HeapAlloc(GetProcessHeap(),0,lpbi->biSize); 247 memcpy(whdd->lpbi,lpbi,lpbi->biSize); 248 whdd->dxSrc = dxSrc; 249 whdd->dySrc = dySrc; 250 whdd->begun = TRUE; 251 whdd->hpal = 0; 252 } else { 253 if (whdd->hic) 254 ICClose(whdd->hic); 255 if (whdd->lpbiOut) { 256 HeapFree(GetProcessHeap(),0,whdd->lpbiOut); 257 whdd->lpbiOut = NULL; 258 } 259 } 260 261 GlobalUnlock16(hdd); 262 263 return ret; 265 264 } 266 265 267 266 /************************************************************************ 268 * DrawDibBegin[MSVIDEO.104]267 * DrawDibBegin [MSVIDEO.104] 269 268 */ 270 269 BOOL16 VFWAPI DrawDibBegin16(HDRAWDIB16 hdd, 271 HDC16 hdc,272 INT16 dxDst,273 INT16 dyDst,274 LPBITMAPINFOHEADER lpbi,275 INT16 dxSrc,276 INT16 dySrc,277 UINT16 wFlags) {278 return DrawDibBegin(hdd,hdc,dxDst,dyDst,lpbi,dxSrc,dySrc,wFlags);270 HDC16 hdc, 271 INT16 dxDst, 272 INT16 dyDst, 273 LPBITMAPINFOHEADER lpbi, 274 INT16 dxSrc, 275 INT16 dySrc, 276 UINT16 wFlags) { 277 return DrawDibBegin(hdd,hdc,dxDst,dyDst,lpbi,dxSrc,dySrc,wFlags); 279 278 } 280 279 281 280 /********************************************************************** 282 * DrawDibDraw[MSVFW32.@]281 * DrawDibDraw [MSVFW32.@] 283 282 */ 284 283 BOOL VFWAPI DrawDibDraw(HDRAWDIB hdd, HDC hdc, 285 INT xDst, INT yDst, INT dxDst, INT dyDst,286 LPBITMAPINFOHEADER lpbi,287 LPVOID lpBits,288 INT xSrc, INT ySrc, INT dxSrc, INT dySrc,289 UINT wFlags284 INT xDst, INT yDst, INT dxDst, INT dyDst, 285 LPBITMAPINFOHEADER lpbi, 286 LPVOID lpBits, 287 INT xSrc, INT ySrc, INT dxSrc, INT dySrc, 288 UINT wFlags 290 289 ) { 291 WINE_HDD *whdd;292 BOOL ret = TRUE;293 294 TRACE("(%d,0x%lx,%d,%d,%d,%d,%p,%p,%d,%d,%d,%d,0x%08lx)\n",295 hdd,(DWORD)hdc,xDst,yDst,dxDst,dyDst,lpbi,lpBits,xSrc,ySrc,dxSrc,dySrc,(DWORD)wFlags296 );297 298 if (wFlags & ~(DDF_SAME_HDC | DDF_SAME_DRAW | DDF_NOTKEYFRAME | 299 DDF_UPDATE | DDF_DONTDRAW))300 FIXME("wFlags == 0x%08lx not handled\n",(DWORD)wFlags);301 302 if (!lpBits) {303 /* Undocumented? */304 lpBits = (LPSTR)lpbi + (WORD)(lpbi->biSize) + (WORD)(lpbi->biClrUsed*sizeof(RGBQUAD));305 }306 307 whdd = GlobalLock16(hdd);290 WINE_HDD *whdd; 291 BOOL ret = TRUE; 292 293 TRACE("(%d,0x%lx,%d,%d,%d,%d,%p,%p,%d,%d,%d,%d,0x%08lx)\n", 294 hdd,(DWORD)hdc,xDst,yDst,dxDst,dyDst,lpbi,lpBits,xSrc,ySrc,dxSrc,dySrc,(DWORD)wFlags 295 ); 296 297 if (wFlags & ~(DDF_SAME_HDC | DDF_SAME_DRAW | DDF_NOTKEYFRAME | 298 DDF_UPDATE | DDF_DONTDRAW)) 299 FIXME("wFlags == 0x%08lx not handled\n",(DWORD)wFlags); 300 301 if (!lpBits) { 302 /* Undocumented? */ 303 lpBits = (LPSTR)lpbi + (WORD)(lpbi->biSize) + (WORD)(lpbi->biClrUsed*sizeof(RGBQUAD)); 304 } 305 306 whdd = GlobalLock16(hdd); 308 307 309 308 #define CHANGED(x) (whdd->x != x) 310 309 311 if ((!whdd->begun) || (!(wFlags & DDF_SAME_HDC) && CHANGED(hdc)) || (!(wFlags & DDF_SAME_DRAW) &&312 (CHANGED(lpbi) || CHANGED(dxSrc) || CHANGED(dySrc) || CHANGED(dxDst) || CHANGED(dyDst)))) {313 TRACE("Something changed!\n");314 ret = DrawDibBegin(hdd,hdc,dxDst,dyDst,lpbi,dxSrc,dySrc,0);315 }310 if ((!whdd->begun) || (!(wFlags & DDF_SAME_HDC) && CHANGED(hdc)) || (!(wFlags & DDF_SAME_DRAW) && 311 (CHANGED(lpbi) || CHANGED(dxSrc) || CHANGED(dySrc) || CHANGED(dxDst) || CHANGED(dyDst)))) { 312 TRACE("Something changed!\n"); 313 ret = DrawDibBegin(hdd,hdc,dxDst,dyDst,lpbi,dxSrc,dySrc,0); 314 } 316 315 317 316 #undef CHANGED 318 317 319 318 if ((dxDst == -1) && (dyDst == -1)) { 320 dxDst = dxSrc;321 dyDst = dySrc;322 }323 324 if (!(wFlags & DDF_UPDATE)) {325 /* biSizeImage may be set to 0 for BI_RGB (uncompressed) bitmaps */326 if ((lpbi->biCompression == BI_RGB) && (lpbi->biSizeImage == 0))327 lpbi->biSizeImage = ((lpbi->biWidth * lpbi->biBitCount + 31) / 32) * 4 * lpbi->biHeight;328 329 if (lpbi->biCompression) {330 DWORD flags = 0;331 332 TRACE("Compression == 0x%08lx\n",lpbi->biCompression);333 334 if (wFlags & DDF_NOTKEYFRAME)335 flags |= ICDECOMPRESS_NOTKEYFRAME;336 337 ICDecompress(whdd->hic,flags,lpbi,lpBits,whdd->lpbiOut,whdd->lpvbits);338 } else {339 memcpy(whdd->lpvbits,lpBits,lpbi->biSizeImage);340 } 341 }342 if (!(wFlags & DDF_DONTDRAW) && whdd->hpal)343 SelectPalette(hdc,whdd->hpal,FALSE);344 345 if (!(StretchBlt(whdd->hdc,xDst,yDst,dxDst,dyDst,whdd->hMemDC,xSrc,ySrc,dxSrc,dySrc,SRCCOPY)))346 ret = FALSE;347 348 GlobalUnlock16(hdd);349 return ret;319 dxDst = dxSrc; 320 dyDst = dySrc; 321 } 322 323 if (!(wFlags & DDF_UPDATE)) { 324 /* biSizeImage may be set to 0 for BI_RGB (uncompressed) bitmaps */ 325 if ((lpbi->biCompression == BI_RGB) && (lpbi->biSizeImage == 0)) 326 lpbi->biSizeImage = ((lpbi->biWidth * lpbi->biBitCount + 31) / 32) * 4 * lpbi->biHeight; 327 328 if (lpbi->biCompression) { 329 DWORD flags = 0; 330 331 TRACE("Compression == 0x%08lx\n",lpbi->biCompression); 332 333 if (wFlags & DDF_NOTKEYFRAME) 334 flags |= ICDECOMPRESS_NOTKEYFRAME; 335 336 ICDecompress(whdd->hic,flags,lpbi,lpBits,whdd->lpbiOut,whdd->lpvbits); 337 } else { 338 memcpy(whdd->lpvbits,lpBits,lpbi->biSizeImage); 339 } 340 } 341 if (!(wFlags & DDF_DONTDRAW) && whdd->hpal) 342 SelectPalette(hdc,whdd->hpal,FALSE); 343 344 if (!(StretchBlt(whdd->hdc,xDst,yDst,dxDst,dyDst,whdd->hMemDC,xSrc,ySrc,dxSrc,dySrc,SRCCOPY))) 345 ret = FALSE; 346 347 GlobalUnlock16(hdd); 348 return ret; 350 349 } 351 350 352 351 /********************************************************************** 353 * DrawDibDraw[MSVIDEO.106]354 */ 355 BOOL16 VFWAPI DrawDibDraw16(HDRAWDIB16 hdd, 356 HDC16 hdc,357 INT16 xDst,358 INT16 yDst,359 INT16 dxDst,360 INT16 dyDst,361 LPBITMAPINFOHEADER lpbi,362 LPVOID lpBits,363 INT16 xSrc,364 INT16 ySrc,365 INT16 dxSrc,366 INT16 dySrc,367 UINT16 wFlags) {368 return DrawDibDraw(hdd,hdc,xDst,yDst,dxDst,dyDst,lpbi,lpBits,xSrc,ySrc,dxSrc,dySrc,wFlags);352 * DrawDibDraw [MSVIDEO.106] 353 */ 354 BOOL16 VFWAPI DrawDibDraw16(HDRAWDIB16 hdd, 355 HDC16 hdc, 356 INT16 xDst, 357 INT16 yDst, 358 INT16 dxDst, 359 INT16 dyDst, 360 LPBITMAPINFOHEADER lpbi, 361 LPVOID lpBits, 362 INT16 xSrc, 363 INT16 ySrc, 364 INT16 dxSrc, 365 INT16 dySrc, 366 UINT16 wFlags) { 367 return DrawDibDraw(hdd,hdc,xDst,yDst,dxDst,dyDst,lpbi,lpBits,xSrc,ySrc,dxSrc,dySrc,wFlags); 369 368 } 370 369 371 370 /************************************************************************* 372 * DrawDibStart[MSVFW32.@]371 * DrawDibStart [MSVFW32.@] 373 372 */ 374 373 BOOL VFWAPI DrawDibStart(HDRAWDIB hdd, DWORD rate) { 375 FIXME("(0x%08lx,%ld), stub\n",(DWORD)hdd,rate);376 return TRUE;374 FIXME("(0x%08lx,%ld), stub\n",(DWORD)hdd,rate); 375 return TRUE; 377 376 } 378 377 379 378 /************************************************************************* 380 * DrawDibStart[MSVIDEO.118]379 * DrawDibStart [MSVIDEO.118] 381 380 */ 382 381 BOOL16 VFWAPI DrawDibStart16(HDRAWDIB16 hdd, DWORD rate) { 383 return DrawDibStart(hdd,rate);382 return DrawDibStart(hdd,rate); 384 383 } 385 384 386 385 /************************************************************************* 387 * DrawDibStop[MSVFW32.@]386 * DrawDibStop [MSVFW32.@] 388 387 */ 389 388 BOOL VFWAPI DrawDibStop(HDRAWDIB hdd) { 390 FIXME("(0x%08lx), stub\n",(DWORD)hdd);391 return TRUE;389 FIXME("(0x%08lx), stub\n",(DWORD)hdd); 390 return TRUE; 392 391 } 393 392 394 393 /************************************************************************* 395 * DrawDibStop[MSVIDEO.119]394 * DrawDibStop [MSVIDEO.119] 396 395 */ 397 396 BOOL16 DrawDibStop16(HDRAWDIB16 hdd) { 398 return DrawDibStop(hdd);397 return DrawDibStop(hdd); 399 398 } 400 399 … … 403 402 */ 404 403 BOOL VFWAPI DrawDibSetPalette(HDRAWDIB hdd, HPALETTE hpal) { 405 WINE_HDD *whdd;406 407 TRACE("(0x%08lx,0x%08lx)\n",(DWORD)hdd,(DWORD)hpal);408 409 whdd = GlobalLock16(hdd);410 whdd->hpal = hpal;411 412 if (whdd->begun) {413 SelectPalette(whdd->hdc,hpal,0);414 RealizePalette(whdd->hdc);415 }416 GlobalUnlock16(hdd);417 return TRUE;404 WINE_HDD *whdd; 405 406 TRACE("(0x%08lx,0x%08lx)\n",(DWORD)hdd,(DWORD)hpal); 407 408 whdd = GlobalLock16(hdd); 409 whdd->hpal = hpal; 410 411 if (whdd->begun) { 412 SelectPalette(whdd->hdc,hpal,0); 413 RealizePalette(whdd->hdc); 414 } 415 GlobalUnlock16(hdd); 416 return TRUE; 418 417 } 419 418 … … 422 421 */ 423 422 BOOL16 VFWAPI DrawDibSetPalette16(HDRAWDIB16 hdd, HPALETTE16 hpal) { 424 return DrawDibSetPalette(hdd,hpal);423 return DrawDibSetPalette(hdd,hpal); 425 424 } 426 425 … … 429 428 */ 430 429 HPALETTE VFWAPI DrawDibGetPalette(HDRAWDIB hdd) { 431 WINE_HDD *whdd;432 HPALETTE ret;433 434 TRACE("(0x%08lx)\n",(DWORD)hdd);435 436 whdd = GlobalLock16(hdd);437 ret = whdd->hpal;438 GlobalUnlock16(hdd);439 return ret;430 WINE_HDD *whdd; 431 HPALETTE ret; 432 433 TRACE("(0x%08lx)\n",(DWORD)hdd); 434 435 whdd = GlobalLock16(hdd); 436 ret = whdd->hpal; 437 GlobalUnlock16(hdd); 438 return ret; 440 439 } 441 440 … … 444 443 */ 445 444 HPALETTE16 VFWAPI DrawDibGetPalette16(HDRAWDIB16 hdd) { 446 return (HPALETTE16)DrawDibGetPalette(hdd);445 return (HPALETTE16)DrawDibGetPalette(hdd); 447 446 } 448 447 … … 451 450 */ 452 451 UINT VFWAPI DrawDibRealize(HDRAWDIB hdd, HDC hdc, BOOL fBackground) { 453 WINE_HDD *whdd;454 HPALETTE oldPal;455 UINT ret = 0;456 457 FIXME("(%d,0x%08lx,%d), stub\n",hdd,(DWORD)hdc,fBackground);458 459 whdd = GlobalLock16(hdd);460 461 if (!whdd || !(whdd->begun)) {462 ret = 0;463 goto out;464 }465 466 if (!whdd->hpal)467 whdd->hpal = CreateHalftonePalette(hdc);468 469 oldPal = SelectPalette(hdc,whdd->hpal,fBackground);470 ret = RealizePalette(hdc);471 452 WINE_HDD *whdd; 453 HPALETTE oldPal; 454 UINT ret = 0; 455 456 FIXME("(%d,0x%08lx,%d), stub\n",hdd,(DWORD)hdc,fBackground); 457 458 whdd = GlobalLock16(hdd); 459 460 if (!whdd || !(whdd->begun)) { 461 ret = 0; 462 goto out; 463 } 464 465 if (!whdd->hpal) 466 whdd->hpal = CreateHalftonePalette(hdc); 467 468 oldPal = SelectPalette(hdc,whdd->hpal,fBackground); 469 ret = RealizePalette(hdc); 470 472 471 out: 473 GlobalUnlock16(hdd);474 475 TRACE("=> %u\n",ret);476 return ret;472 GlobalUnlock16(hdd); 473 474 TRACE("=> %u\n",ret); 475 return ret; 477 476 } 478 477 … … 481 480 */ 482 481 UINT16 VFWAPI DrawDibRealize16(HDRAWDIB16 hdd, HDC16 hdc, BOOL16 fBackground) { 483 return (UINT16)DrawDibRealize(hdd,hdc,fBackground);484 } 482 return (UINT16)DrawDibRealize(hdd,hdc,fBackground); 483 } -
trunk/src/msvfw32/msvideo_main.c
r6648 r6712 1 /* $Id: msvideo_main.c,v 1.2 2001-09-05 13:12:35 bird Exp $ */2 1 /* 3 2 * Copyright 1998 Marcus Meissner 4 * Copyright 2000 Bradley Baetz 3 * Copyright 2000 Bradley Baetz 5 4 * 6 5 * FIXME: This all assumes 32 bit codecs 7 * Win95 appears to prefer 32 bit codecs, even from 16 bit code.8 * There is the ICOpenFunction16 to worry about still, though.6 * Win95 appears to prefer 32 bit codecs, even from 16 bit code. 7 * There is the ICOpenFunction16 to worry about still, though. 9 8 */ 10 9 … … 35 34 #define GlobalFree16 GlobalFree 36 35 #undef SEGPTR_NEW 37 #define SEGPTR_NEW(a) malloc(sizeof(a))36 #define SEGPTR_NEW(a) malloc(sizeof(a)) 38 37 #define SEGPTR_FREE(a) free(a) 39 38 #define SEGPTR_GET(a) a … … 60 59 61 60 /*********************************************************************** 62 * VideoForWindowsVersion[MSVFW32.2]63 * VideoForWindowsVersion[MSVIDEO.2]61 * VideoForWindowsVersion [MSVFW32.2] 62 * VideoForWindowsVersion [MSVIDEO.2] 64 63 * Returns the version in major.minor form. 65 64 * In Windows95 this returns 0x040003b6 (4.950) 66 65 */ 67 66 DWORD WINAPI VideoForWindowsVersion(void) { 68 return 0x040003B6; /* 4.950 */69 } 70 71 /*********************************************************************** 72 * VideoCapDriverDescAndVer[MSVIDEO.22]67 return 0x040003B6; /* 4.950 */ 68 } 69 70 /*********************************************************************** 71 * VideoCapDriverDescAndVer [MSVIDEO.22] 73 72 */ 74 73 DWORD WINAPI VideoCapDriverDescAndVer( 75 WORD nr,LPSTR buf1,WORD buf1len,LPSTR buf2,WORD buf2len74 WORD nr,LPSTR buf1,WORD buf1len,LPSTR buf2,WORD buf2len 76 75 ) { 77 DWORDverhandle;78 WORDxnr = nr;79 DWORDinfosize;80 UINTsubblocklen;81 char*s,buf[2000],fn[260];82 LPBYTEinfobuf;83 LPVOIDsubblock;84 85 TRACE("(%d,%p,%d,%p,%d)\n",nr,buf1,buf1len,buf2,buf2len);86 if (GetPrivateProfileStringA("drivers32",NULL,NULL,buf,sizeof(buf),"system.ini")) {87 s = buf;88 while (*s) {89 if (!strncasecmp(s,"vid",3)) {90 if (!xnr)91 break;92 xnr--;93 }94 s=s+strlen(s)+1; /* either next char or \0 */95 }96 } else97 return 20; /* hmm, out of entries even if we don't have any */98 if (xnr) {99 FIXME("No more VID* entries found\n");100 return 20;101 }102 GetPrivateProfileStringA("drivers32",s,NULL,fn,sizeof(fn),"system.ini");103 infosize = GetFileVersionInfoSizeA(fn,&verhandle);104 if (!infosize) {105 TRACE("%s has no fileversioninfo.\n",fn);106 return 18;107 }108 infobuf = HeapAlloc(GetProcessHeap(),0,infosize);109 if (GetFileVersionInfoA(fn,verhandle,infosize,infobuf)) {110 charvbuf[200];111 /* Yes, two space behind : */112 /* FIXME: test for buflen */113 sprintf(vbuf,"Version: %d.%d.%d.%d\n",114 ((WORD*)infobuf)[0x0f],115 ((WORD*)infobuf)[0x0e],116 ((WORD*)infobuf)[0x11],117 ((WORD*)infobuf)[0x10]118 );119 TRACE("version of %s is %s\n",fn,vbuf);120 strncpy(buf2,vbuf,buf2len);121 } else {122 TRACE("GetFileVersionInfoA failed for %s.\n",fn);123 strncpy(buf2,fn,buf2len); /* msvideo.dll appears to copy fn*/124 }125 /* FIXME: language problem? */126 if (VerQueryValueA(infobuf,127 "\\StringFileInfo\\040904E4\\FileDescription",128 &subblock,129 &subblocklen130 )) {131 TRACE("VQA returned %s\n",(LPCSTR)subblock);132 strncpy(buf1,subblock,buf1len);133 } else {134 TRACE("VQA did not return on query \\StringFileInfo\\040904E4\\FileDescription?\n");135 strncpy(buf1,fn,buf1len); /* msvideo.dll appears to copy fn*/136 }137 HeapFree(GetProcessHeap(),0,infobuf);138 return 0;76 DWORD verhandle; 77 WORD xnr = nr; 78 DWORD infosize; 79 UINT subblocklen; 80 char *s,buf[2000],fn[260]; 81 LPBYTE infobuf; 82 LPVOID subblock; 83 84 TRACE("(%d,%p,%d,%p,%d)\n",nr,buf1,buf1len,buf2,buf2len); 85 if (GetPrivateProfileStringA("drivers32",NULL,NULL,buf,sizeof(buf),"system.ini")) { 86 s = buf; 87 while (*s) { 88 if (!strncasecmp(s,"vid",3)) { 89 if (!xnr) 90 break; 91 xnr--; 92 } 93 s=s+strlen(s)+1; /* either next char or \0 */ 94 } 95 } else 96 return 20; /* hmm, out of entries even if we don't have any */ 97 if (xnr) { 98 FIXME("No more VID* entries found\n"); 99 return 20; 100 } 101 GetPrivateProfileStringA("drivers32",s,NULL,fn,sizeof(fn),"system.ini"); 102 infosize = GetFileVersionInfoSizeA(fn,&verhandle); 103 if (!infosize) { 104 TRACE("%s has no fileversioninfo.\n",fn); 105 return 18; 106 } 107 infobuf = HeapAlloc(GetProcessHeap(),0,infosize); 108 if (GetFileVersionInfoA(fn,verhandle,infosize,infobuf)) { 109 char vbuf[200]; 110 /* Yes, two space behind : */ 111 /* FIXME: test for buflen */ 112 sprintf(vbuf,"Version: %d.%d.%d.%d\n", 113 ((WORD*)infobuf)[0x0f], 114 ((WORD*)infobuf)[0x0e], 115 ((WORD*)infobuf)[0x11], 116 ((WORD*)infobuf)[0x10] 117 ); 118 TRACE("version of %s is %s\n",fn,vbuf); 119 strncpy(buf2,vbuf,buf2len); 120 } else { 121 TRACE("GetFileVersionInfoA failed for %s.\n",fn); 122 strncpy(buf2,fn,buf2len); /* msvideo.dll appears to copy fn*/ 123 } 124 /* FIXME: language problem? */ 125 if (VerQueryValueA( infobuf, 126 "\\StringFileInfo\\040904E4\\FileDescription", 127 &subblock, 128 &subblocklen 129 )) { 130 TRACE("VQA returned %s\n",(LPCSTR)subblock); 131 strncpy(buf1,subblock,buf1len); 132 } else { 133 TRACE("VQA did not return on query \\StringFileInfo\\040904E4\\FileDescription?\n"); 134 strncpy(buf1,fn,buf1len); /* msvideo.dll appears to copy fn*/ 135 } 136 HeapFree(GetProcessHeap(),0,infobuf); 137 return 0; 139 138 } 140 139 … … 142 141 143 142 /*********************************************************************** 144 * ICInfo[MSVFW32.@]143 * ICInfo [MSVFW32.@] 145 144 * Get information about an installable compressor. Return TRUE if there 146 145 * is one. 147 146 */ 148 147 BOOL VFWAPI ICInfo( 149 DWORD fccType,/* [in] type of compressor ('vidc') */150 DWORD fccHandler,/* [in] <n>th compressor */151 ICINFO *lpicinfo)/* [out] information about compressor */148 DWORD fccType, /* [in] type of compressor ('vidc') */ 149 DWORD fccHandler, /* [in] <n>th compressor */ 150 ICINFO *lpicinfo) /* [out] information about compressor */ 152 151 { 153 chartype[5],buf[2000];154 155 memcpy(type,&fccType,4);type[4]=0;156 TRACE("(%s,%ld,%p).\n",type,fccHandler,lpicinfo);157 /* does OpenDriver/CloseDriver */158 lpicinfo->dwSize = sizeof(ICINFO);159 lpicinfo->fccType = fccType;160 lpicinfo->dwFlags = 0;161 if (GetPrivateProfileStringA("drivers32",NULL,NULL,buf,2000,"system.ini")) {162 char *s = buf;163 while (*s) {164 if (!strncasecmp(type,s,4)) {165 if(!fccHandler--) {166 lpicinfo->fccHandler = mmioStringToFOURCCA(s+5,0);167 return TRUE;168 }169 }170 s=s+strlen(s)+1; /* either next char or \0 */171 }172 }173 return FALSE;152 char type[5],buf[2000]; 153 154 memcpy(type,&fccType,4);type[4]=0; 155 TRACE("(%s,%ld,%p).\n",type,fccHandler,lpicinfo); 156 /* does OpenDriver/CloseDriver */ 157 lpicinfo->dwSize = sizeof(ICINFO); 158 lpicinfo->fccType = fccType; 159 lpicinfo->dwFlags = 0; 160 if (GetPrivateProfileStringA("drivers32",NULL,NULL,buf,2000,"system.ini")) { 161 char *s = buf; 162 while (*s) { 163 if (!strncasecmp(type,s,4)) { 164 if(!fccHandler--) { 165 lpicinfo->fccHandler = mmioStringToFOURCCA(s+5,0); 166 return TRUE; 167 } 168 } 169 s=s+strlen(s)+1; /* either next char or \0 */ 170 } 171 } 172 return FALSE; 174 173 } 175 174 #ifndef __WIN32OS2__ 176 175 /*********************************************************************** 177 * ICInfo[MSVIDEO.200]176 * ICInfo [MSVIDEO.200] 178 177 */ 179 178 BOOL16 VFWAPI ICInfo16( 180 DWORD fccType, /* [in] */181 DWORD fccHandler, /* [in] */182 ICINFO16 *lpicinfo) /* [in/out] NOTE: SEGPTR */179 DWORD fccType, /* [in] */ 180 DWORD fccHandler, /* [in] */ 181 ICINFO16 *lpicinfo) /* [in/out] NOTE: SEGPTR */ 183 182 { 184 BOOL16 ret;185 LPVOID lpv;186 DWORD lParam = (DWORD)lpicinfo;187 DWORD size = ((ICINFO*)(MapSL((SEGPTR)lpicinfo)))->dwSize;188 189 /* Use the mapping functions to map the ICINFO structure */190 lpv = MSVIDEO_MapMsg16To32(ICM_GETINFO,&lParam,&size);191 192 ret = ICInfo(fccType,fccHandler,(ICINFO*)lParam);193 194 MSVIDEO_UnmapMsg16To32(ICM_GETINFO,lpv,&lParam,&size);195 196 return ret;197 } 198 #endif 199 /*********************************************************************** 200 * ICOpen[MSVFW32.@]183 BOOL16 ret; 184 LPVOID lpv; 185 DWORD lParam = (DWORD)lpicinfo; 186 DWORD size = ((ICINFO*)(MapSL((SEGPTR)lpicinfo)))->dwSize; 187 188 /* Use the mapping functions to map the ICINFO structure */ 189 lpv = MSVIDEO_MapMsg16To32(ICM_GETINFO,&lParam,&size); 190 191 ret = ICInfo(fccType,fccHandler,(ICINFO*)lParam); 192 193 MSVIDEO_UnmapMsg16To32(ICM_GETINFO,lpv,&lParam,&size); 194 195 return ret; 196 } 197 #endif 198 /*********************************************************************** 199 * ICOpen [MSVFW32.@] 201 200 * Opens an installable compressor. Return special handle. 202 201 */ 203 202 HIC VFWAPI ICOpen(DWORD fccType,DWORD fccHandler,UINT wMode) { 204 chartype[5],handler[5],codecname[20];205 ICOPENicopen;206 HDRVRhdrv;207 HIC16hic;208 WINE_HIC*whic;209 210 memcpy(type,&fccType,4);type[4]=0;211 memcpy(handler,&fccHandler,4);handler[4]=0;212 TRACE("(%s,%s,0x%08lx)\n",type,handler,(DWORD)wMode);213 214 sprintf(codecname,"%s.%s",type,handler);215 216 /* Well, lParam2 is in fact a LPVIDEO_OPEN_PARMS, but it has the 217 * same layout as ICOPEN218 */219 icopen.fccType= fccType;220 icopen.fccHandler= fccHandler;221 icopen.dwSize= sizeof(ICOPEN);222 icopen.dwFlags= wMode;223 /* FIXME: do we need to fill out the rest too? */224 hdrv=OpenDriverA(codecname,"drivers32",(LPARAM)&icopen);225 if (!hdrv) {226 if (!strcasecmp(type,"vids")) {227 sprintf(codecname,"vidc.%s",handler);228 fccType = mmioFOURCC('v','i','d','c');229 }230 hdrv=OpenDriverA(codecname,"drivers32",(LPARAM)&icopen);231 if (!hdrv)232 return 0;233 }234 /* The handle should be a valid 16-bit handle as well */235 hic = GlobalAlloc16(GHND,sizeof(WINE_HIC));236 whic = (WINE_HIC*)GlobalLock16(hic);237 whic->hdrv= hdrv;238 whic->driverproc= NULL;203 char type[5],handler[5],codecname[20]; 204 ICOPEN icopen; 205 HDRVR hdrv; 206 HIC16 hic; 207 WINE_HIC *whic; 208 209 memcpy(type,&fccType,4);type[4]=0; 210 memcpy(handler,&fccHandler,4);handler[4]=0; 211 TRACE("(%s,%s,0x%08lx)\n",type,handler,(DWORD)wMode); 212 213 sprintf(codecname,"%s.%s",type,handler); 214 215 /* Well, lParam2 is in fact a LPVIDEO_OPEN_PARMS, but it has the 216 * same layout as ICOPEN 217 */ 218 icopen.fccType = fccType; 219 icopen.fccHandler = fccHandler; 220 icopen.dwSize = sizeof(ICOPEN); 221 icopen.dwFlags = wMode; 222 /* FIXME: do we need to fill out the rest too? */ 223 hdrv=OpenDriverA(codecname,"drivers32",(LPARAM)&icopen); 224 if (!hdrv) { 225 if (!strcasecmp(type,"vids")) { 226 sprintf(codecname,"vidc.%s",handler); 227 fccType = mmioFOURCC('v','i','d','c'); 228 } 229 hdrv=OpenDriverA(codecname,"drivers32",(LPARAM)&icopen); 230 if (!hdrv) 231 return 0; 232 } 233 /* The handle should be a valid 16-bit handle as well */ 234 hic = GlobalAlloc16(GHND,sizeof(WINE_HIC)); 235 whic = (WINE_HIC*)GlobalLock16(hic); 236 whic->hdrv = hdrv; 237 whic->driverproc= NULL; 239 238 #ifdef __WIN32OS2__ 240 whic->privatevfw= 0;239 whic->privatevfw = 0; 241 240 #else 242 whic->private= 0;243 #endif 244 GlobalUnlock16(hic);245 TRACE("=> 0x%08lx\n",(DWORD)hic);246 return hic;241 whic->private = 0; 242 #endif 243 GlobalUnlock16(hic); 244 TRACE("=> 0x%08lx\n",(DWORD)hic); 245 return hic; 247 246 } 248 247 249 248 HIC MSVIDEO_OpenFunc(DWORD fccType, DWORD fccHandler, UINT wMode, FARPROC lpfnHandler, BOOL bFrom32) { 250 chartype[5],handler[5],codecname[20];251 HIC16hic;252 ICOPEN* icopen = SEGPTR_NEW(ICOPEN);253 WINE_HIC*whic;254 255 memcpy(type,&fccType,4);type[4]=0;256 memcpy(handler,&fccHandler,4);handler[4]=0;257 TRACE("(%s,%s,%d,%p,%d)\n",type,handler,wMode,lpfnHandler,bFrom32?32:16);258 259 icopen->fccType= fccType;260 icopen->fccHandler= fccHandler;261 icopen->dwSize= sizeof(ICOPEN);262 icopen->dwFlags= wMode;263 264 sprintf(codecname,"%s.%s",type,handler);265 266 hic = GlobalAlloc16(GHND,sizeof(WINE_HIC));267 if (!hic)268 return 0;269 whic = GlobalLock16(hic);270 whic->driverproc = lpfnHandler;271 249 char type[5],handler[5],codecname[20]; 250 HIC16 hic; 251 ICOPEN* icopen = SEGPTR_NEW(ICOPEN); 252 WINE_HIC *whic; 253 254 memcpy(type,&fccType,4);type[4]=0; 255 memcpy(handler,&fccHandler,4);handler[4]=0; 256 TRACE("(%s,%s,%d,%p,%d)\n",type,handler,wMode,lpfnHandler,bFrom32?32:16); 257 258 icopen->fccType = fccType; 259 icopen->fccHandler = fccHandler; 260 icopen->dwSize = sizeof(ICOPEN); 261 icopen->dwFlags = wMode; 262 263 sprintf(codecname,"%s.%s",type,handler); 264 265 hic = GlobalAlloc16(GHND,sizeof(WINE_HIC)); 266 if (!hic) 267 return 0; 268 whic = GlobalLock16(hic); 269 whic->driverproc = lpfnHandler; 270 272 271 #ifdef __WIN32OS2__ 273 whic->privatevfw= bFrom32;272 whic->privatevfw = bFrom32; 274 273 #else 275 whic->private = bFrom32;276 #endif 277 278 /* Now try opening/loading the driver. Taken from DRIVER_AddToList */279 /* What if the function is used more than once? */280 281 if (MSVIDEO_SendMessage(hic,DRV_LOAD,0L,0L,bFrom32) != DRV_SUCCESS) {282 WARN("DRV_LOAD failed for hic 0x%08lx\n",(DWORD)hic);283 GlobalFree16(hic);284 return 0;285 }286 /* return value is not checked */287 MSVIDEO_SendMessage(hic,DRV_ENABLE,0L,0L,bFrom32);288 289 whic->hdrv = MSVIDEO_SendMessage(hic,DRV_OPEN,0,(LPARAM)(SEGPTR_GET(icopen)),FALSE);290 if (whic->hdrv == 0) {291 WARN("DRV_OPEN failed for hic 0x%08lx\n",(DWORD)hic);292 GlobalFree16(hic);293 return 0;294 }295 296 GlobalUnlock16(hic);297 TRACE("=> 0x%08lx\n",(DWORD)hic);298 return hic;299 } 300 301 /*********************************************************************** 302 * ICOpenFunction[MSVFW32.@]274 whic->private = bFrom32; 275 #endif 276 277 /* Now try opening/loading the driver. Taken from DRIVER_AddToList */ 278 /* What if the function is used more than once? */ 279 280 if (MSVIDEO_SendMessage(hic,DRV_LOAD,0L,0L,bFrom32) != DRV_SUCCESS) { 281 WARN("DRV_LOAD failed for hic 0x%08lx\n",(DWORD)hic); 282 GlobalFree16(hic); 283 return 0; 284 } 285 /* return value is not checked */ 286 MSVIDEO_SendMessage(hic,DRV_ENABLE,0L,0L,bFrom32); 287 288 whic->hdrv = MSVIDEO_SendMessage(hic,DRV_OPEN,0,(LPARAM)(SEGPTR_GET(icopen)),FALSE); 289 if (whic->hdrv == 0) { 290 WARN("DRV_OPEN failed for hic 0x%08lx\n",(DWORD)hic); 291 GlobalFree16(hic); 292 return 0; 293 } 294 295 GlobalUnlock16(hic); 296 TRACE("=> 0x%08lx\n",(DWORD)hic); 297 return hic; 298 } 299 300 /*********************************************************************** 301 * ICOpenFunction [MSVFW32.@] 303 302 */ 304 303 HIC VFWAPI ICOpenFunction(DWORD fccType, DWORD fccHandler, UINT wMode, FARPROC lpfnHandler) { 305 return MSVIDEO_OpenFunc(fccType,fccHandler,wMode,lpfnHandler,TRUE);304 return MSVIDEO_OpenFunc(fccType,fccHandler,wMode,lpfnHandler,TRUE); 306 305 } 307 306 308 307 #ifndef __WIN32OS2__ 309 308 /*********************************************************************** 310 * ICOpen[MSVIDEO.203]309 * ICOpen [MSVIDEO.203] 311 310 */ 312 311 HIC16 VFWAPI ICOpen16(DWORD fccType, DWORD fccHandler, UINT16 wMode) { 313 return (HIC16)ICOpen(fccType, fccHandler, wMode);314 } 315 316 /*********************************************************************** 317 * ICOpenFunction[MSVIDEO.206]312 return (HIC16)ICOpen(fccType, fccHandler, wMode); 313 } 314 315 /*********************************************************************** 316 * ICOpenFunction [MSVIDEO.206] 318 317 */ 319 318 HIC16 VFWAPI ICOpenFunction16(DWORD fccType, DWORD fccHandler, UINT16 wMode, FARPROC16 lpfnHandler) 320 319 { 321 return MSVIDEO_OpenFunc(fccType, fccHandler, wMode, (FARPROC)lpfnHandler,FALSE);322 } 323 #endif 324 325 /*********************************************************************** 326 * ICGetInfo[MSVFW32.@]320 return MSVIDEO_OpenFunc(fccType, fccHandler, wMode, (FARPROC)lpfnHandler,FALSE); 321 } 322 #endif 323 324 /*********************************************************************** 325 * ICGetInfo [MSVFW32.@] 327 326 */ 328 327 LRESULT VFWAPI ICGetInfo(HIC hic,ICINFO *picinfo,DWORD cb) { 329 LRESULTret;330 331 TRACE("(0x%08lx,%p,%ld)\n",(DWORD)hic,picinfo,cb);332 ret = ICSendMessage(hic,ICM_GETINFO,(DWORD)picinfo,cb);333 TRACE("-> 0x%08lx\n",ret);334 return ret;328 LRESULT ret; 329 330 TRACE("(0x%08lx,%p,%ld)\n",(DWORD)hic,picinfo,cb); 331 ret = ICSendMessage(hic,ICM_GETINFO,(DWORD)picinfo,cb); 332 TRACE(" -> 0x%08lx\n",ret); 333 return ret; 335 334 } 336 335 337 336 #ifndef __WIN32OS2__ 338 337 /*********************************************************************** 339 * ICGetInfo[MSVIDEO.212]338 * ICGetInfo [MSVIDEO.212] 340 339 */ 341 340 LRESULT VFWAPI ICGetInfo16(HIC16 hic, ICINFO16 *picinfo,DWORD cb) { 342 LRESULTret;343 344 TRACE("(0x%08lx,%p,%ld)\n",(DWORD)hic,picinfo,cb);345 ret = ICSendMessage16(hic,ICM_GETINFO,(DWORD)picinfo,cb);346 TRACE("-> 0x%08lx\n",ret);347 return ret;348 } 349 #endif 350 351 /*********************************************************************** 352 * ICLocate[MSVFW32.@]341 LRESULT ret; 342 343 TRACE("(0x%08lx,%p,%ld)\n",(DWORD)hic,picinfo,cb); 344 ret = ICSendMessage16(hic,ICM_GETINFO,(DWORD)picinfo,cb); 345 TRACE(" -> 0x%08lx\n",ret); 346 return ret; 347 } 348 #endif 349 350 /*********************************************************************** 351 * ICLocate [MSVFW32.@] 353 352 */ 354 353 HIC VFWAPI ICLocate( 355 DWORD fccType, DWORD fccHandler, LPBITMAPINFOHEADER lpbiIn,356 LPBITMAPINFOHEADER lpbiOut, WORD wMode)354 DWORD fccType, DWORD fccHandler, LPBITMAPINFOHEADER lpbiIn, 355 LPBITMAPINFOHEADER lpbiOut, WORD wMode) 357 356 { 358 chartype[5],handler[5];359 HIChic;360 DWORDquerymsg;361 LPSTR pszBuffer;362 363 type[4]=0;memcpy(type,&fccType,4);364 handler[4]=0;memcpy(handler,&fccHandler,4);365 366 TRACE("(%s,%s,%p,%p,0x%04x)\n", type, handler, lpbiIn, lpbiOut, wMode);367 368 switch (wMode) {369 case ICMODE_FASTCOMPRESS:370 case ICMODE_COMPRESS: 371 querymsg = ICM_COMPRESS_QUERY;372 break;373 case ICMODE_FASTDECOMPRESS:374 case ICMODE_DECOMPRESS:375 querymsg = ICM_DECOMPRESS_QUERY;376 break;377 case ICMODE_DRAW:378 querymsg = ICM_DRAW_QUERY;379 break;380 default:381 WARN("Unknown mode (%d)\n",wMode);382 return 0;383 }384 385 /* Easy case: handler/type match, we just fire a query and return */386 hic = ICOpen(fccType,fccHandler,wMode);387 if (hic) {388 if (!ICSendMessage(hic,querymsg,(DWORD)lpbiIn,(DWORD)lpbiOut))389 return hic;390 ICClose(hic);391 }392 393 type[4]='.';memcpy(type,&fccType,4);394 handler[4]='.';memcpy(handler,&fccHandler,4);395 396 /* Now try each driver in turn. 32 bit codecs only. */397 /* FIXME: Move this to an init routine? */398 399 pszBuffer = (LPSTR)HeapAlloc(GetProcessHeap(),0,1024);400 if (GetPrivateProfileSectionA("drivers32",pszBuffer,1024,"system.ini")) {401 char* s = pszBuffer;402 while (*s) {403 if (!strncasecmp(type,s,5)) {404 char *s2 = s;405 while (*s2 != '\0' && *s2 != '.') s2++;406 if (*s2++) {407 HIC h;408 409 h = ICOpen(fccType,*(DWORD*)s2,wMode);410 if (h) {411 if (!ICSendMessage(h,querymsg,(DWORD)lpbiIn,(DWORD)lpbiOut))412 return h;413 ICClose(h);414 }415 }416 }417 s += strlen(s) + 1;418 }419 }420 HeapFree(GetProcessHeap(),0,pszBuffer);421 422 if (fccType==streamtypeVIDEO) {423 hic = ICLocate(ICTYPE_VIDEO,fccHandler,lpbiIn,lpbiOut,wMode);424 if (hic)425 return hic;426 }427 428 type[4] = handler[4] = '\0';429 WARN("(%.4s,%.4s,%p,%p,0x%04x) not found!\n",type,handler,lpbiIn,lpbiOut,wMode);430 return 0;357 char type[5],handler[5]; 358 HIC hic; 359 DWORD querymsg; 360 LPSTR pszBuffer; 361 362 type[4]=0;memcpy(type,&fccType,4); 363 handler[4]=0;memcpy(handler,&fccHandler,4); 364 365 TRACE("(%s,%s,%p,%p,0x%04x)\n", type, handler, lpbiIn, lpbiOut, wMode); 366 367 switch (wMode) { 368 case ICMODE_FASTCOMPRESS: 369 case ICMODE_COMPRESS: 370 querymsg = ICM_COMPRESS_QUERY; 371 break; 372 case ICMODE_FASTDECOMPRESS: 373 case ICMODE_DECOMPRESS: 374 querymsg = ICM_DECOMPRESS_QUERY; 375 break; 376 case ICMODE_DRAW: 377 querymsg = ICM_DRAW_QUERY; 378 break; 379 default: 380 WARN("Unknown mode (%d)\n",wMode); 381 return 0; 382 } 383 384 /* Easy case: handler/type match, we just fire a query and return */ 385 hic = ICOpen(fccType,fccHandler,wMode); 386 if (hic) { 387 if (!ICSendMessage(hic,querymsg,(DWORD)lpbiIn,(DWORD)lpbiOut)) 388 return hic; 389 ICClose(hic); 390 } 391 392 type[4]='.';memcpy(type,&fccType,4); 393 handler[4]='.';memcpy(handler,&fccHandler,4); 394 395 /* Now try each driver in turn. 32 bit codecs only. */ 396 /* FIXME: Move this to an init routine? */ 397 398 pszBuffer = (LPSTR)HeapAlloc(GetProcessHeap(),0,1024); 399 if (GetPrivateProfileSectionA("drivers32",pszBuffer,1024,"system.ini")) { 400 char* s = pszBuffer; 401 while (*s) { 402 if (!strncasecmp(type,s,5)) { 403 char *s2 = s; 404 while (*s2 != '\0' && *s2 != '.') s2++; 405 if (*s2++) { 406 HIC h; 407 408 h = ICOpen(fccType,*(DWORD*)s2,wMode); 409 if (h) { 410 if (!ICSendMessage(h,querymsg,(DWORD)lpbiIn,(DWORD)lpbiOut)) 411 return h; 412 ICClose(h); 413 } 414 } 415 } 416 s += strlen(s) + 1; 417 } 418 } 419 HeapFree(GetProcessHeap(),0,pszBuffer); 420 421 if (fccType==streamtypeVIDEO) { 422 hic = ICLocate(ICTYPE_VIDEO,fccHandler,lpbiIn,lpbiOut,wMode); 423 if (hic) 424 return hic; 425 } 426 427 type[4] = handler[4] = '\0'; 428 WARN("(%.4s,%.4s,%p,%p,0x%04x) not found!\n",type,handler,lpbiIn,lpbiOut,wMode); 429 return 0; 431 430 } 432 431 433 432 #ifndef __WIN32OS2__ 434 433 /*********************************************************************** 435 * ICLocate[MSVIDEO.213]434 * ICLocate [MSVIDEO.213] 436 435 */ 437 436 HIC16 VFWAPI ICLocate16(DWORD fccType, DWORD fccHandler, LPBITMAPINFOHEADER lpbiIn, 438 LPBITMAPINFOHEADER lpbiOut, WORD wFlags) {439 return (HIC16)ICLocate(fccType, fccHandler, lpbiIn, lpbiOut, wFlags);440 } 441 #endif 442 443 /*********************************************************************** 444 * ICGetDisplayFormat[MSVFW32.@]437 LPBITMAPINFOHEADER lpbiOut, WORD wFlags) { 438 return (HIC16)ICLocate(fccType, fccHandler, lpbiIn, lpbiOut, wFlags); 439 } 440 #endif 441 442 /*********************************************************************** 443 * ICGetDisplayFormat [MSVFW32.@] 445 444 */ 446 445 HIC VFWAPI ICGetDisplayFormat( 447 HIC hic,LPBITMAPINFOHEADER lpbiIn,LPBITMAPINFOHEADER lpbiOut,448 INT depth,INT dx,INT dy)446 HIC hic,LPBITMAPINFOHEADER lpbiIn,LPBITMAPINFOHEADER lpbiOut, 447 INT depth,INT dx,INT dy) 449 448 { 450 HIC tmphic = hic; 451 452 FIXME("(0x%08lx,%p,%p,%d,%d,%d),stub!\n",(DWORD)hic,lpbiIn,lpbiOut,depth,dx,dy);453 if (!tmphic) {454 tmphic=ICLocate(ICTYPE_VIDEO,0,lpbiIn,NULL,ICMODE_DECOMPRESS);455 if (!tmphic)456 return tmphic;457 }458 if ((dy == lpbiIn->biHeight) && (dx == lpbiIn->biWidth))459 dy = dx = 0; /* no resize needed */460 461 /* Can we decompress it ? */462 if (ICDecompressQuery(tmphic,lpbiIn,NULL) != 0)463 goto errout; /* no, sorry */464 465 ICDecompressGetFormat(tmphic,lpbiIn,lpbiOut);466 467 if (lpbiOut->biCompression != 0) {468 FIXME("Ooch, how come decompressor outputs compressed data (%ld)??\n",469 lpbiOut->biCompression);470 }471 if (lpbiOut->biSize < sizeof(*lpbiOut)) {472 FIXME("Ooch, size of output BIH is too small (%ld)\n",473 lpbiOut->biSize);474 lpbiOut->biSize = sizeof(*lpbiOut);475 }476 if (!depth) {477 HDChdc;478 479 hdc = GetDC(0);480 depth = GetDeviceCaps(hdc,BITSPIXEL)*GetDeviceCaps(hdc,PLANES);481 ReleaseDC(0,hdc);482 if (depth==15)depth = 16;483 if (depth<8)depth = 8;484 }485 if (lpbiIn->biBitCount == 8)486 depth = 8;487 488 TRACE("=> 0x%08lx\n",(DWORD)tmphic);489 return tmphic;449 HIC tmphic = hic; 450 451 FIXME("(0x%08lx,%p,%p,%d,%d,%d),stub!\n",(DWORD)hic,lpbiIn,lpbiOut,depth,dx,dy); 452 if (!tmphic) { 453 tmphic=ICLocate(ICTYPE_VIDEO,0,lpbiIn,NULL,ICMODE_DECOMPRESS); 454 if (!tmphic) 455 return tmphic; 456 } 457 if ((dy == lpbiIn->biHeight) && (dx == lpbiIn->biWidth)) 458 dy = dx = 0; /* no resize needed */ 459 460 /* Can we decompress it ? */ 461 if (ICDecompressQuery(tmphic,lpbiIn,NULL) != 0) 462 goto errout; /* no, sorry */ 463 464 ICDecompressGetFormat(tmphic,lpbiIn,lpbiOut); 465 466 if (lpbiOut->biCompression != 0) { 467 FIXME("Ooch, how come decompressor outputs compressed data (%ld)??\n", 468 lpbiOut->biCompression); 469 } 470 if (lpbiOut->biSize < sizeof(*lpbiOut)) { 471 FIXME("Ooch, size of output BIH is too small (%ld)\n", 472 lpbiOut->biSize); 473 lpbiOut->biSize = sizeof(*lpbiOut); 474 } 475 if (!depth) { 476 HDC hdc; 477 478 hdc = GetDC(0); 479 depth = GetDeviceCaps(hdc,BITSPIXEL)*GetDeviceCaps(hdc,PLANES); 480 ReleaseDC(0,hdc); 481 if (depth==15) depth = 16; 482 if (depth<8) depth = 8; 483 } 484 if (lpbiIn->biBitCount == 8) 485 depth = 8; 486 487 TRACE("=> 0x%08lx\n",(DWORD)tmphic); 488 return tmphic; 490 489 errout: 491 if (hic!=tmphic)492 ICClose(tmphic);493 494 TRACE("=> 0\n");495 return 0;490 if (hic!=tmphic) 491 ICClose(tmphic); 492 493 TRACE("=> 0\n"); 494 return 0; 496 495 } 497 496 498 497 #ifndef __WIN32OS2__ 499 498 /*********************************************************************** 500 * ICGetDisplayFormat[MSVIDEO.239]499 * ICGetDisplayFormat [MSVIDEO.239] 501 500 */ 502 501 HIC16 VFWAPI ICGetDisplayFormat16(HIC16 hic, LPBITMAPINFOHEADER lpbiIn, 503 LPBITMAPINFOHEADER lpbiOut, INT16 depth, INT16 dx, INT16 dy) {504 return (HIC16)ICGetDisplayFormat(hic,lpbiIn,lpbiOut,depth,dx,dy);505 } 506 #endif 507 508 /*********************************************************************** 509 * ICCompress[MSVFW32.@]502 LPBITMAPINFOHEADER lpbiOut, INT16 depth, INT16 dx, INT16 dy) { 503 return (HIC16)ICGetDisplayFormat(hic,lpbiIn,lpbiOut,depth,dx,dy); 504 } 505 #endif 506 507 /*********************************************************************** 508 * ICCompress [MSVFW32.@] 510 509 */ 511 510 DWORD VFWAPIV 512 511 ICCompress( 513 HIC hic,DWORD dwFlags,LPBITMAPINFOHEADER lpbiOutput,LPVOID lpData,514 LPBITMAPINFOHEADER lpbiInput,LPVOID lpBits,LPDWORD lpckid,515 LPDWORD lpdwFlags,LONG lFrameNum,DWORD dwFrameSize,DWORD dwQuality,516 LPBITMAPINFOHEADER lpbiPrev,LPVOID lpPrev)512 HIC hic,DWORD dwFlags,LPBITMAPINFOHEADER lpbiOutput,LPVOID lpData, 513 LPBITMAPINFOHEADER lpbiInput,LPVOID lpBits,LPDWORD lpckid, 514 LPDWORD lpdwFlags,LONG lFrameNum,DWORD dwFrameSize,DWORD dwQuality, 515 LPBITMAPINFOHEADER lpbiPrev,LPVOID lpPrev) 517 516 { 518 ICCOMPRESSiccmp;519 520 TRACE("(0x%08lx,%ld,%p,%p,%p,%p,...)\n",(DWORD)hic,dwFlags,lpbiOutput,lpData,lpbiInput,lpBits);521 522 iccmp.dwFlags= dwFlags;523 524 iccmp.lpbiOutput= lpbiOutput;525 iccmp.lpOutput= lpData;526 iccmp.lpbiInput= lpbiInput;527 iccmp.lpInput= lpBits;528 529 iccmp.lpckid= lpckid;530 iccmp.lpdwFlags= lpdwFlags;531 iccmp.lFrameNum= lFrameNum;532 iccmp.dwFrameSize= dwFrameSize;533 iccmp.dwQuality= dwQuality;534 iccmp.lpbiPrev= lpbiPrev;535 iccmp.lpPrev= lpPrev;536 return ICSendMessage(hic,ICM_COMPRESS,(DWORD)&iccmp,sizeof(iccmp));517 ICCOMPRESS iccmp; 518 519 TRACE("(0x%08lx,%ld,%p,%p,%p,%p,...)\n",(DWORD)hic,dwFlags,lpbiOutput,lpData,lpbiInput,lpBits); 520 521 iccmp.dwFlags = dwFlags; 522 523 iccmp.lpbiOutput = lpbiOutput; 524 iccmp.lpOutput = lpData; 525 iccmp.lpbiInput = lpbiInput; 526 iccmp.lpInput = lpBits; 527 528 iccmp.lpckid = lpckid; 529 iccmp.lpdwFlags = lpdwFlags; 530 iccmp.lFrameNum = lFrameNum; 531 iccmp.dwFrameSize = dwFrameSize; 532 iccmp.dwQuality = dwQuality; 533 iccmp.lpbiPrev = lpbiPrev; 534 iccmp.lpPrev = lpPrev; 535 return ICSendMessage(hic,ICM_COMPRESS,(DWORD)&iccmp,sizeof(iccmp)); 537 536 } 538 537 539 538 #ifndef __WIN32OS2__ 540 539 /*********************************************************************** 541 * _ICCompress[MSVIDEO.224]540 * _ICCompress [MSVIDEO.224] 542 541 */ 543 542 DWORD VFWAPIV ICCompress16(HIC16 hic, DWORD dwFlags, LPBITMAPINFOHEADER lpbiOutput, LPVOID lpData, 544 LPBITMAPINFOHEADER lpbiInput, LPVOID lpBits, LPDWORD lpckid,545 LPDWORD lpdwFlags, LONG lFrameNum, DWORD dwFrameSize, DWORD dwQuality,546 LPBITMAPINFOHEADER lpbiPrev, LPVOID lpPrev) {547 548 DWORD ret;549 ICCOMPRESS *iccmp = SEGPTR_NEW(ICCOMPRESS);550 551 TRACE("(0x%08lx,%ld,%p,%p,%p,%p,...)\n",(DWORD)hic,dwFlags,lpbiOutput,lpData,lpbiInput,lpBits);552 553 iccmp->dwFlags= dwFlags;554 555 iccmp->lpbiOutput= lpbiOutput;556 iccmp->lpOutput= lpData;557 iccmp->lpbiInput= lpbiInput;558 iccmp->lpInput= lpBits;559 560 iccmp->lpckid= lpckid;561 iccmp->lpdwFlags= lpdwFlags;562 iccmp->lFrameNum= lFrameNum;563 iccmp->dwFrameSize= dwFrameSize;564 iccmp->dwQuality= dwQuality;565 iccmp->lpbiPrev= lpbiPrev;566 iccmp->lpPrev= lpPrev;567 ret = ICSendMessage16(hic,ICM_COMPRESS,(DWORD)SEGPTR_GET(iccmp),sizeof(ICCOMPRESS));568 SEGPTR_FREE(iccmp);569 return ret;570 } 571 #endif 572 573 /*********************************************************************** 574 * ICDecompress[MSVFW32.@]543 LPBITMAPINFOHEADER lpbiInput, LPVOID lpBits, LPDWORD lpckid, 544 LPDWORD lpdwFlags, LONG lFrameNum, DWORD dwFrameSize, DWORD dwQuality, 545 LPBITMAPINFOHEADER lpbiPrev, LPVOID lpPrev) { 546 547 DWORD ret; 548 ICCOMPRESS *iccmp = SEGPTR_NEW(ICCOMPRESS); 549 550 TRACE("(0x%08lx,%ld,%p,%p,%p,%p,...)\n",(DWORD)hic,dwFlags,lpbiOutput,lpData,lpbiInput,lpBits); 551 552 iccmp->dwFlags = dwFlags; 553 554 iccmp->lpbiOutput = lpbiOutput; 555 iccmp->lpOutput = lpData; 556 iccmp->lpbiInput = lpbiInput; 557 iccmp->lpInput = lpBits; 558 559 iccmp->lpckid = lpckid; 560 iccmp->lpdwFlags = lpdwFlags; 561 iccmp->lFrameNum = lFrameNum; 562 iccmp->dwFrameSize = dwFrameSize; 563 iccmp->dwQuality = dwQuality; 564 iccmp->lpbiPrev = lpbiPrev; 565 iccmp->lpPrev = lpPrev; 566 ret = ICSendMessage16(hic,ICM_COMPRESS,(DWORD)SEGPTR_GET(iccmp),sizeof(ICCOMPRESS)); 567 SEGPTR_FREE(iccmp); 568 return ret; 569 } 570 #endif 571 572 /*********************************************************************** 573 * ICDecompress [MSVFW32.@] 575 574 */ 576 575 DWORD VFWAPIV ICDecompress(HIC hic,DWORD dwFlags,LPBITMAPINFOHEADER lpbiFormat, 577 LPVOID lpData,LPBITMAPINFOHEADER lpbi,LPVOID lpBits)576 LPVOID lpData,LPBITMAPINFOHEADER lpbi,LPVOID lpBits) 578 577 { 579 ICDECOMPRESSicd;580 DWORD ret;581 582 TRACE("(0x%08lx,%ld,%p,%p,%p,%p)\n",(DWORD)hic,dwFlags,lpbiFormat,lpData,lpbi,lpBits);583 584 TRACE("lpBits[0] == %ld\n",((LPDWORD)lpBits)[0]);585 586 icd.dwFlags= dwFlags;587 icd.lpbiInput= lpbiFormat;588 icd.lpInput= lpData;589 590 icd.lpbiOutput= lpbi;591 icd.lpOutput= lpBits;592 icd.ckid= 0;593 ret = ICSendMessage(hic,ICM_DECOMPRESS,(DWORD)&icd,sizeof(ICDECOMPRESS));594 595 TRACE("lpBits[0] == %ld\n",((LPDWORD)lpBits)[0]);596 597 TRACE("-> %ld\n",ret);598 599 return ret;578 ICDECOMPRESS icd; 579 DWORD ret; 580 581 TRACE("(0x%08lx,%ld,%p,%p,%p,%p)\n",(DWORD)hic,dwFlags,lpbiFormat,lpData,lpbi,lpBits); 582 583 TRACE("lpBits[0] == %ld\n",((LPDWORD)lpBits)[0]); 584 585 icd.dwFlags = dwFlags; 586 icd.lpbiInput = lpbiFormat; 587 icd.lpInput = lpData; 588 589 icd.lpbiOutput = lpbi; 590 icd.lpOutput = lpBits; 591 icd.ckid = 0; 592 ret = ICSendMessage(hic,ICM_DECOMPRESS,(DWORD)&icd,sizeof(ICDECOMPRESS)); 593 594 TRACE("lpBits[0] == %ld\n",((LPDWORD)lpBits)[0]); 595 596 TRACE("-> %ld\n",ret); 597 598 return ret; 600 599 } 601 600 602 601 #ifndef __WIN32OS2__ 603 602 /*********************************************************************** 604 * _ICDecompress[MSVIDEO.230]603 * _ICDecompress [MSVIDEO.230] 605 604 */ 606 605 DWORD VFWAPIV ICDecompress16(HIC16 hic, DWORD dwFlags, LPBITMAPINFOHEADER lpbiFormat, 607 LPVOID lpData, LPBITMAPINFOHEADER lpbi, LPVOID lpBits) {608 609 ICDECOMPRESS *icd = SEGPTR_NEW(ICDECOMPRESS);610 DWORD ret;611 612 TRACE("(0x%08lx,%ld,%p,%p,%p,%p)\n",(DWORD)hic,dwFlags,lpbiFormat,lpData,lpbi,lpBits);613 614 icd->dwFlags = dwFlags;615 icd->lpbiInput = lpbiFormat;616 icd->lpInput = lpData;617 icd->lpbiOutput = lpbi;618 icd->lpOutput = lpBits;619 icd->ckid = 0;620 621 ret = ICSendMessage16(hic,ICM_DECOMPRESS,(DWORD)SEGPTR_GET(icd),sizeof(ICDECOMPRESS));622 623 SEGPTR_FREE(icd);624 return ret;606 LPVOID lpData, LPBITMAPINFOHEADER lpbi, LPVOID lpBits) { 607 608 ICDECOMPRESS *icd = SEGPTR_NEW(ICDECOMPRESS); 609 DWORD ret; 610 611 TRACE("(0x%08lx,%ld,%p,%p,%p,%p)\n",(DWORD)hic,dwFlags,lpbiFormat,lpData,lpbi,lpBits); 612 613 icd->dwFlags = dwFlags; 614 icd->lpbiInput = lpbiFormat; 615 icd->lpInput = lpData; 616 icd->lpbiOutput = lpbi; 617 icd->lpOutput = lpBits; 618 icd->ckid = 0; 619 620 ret = ICSendMessage16(hic,ICM_DECOMPRESS,(DWORD)SEGPTR_GET(icd),sizeof(ICDECOMPRESS)); 621 622 SEGPTR_FREE(icd); 623 return ret; 625 624 } 626 625 … … 629 628 630 629 LPVOID MSVIDEO_MapICDEX16To32(LPDWORD lParam) { 631 LPVOID ret;632 633 ICDECOMPRESSEX *icdx = HeapAlloc(GetProcessHeap(),0,sizeof(ICDECOMPRESSEX));634 ICDECOMPRESSEX16 *icdx16 = MapSL(*lParam);635 ret = icdx16;636 637 COPY(icdx,dwFlags);638 COPYPTR(icdx,lpbiSrc);639 COPYPTR(icdx,lpSrc);640 COPYPTR(icdx,lpbiDst);641 COPYPTR(icdx,lpDst);642 COPY(icdx,xDst);643 COPY(icdx,yDst);644 COPY(icdx,dxDst);645 COPY(icdx,dyDst);646 COPY(icdx,xSrc);647 COPY(icdx,ySrc);648 COPY(icdx,dxSrc);649 COPY(icdx,dySrc);650 651 *lParam = (DWORD)(icdx);652 return ret;630 LPVOID ret; 631 632 ICDECOMPRESSEX *icdx = HeapAlloc(GetProcessHeap(),0,sizeof(ICDECOMPRESSEX)); 633 ICDECOMPRESSEX16 *icdx16 = MapSL(*lParam); 634 ret = icdx16; 635 636 COPY(icdx,dwFlags); 637 COPYPTR(icdx,lpbiSrc); 638 COPYPTR(icdx,lpSrc); 639 COPYPTR(icdx,lpbiDst); 640 COPYPTR(icdx,lpDst); 641 COPY(icdx,xDst); 642 COPY(icdx,yDst); 643 COPY(icdx,dxDst); 644 COPY(icdx,dyDst); 645 COPY(icdx,xSrc); 646 COPY(icdx,ySrc); 647 COPY(icdx,dxSrc); 648 COPY(icdx,dySrc); 649 650 *lParam = (DWORD)(icdx); 651 return ret; 653 652 } 654 653 655 654 LPVOID MSVIDEO_MapMsg16To32(UINT msg, LPDWORD lParam1, LPDWORD lParam2) { 656 LPVOID ret = 0;657 658 TRACE("Mapping %d\n",msg);659 660 switch (msg) {661 case DRV_LOAD:662 case DRV_ENABLE:663 case DRV_CLOSE:664 case DRV_DISABLE:665 case DRV_FREE:666 case ICM_ABOUT:667 case ICM_CONFIGURE:668 case ICM_COMPRESS_END:669 case ICM_DECOMPRESS_END:670 case ICM_DECOMPRESSEX_END:671 case ICM_SETQUALITY:672 case ICM_DRAW_START_PLAY:673 case ICM_DRAW_STOP_PLAY:674 case ICM_DRAW_REALIZE:675 case ICM_DRAW_RENDERBUFFER:676 case ICM_DRAW_END:677 break;678 case DRV_OPEN:679 case ICM_GETDEFAULTQUALITY:680 case ICM_GETQUALITY:681 case ICM_SETSTATE:682 case ICM_DRAW_WINDOW:683 case ICM_GETBUFFERSWANTED:684 *lParam1 = (DWORD)MapSL(*lParam1);685 break;686 case ICM_GETINFO:687 {688 ICINFO *ici = HeapAlloc(GetProcessHeap(),0,sizeof(ICINFO));689 ICINFO16 *ici16;690 691 ici16 = MapSL(*lParam1);692 ret = ici16;693 694 ici->dwSize = sizeof(ICINFO);695 COPY(ici,fccType);696 COPY(ici,fccHandler);697 COPY(ici,dwFlags);698 COPY(ici,dwVersion);699 COPY(ici,dwVersionICM);655 LPVOID ret = 0; 656 657 TRACE("Mapping %d\n",msg); 658 659 switch (msg) { 660 case DRV_LOAD: 661 case DRV_ENABLE: 662 case DRV_CLOSE: 663 case DRV_DISABLE: 664 case DRV_FREE: 665 case ICM_ABOUT: 666 case ICM_CONFIGURE: 667 case ICM_COMPRESS_END: 668 case ICM_DECOMPRESS_END: 669 case ICM_DECOMPRESSEX_END: 670 case ICM_SETQUALITY: 671 case ICM_DRAW_START_PLAY: 672 case ICM_DRAW_STOP_PLAY: 673 case ICM_DRAW_REALIZE: 674 case ICM_DRAW_RENDERBUFFER: 675 case ICM_DRAW_END: 676 break; 677 case DRV_OPEN: 678 case ICM_GETDEFAULTQUALITY: 679 case ICM_GETQUALITY: 680 case ICM_SETSTATE: 681 case ICM_DRAW_WINDOW: 682 case ICM_GETBUFFERSWANTED: 683 *lParam1 = (DWORD)MapSL(*lParam1); 684 break; 685 case ICM_GETINFO: 686 { 687 ICINFO *ici = HeapAlloc(GetProcessHeap(),0,sizeof(ICINFO)); 688 ICINFO16 *ici16; 689 690 ici16 = MapSL(*lParam1); 691 ret = ici16; 692 693 ici->dwSize = sizeof(ICINFO); 694 COPY(ici,fccType); 695 COPY(ici,fccHandler); 696 COPY(ici,dwFlags); 697 COPY(ici,dwVersion); 698 COPY(ici,dwVersionICM); 700 699 MultiByteToWideChar( CP_ACP, 0, ici16->szName, -1, ici->szName, 16 ); 701 700 MultiByteToWideChar( CP_ACP, 0, ici16->szDescription, -1, ici->szDescription, 128 ); 702 701 MultiByteToWideChar( CP_ACP, 0, ici16->szDriver, -1, ici->szDriver, 128 ); 703 *lParam1 = (DWORD)(ici);704 *lParam2 = sizeof(ICINFO);705 }706 break;707 case ICM_COMPRESS:708 {709 ICCOMPRESS *icc = HeapAlloc(GetProcessHeap(),0,sizeof(ICCOMPRESS));710 ICCOMPRESS *icc16;711 712 icc16 = MapSL(*lParam1);713 ret = icc16;714 715 COPY(icc,dwFlags);716 COPYPTR(icc,lpbiOutput);717 COPYPTR(icc,lpOutput);718 COPYPTR(icc,lpbiInput);719 COPYPTR(icc,lpInput);720 COPYPTR(icc,lpckid);721 COPYPTR(icc,lpdwFlags);722 COPY(icc,lFrameNum);723 COPY(icc,dwFrameSize);724 COPY(icc,dwQuality);725 COPYPTR(icc,lpbiPrev);726 COPYPTR(icc,lpPrev);727 728 *lParam1 = (DWORD)(icc);729 *lParam2 = sizeof(ICCOMPRESS);730 }731 break;732 case ICM_DECOMPRESS:733 {734 ICDECOMPRESS *icd = HeapAlloc(GetProcessHeap(),0,sizeof(ICDECOMPRESS));735 ICDECOMPRESS *icd16; /* Same structure except for the pointers */736 737 icd16 = MapSL(*lParam1);738 ret = icd16;739 740 COPY(icd,dwFlags);741 COPYPTR(icd,lpbiInput);742 COPYPTR(icd,lpInput);743 COPYPTR(icd,lpbiOutput);744 COPYPTR(icd,lpOutput);745 COPY(icd,ckid);746 747 *lParam1 = (DWORD)(icd);748 *lParam2 = sizeof(ICDECOMPRESS);749 }750 break;751 case ICM_COMPRESS_BEGIN:752 case ICM_COMPRESS_GET_FORMAT:753 case ICM_COMPRESS_GET_SIZE:754 case ICM_COMPRESS_QUERY:755 case ICM_DECOMPRESS_GET_FORMAT:756 case ICM_DECOMPRESS_QUERY:757 case ICM_DECOMPRESS_BEGIN:758 case ICM_DECOMPRESS_SET_PALETTE:759 case ICM_DECOMPRESS_GET_PALETTE:760 *lParam1 = (DWORD)MapSL(*lParam1);761 *lParam2 = (DWORD)MapSL(*lParam2);762 break;763 case ICM_DECOMPRESSEX_QUERY:764 if ((*lParam2 != sizeof(ICDECOMPRESSEX16)) && (*lParam2 != 0))765 WARN("*lParam2 has unknown value %p\n",(ICDECOMPRESSEX16*)*lParam2);766 /* FIXME: *lParm2 is meant to be 0 or an ICDECOMPRESSEX16*, but is sizeof(ICDECOMRPESSEX16)767 * This is because of ICMessage(). Special case it?768 {769 LPVOID* addr = HeapAlloc(GetProcessHeap(),0,2*sizeof(LPVOID));770 addr[0] = MSVIDEO_MapICDEX16To32(lParam1);771 if (*lParam2)772 addr[1] = MSVIDEO_MapICDEX16To32(lParam2);773 else774 addr[1] = 0;775 776 ret = addr;777 }778 break;*/779 case ICM_DECOMPRESSEX_BEGIN:780 case ICM_DECOMPRESSEX:781 ret = MSVIDEO_MapICDEX16To32(lParam1);782 *lParam2 = sizeof(ICDECOMPRESSEX);783 break;784 case ICM_DRAW_BEGIN:785 {786 ICDRAWBEGIN *icdb = HeapAlloc(GetProcessHeap(),0,sizeof(ICDRAWBEGIN));787 ICDRAWBEGIN16 *icdb16 = MapSL(*lParam1);788 ret = icdb16;789 790 COPY(icdb,dwFlags);791 COPY(icdb,hpal);792 COPY(icdb,hwnd);793 COPY(icdb,hdc);794 COPY(icdb,xDst);795 COPY(icdb,yDst);796 COPY(icdb,dxDst);797 COPY(icdb,dyDst);798 COPYPTR(icdb,lpbi);799 COPY(icdb,xSrc);800 COPY(icdb,ySrc);801 COPY(icdb,dxSrc);802 COPY(icdb,dySrc);803 COPY(icdb,dwRate);804 COPY(icdb,dwScale);805 806 *lParam1 = (DWORD)(icdb);807 *lParam2 = sizeof(ICDRAWBEGIN);808 }809 break;810 case ICM_DRAW_SUGGESTFORMAT:811 {812 ICDRAWSUGGEST *icds = HeapAlloc(GetProcessHeap(),0,sizeof(ICDRAWSUGGEST));813 ICDRAWSUGGEST16 *icds16 = MapSL(*lParam1);814 815 ret = icds16;816 817 COPY(icds,dwFlags);818 COPYPTR(icds,lpbiIn);819 COPYPTR(icds,lpbiSuggest);820 COPY(icds,dxSrc);821 COPY(icds,dySrc);822 COPY(icds,dxDst);823 COPY(icds,dyDst);824 COPY(icds,hicDecompressor);825 826 *lParam1 = (DWORD)(icds);827 *lParam2 = sizeof(ICDRAWSUGGEST);828 }829 break;830 case ICM_DRAW:831 {832 ICDRAW *icd = HeapAlloc(GetProcessHeap(),0,sizeof(ICDRAW));833 ICDRAW *icd16 = MapSL(*lParam1);834 ret = icd16;835 836 COPY(icd,dwFlags);837 COPYPTR(icd,lpFormat);838 COPYPTR(icd,lpData);839 COPY(icd,cbData);840 COPY(icd,lTime);841 842 *lParam1 = (DWORD)(icd);843 *lParam2 = sizeof(ICDRAW);844 }845 break;846 case ICM_DRAW_START:847 case ICM_DRAW_STOP:848 break;849 default:850 FIXME("%d is not yet handled. Expect a crash.\n",msg);851 }852 return ret;702 *lParam1 = (DWORD)(ici); 703 *lParam2 = sizeof(ICINFO); 704 } 705 break; 706 case ICM_COMPRESS: 707 { 708 ICCOMPRESS *icc = HeapAlloc(GetProcessHeap(),0,sizeof(ICCOMPRESS)); 709 ICCOMPRESS *icc16; 710 711 icc16 = MapSL(*lParam1); 712 ret = icc16; 713 714 COPY(icc,dwFlags); 715 COPYPTR(icc,lpbiOutput); 716 COPYPTR(icc,lpOutput); 717 COPYPTR(icc,lpbiInput); 718 COPYPTR(icc,lpInput); 719 COPYPTR(icc,lpckid); 720 COPYPTR(icc,lpdwFlags); 721 COPY(icc,lFrameNum); 722 COPY(icc,dwFrameSize); 723 COPY(icc,dwQuality); 724 COPYPTR(icc,lpbiPrev); 725 COPYPTR(icc,lpPrev); 726 727 *lParam1 = (DWORD)(icc); 728 *lParam2 = sizeof(ICCOMPRESS); 729 } 730 break; 731 case ICM_DECOMPRESS: 732 { 733 ICDECOMPRESS *icd = HeapAlloc(GetProcessHeap(),0,sizeof(ICDECOMPRESS)); 734 ICDECOMPRESS *icd16; /* Same structure except for the pointers */ 735 736 icd16 = MapSL(*lParam1); 737 ret = icd16; 738 739 COPY(icd,dwFlags); 740 COPYPTR(icd,lpbiInput); 741 COPYPTR(icd,lpInput); 742 COPYPTR(icd,lpbiOutput); 743 COPYPTR(icd,lpOutput); 744 COPY(icd,ckid); 745 746 *lParam1 = (DWORD)(icd); 747 *lParam2 = sizeof(ICDECOMPRESS); 748 } 749 break; 750 case ICM_COMPRESS_BEGIN: 751 case ICM_COMPRESS_GET_FORMAT: 752 case ICM_COMPRESS_GET_SIZE: 753 case ICM_COMPRESS_QUERY: 754 case ICM_DECOMPRESS_GET_FORMAT: 755 case ICM_DECOMPRESS_QUERY: 756 case ICM_DECOMPRESS_BEGIN: 757 case ICM_DECOMPRESS_SET_PALETTE: 758 case ICM_DECOMPRESS_GET_PALETTE: 759 *lParam1 = (DWORD)MapSL(*lParam1); 760 *lParam2 = (DWORD)MapSL(*lParam2); 761 break; 762 case ICM_DECOMPRESSEX_QUERY: 763 if ((*lParam2 != sizeof(ICDECOMPRESSEX16)) && (*lParam2 != 0)) 764 WARN("*lParam2 has unknown value %p\n",(ICDECOMPRESSEX16*)*lParam2); 765 /* FIXME: *lParm2 is meant to be 0 or an ICDECOMPRESSEX16*, but is sizeof(ICDECOMRPESSEX16) 766 * This is because of ICMessage(). Special case it? 767 { 768 LPVOID* addr = HeapAlloc(GetProcessHeap(),0,2*sizeof(LPVOID)); 769 addr[0] = MSVIDEO_MapICDEX16To32(lParam1); 770 if (*lParam2) 771 addr[1] = MSVIDEO_MapICDEX16To32(lParam2); 772 else 773 addr[1] = 0; 774 775 ret = addr; 776 } 777 break;*/ 778 case ICM_DECOMPRESSEX_BEGIN: 779 case ICM_DECOMPRESSEX: 780 ret = MSVIDEO_MapICDEX16To32(lParam1); 781 *lParam2 = sizeof(ICDECOMPRESSEX); 782 break; 783 case ICM_DRAW_BEGIN: 784 { 785 ICDRAWBEGIN *icdb = HeapAlloc(GetProcessHeap(),0,sizeof(ICDRAWBEGIN)); 786 ICDRAWBEGIN16 *icdb16 = MapSL(*lParam1); 787 ret = icdb16; 788 789 COPY(icdb,dwFlags); 790 COPY(icdb,hpal); 791 COPY(icdb,hwnd); 792 COPY(icdb,hdc); 793 COPY(icdb,xDst); 794 COPY(icdb,yDst); 795 COPY(icdb,dxDst); 796 COPY(icdb,dyDst); 797 COPYPTR(icdb,lpbi); 798 COPY(icdb,xSrc); 799 COPY(icdb,ySrc); 800 COPY(icdb,dxSrc); 801 COPY(icdb,dySrc); 802 COPY(icdb,dwRate); 803 COPY(icdb,dwScale); 804 805 *lParam1 = (DWORD)(icdb); 806 *lParam2 = sizeof(ICDRAWBEGIN); 807 } 808 break; 809 case ICM_DRAW_SUGGESTFORMAT: 810 { 811 ICDRAWSUGGEST *icds = HeapAlloc(GetProcessHeap(),0,sizeof(ICDRAWSUGGEST)); 812 ICDRAWSUGGEST16 *icds16 = MapSL(*lParam1); 813 814 ret = icds16; 815 816 COPY(icds,dwFlags); 817 COPYPTR(icds,lpbiIn); 818 COPYPTR(icds,lpbiSuggest); 819 COPY(icds,dxSrc); 820 COPY(icds,dySrc); 821 COPY(icds,dxDst); 822 COPY(icds,dyDst); 823 COPY(icds,hicDecompressor); 824 825 *lParam1 = (DWORD)(icds); 826 *lParam2 = sizeof(ICDRAWSUGGEST); 827 } 828 break; 829 case ICM_DRAW: 830 { 831 ICDRAW *icd = HeapAlloc(GetProcessHeap(),0,sizeof(ICDRAW)); 832 ICDRAW *icd16 = MapSL(*lParam1); 833 ret = icd16; 834 835 COPY(icd,dwFlags); 836 COPYPTR(icd,lpFormat); 837 COPYPTR(icd,lpData); 838 COPY(icd,cbData); 839 COPY(icd,lTime); 840 841 *lParam1 = (DWORD)(icd); 842 *lParam2 = sizeof(ICDRAW); 843 } 844 break; 845 case ICM_DRAW_START: 846 case ICM_DRAW_STOP: 847 break; 848 default: 849 FIXME("%d is not yet handled. Expect a crash.\n",msg); 850 } 851 return ret; 853 852 } 854 853 … … 857 856 858 857 void MSVIDEO_UnmapMsg16To32(UINT msg, LPVOID data16, LPDWORD lParam1, LPDWORD lParam2) { 859 TRACE("Unmapping %d\n",msg);858 TRACE("Unmapping %d\n",msg); 860 859 861 860 #define UNCOPY(x,y) (x##16->y = x->y); 862 861 863 switch (msg) {864 case ICM_GETINFO:865 {866 ICINFO *ici = (ICINFO*)(*lParam1);867 ICINFO16 *ici16 = (ICINFO16*)data16;868 869 UNCOPY(ici,fccType);870 UNCOPY(ici,fccHandler);871 UNCOPY(ici,dwFlags);872 UNCOPY(ici,dwVersion);873 UNCOPY(ici,dwVersionICM);862 switch (msg) { 863 case ICM_GETINFO: 864 { 865 ICINFO *ici = (ICINFO*)(*lParam1); 866 ICINFO16 *ici16 = (ICINFO16*)data16; 867 868 UNCOPY(ici,fccType); 869 UNCOPY(ici,fccHandler); 870 UNCOPY(ici,dwFlags); 871 UNCOPY(ici,dwVersion); 872 UNCOPY(ici,dwVersionICM); 874 873 WideCharToMultiByte( CP_ACP, 0, ici->szName, -1, ici16->szName, 875 874 sizeof(ici16->szName), NULL, NULL ); … … 878 877 sizeof(ici16->szDescription), NULL, NULL ); 879 878 ici16->szDescription[sizeof(ici16->szDescription)-1] = 0; 880 /* This just gives garbage for some reason - BB881 lstrcpynWtoA(ici16->szDriver,ici->szDriver,128);*/882 883 HeapFree(GetProcessHeap(),0,ici);884 }885 break;886 case ICM_DECOMPRESS_QUERY:887 /*{888 LPVOID* x = data16;889 HeapFree(GetProcessHeap(),0,x[0]);890 if (x[1])891 HeapFree(GetProcessHeap(),0,x[1]);892 }893 break;*/894 case ICM_COMPRESS:895 case ICM_DECOMPRESS:896 case ICM_DECOMPRESSEX_QUERY:897 case ICM_DECOMPRESSEX_BEGIN:898 case ICM_DECOMPRESSEX:899 case ICM_DRAW_BEGIN:900 case ICM_DRAW_SUGGESTFORMAT:901 case ICM_DRAW:902 HeapFree(GetProcessHeap(),0,data16);903 break;904 default:905 ERR("Unmapping unmapped msg %d\n",msg);906 }907 #undef UNCOPY 879 /* This just gives garbage for some reason - BB 880 lstrcpynWtoA(ici16->szDriver,ici->szDriver,128);*/ 881 882 HeapFree(GetProcessHeap(),0,ici); 883 } 884 break; 885 case ICM_DECOMPRESS_QUERY: 886 /*{ 887 LPVOID* x = data16; 888 HeapFree(GetProcessHeap(),0,x[0]); 889 if (x[1]) 890 HeapFree(GetProcessHeap(),0,x[1]); 891 } 892 break;*/ 893 case ICM_COMPRESS: 894 case ICM_DECOMPRESS: 895 case ICM_DECOMPRESSEX_QUERY: 896 case ICM_DECOMPRESSEX_BEGIN: 897 case ICM_DECOMPRESSEX: 898 case ICM_DRAW_BEGIN: 899 case ICM_DRAW_SUGGESTFORMAT: 900 case ICM_DRAW: 901 HeapFree(GetProcessHeap(),0,data16); 902 break; 903 default: 904 ERR("Unmapping unmapped msg %d\n",msg); 905 } 906 #undef UNCOPY 908 907 } 909 908 #endif 910 909 911 910 LRESULT MSVIDEO_SendMessage(HIC hic,UINT msg,DWORD lParam1,DWORD lParam2, BOOL bFrom32) { 912 LRESULTret;913 WINE_HIC*whic = GlobalLock16(hic);914 LPVOID data16 = 0;915 BOOL bDrv32;911 LRESULT ret; 912 WINE_HIC *whic = GlobalLock16(hic); 913 LPVOID data16 = 0; 914 BOOL bDrv32; 916 915 917 916 #define XX(x) case x: TRACE("(0x%08lx,"#x",0x%08lx,0x%08lx,%d)\n",(DWORD)hic,lParam1,lParam2,bFrom32?32:16);break; 918 917 919 switch (msg) {920 /* DRV_* */921 XX(DRV_LOAD);922 XX(DRV_ENABLE);923 XX(DRV_OPEN);924 XX(DRV_CLOSE);925 XX(DRV_DISABLE);926 XX(DRV_FREE);927 /* ICM_RESERVED+X */928 XX(ICM_ABOUT);929 XX(ICM_CONFIGURE);930 XX(ICM_GET);931 XX(ICM_GETINFO);932 XX(ICM_GETDEFAULTQUALITY);933 XX(ICM_GETQUALITY);934 XX(ICM_GETSTATE);935 XX(ICM_SETQUALITY);936 XX(ICM_SET);937 XX(ICM_SETSTATE);938 /* ICM_USER+X */939 XX(ICM_COMPRESS_FRAMES_INFO);940 XX(ICM_COMPRESS_GET_FORMAT);941 XX(ICM_COMPRESS_GET_SIZE);942 XX(ICM_COMPRESS_QUERY);943 XX(ICM_COMPRESS_BEGIN);944 XX(ICM_COMPRESS);945 XX(ICM_COMPRESS_END);946 XX(ICM_DECOMPRESS_GET_FORMAT);947 XX(ICM_DECOMPRESS_QUERY);948 XX(ICM_DECOMPRESS_BEGIN);949 XX(ICM_DECOMPRESS);950 XX(ICM_DECOMPRESS_END);951 XX(ICM_DECOMPRESS_SET_PALETTE);952 XX(ICM_DECOMPRESS_GET_PALETTE);953 XX(ICM_DRAW_QUERY);954 XX(ICM_DRAW_BEGIN);955 XX(ICM_DRAW_GET_PALETTE);956 XX(ICM_DRAW_START);957 XX(ICM_DRAW_STOP);958 XX(ICM_DRAW_END);959 XX(ICM_DRAW_GETTIME);960 XX(ICM_DRAW);961 XX(ICM_DRAW_WINDOW);962 XX(ICM_DRAW_SETTIME);963 XX(ICM_DRAW_REALIZE);964 XX(ICM_DRAW_FLUSH);965 XX(ICM_DRAW_RENDERBUFFER);966 XX(ICM_DRAW_START_PLAY);967 XX(ICM_DRAW_STOP_PLAY);968 XX(ICM_DRAW_SUGGESTFORMAT);969 XX(ICM_DRAW_CHANGEPALETTE);970 XX(ICM_GETBUFFERSWANTED);971 XX(ICM_GETDEFAULTKEYFRAMERATE);972 XX(ICM_DECOMPRESSEX_BEGIN);973 XX(ICM_DECOMPRESSEX_QUERY);974 XX(ICM_DECOMPRESSEX);975 XX(ICM_DECOMPRESSEX_END);976 XX(ICM_SET_STATUS_PROC);977 default:978 FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx,%i) unknown message\n",(DWORD)hic,(DWORD)msg,lParam1,lParam2,bFrom32?32:16);979 }918 switch (msg) { 919 /* DRV_* */ 920 XX(DRV_LOAD); 921 XX(DRV_ENABLE); 922 XX(DRV_OPEN); 923 XX(DRV_CLOSE); 924 XX(DRV_DISABLE); 925 XX(DRV_FREE); 926 /* ICM_RESERVED+X */ 927 XX(ICM_ABOUT); 928 XX(ICM_CONFIGURE); 929 XX(ICM_GET); 930 XX(ICM_GETINFO); 931 XX(ICM_GETDEFAULTQUALITY); 932 XX(ICM_GETQUALITY); 933 XX(ICM_GETSTATE); 934 XX(ICM_SETQUALITY); 935 XX(ICM_SET); 936 XX(ICM_SETSTATE); 937 /* ICM_USER+X */ 938 XX(ICM_COMPRESS_FRAMES_INFO); 939 XX(ICM_COMPRESS_GET_FORMAT); 940 XX(ICM_COMPRESS_GET_SIZE); 941 XX(ICM_COMPRESS_QUERY); 942 XX(ICM_COMPRESS_BEGIN); 943 XX(ICM_COMPRESS); 944 XX(ICM_COMPRESS_END); 945 XX(ICM_DECOMPRESS_GET_FORMAT); 946 XX(ICM_DECOMPRESS_QUERY); 947 XX(ICM_DECOMPRESS_BEGIN); 948 XX(ICM_DECOMPRESS); 949 XX(ICM_DECOMPRESS_END); 950 XX(ICM_DECOMPRESS_SET_PALETTE); 951 XX(ICM_DECOMPRESS_GET_PALETTE); 952 XX(ICM_DRAW_QUERY); 953 XX(ICM_DRAW_BEGIN); 954 XX(ICM_DRAW_GET_PALETTE); 955 XX(ICM_DRAW_START); 956 XX(ICM_DRAW_STOP); 957 XX(ICM_DRAW_END); 958 XX(ICM_DRAW_GETTIME); 959 XX(ICM_DRAW); 960 XX(ICM_DRAW_WINDOW); 961 XX(ICM_DRAW_SETTIME); 962 XX(ICM_DRAW_REALIZE); 963 XX(ICM_DRAW_FLUSH); 964 XX(ICM_DRAW_RENDERBUFFER); 965 XX(ICM_DRAW_START_PLAY); 966 XX(ICM_DRAW_STOP_PLAY); 967 XX(ICM_DRAW_SUGGESTFORMAT); 968 XX(ICM_DRAW_CHANGEPALETTE); 969 XX(ICM_GETBUFFERSWANTED); 970 XX(ICM_GETDEFAULTKEYFRAMERATE); 971 XX(ICM_DECOMPRESSEX_BEGIN); 972 XX(ICM_DECOMPRESSEX_QUERY); 973 XX(ICM_DECOMPRESSEX); 974 XX(ICM_DECOMPRESSEX_END); 975 XX(ICM_SET_STATUS_PROC); 976 default: 977 FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx,%i) unknown message\n",(DWORD)hic,(DWORD)msg,lParam1,lParam2,bFrom32?32:16); 978 } 980 979 981 980 #undef XX 982 981 983 if (!whic) return ICERR_BADHANDLE;984 985 if (whic->driverproc) { /* IC is a function */982 if (!whic) return ICERR_BADHANDLE; 983 984 if (whic->driverproc) { /* IC is a function */ 986 985 #ifdef __WIN32OS2__ 987 bDrv32 = whic->privatevfw;986 bDrv32 = whic->privatevfw; 988 987 #else 989 bDrv32 = whic->private;990 #endif 991 } else {992 bDrv32 = ((GetDriverFlags(whic->hdrv) & (WINE_GDF_EXIST|WINE_GDF_16BIT)) == WINE_GDF_EXIST);993 }988 bDrv32 = whic->private; 989 #endif 990 } else { 991 bDrv32 = ((GetDriverFlags(whic->hdrv) & (WINE_GDF_EXIST|WINE_GDF_16BIT)) == WINE_GDF_EXIST); 992 } 994 993 995 994 #ifndef __WIN32OS2__ 996 if (!bFrom32) {997 if (bDrv32)998 data16 = MSVIDEO_MapMsg16To32(msg,&lParam1,&lParam2);999 } else {1000 if (!bDrv32) {1001 ERR("Can't do 32->16 mappings\n");1002 ret = -1;1003 goto out;1004 }1005 }1006 #endif 1007 1008 if (whic->driverproc) {995 if (!bFrom32) { 996 if (bDrv32) 997 data16 = MSVIDEO_MapMsg16To32(msg,&lParam1,&lParam2); 998 } else { 999 if (!bDrv32) { 1000 ERR("Can't do 32->16 mappings\n"); 1001 ret = -1; 1002 goto out; 1003 } 1004 } 1005 #endif 1006 1007 if (whic->driverproc) { 1009 1008 #ifdef __WIN32OS2__ 1010 ret = whic->driverproc(whic->hdrv,hic,msg,lParam1,lParam2);1009 ret = whic->driverproc(whic->hdrv,hic,msg,lParam1,lParam2); 1011 1010 #else 1012 if (bDrv32) {1013 ret = whic->driverproc(whic->hdrv,hic,msg,lParam1,lParam2);1014 } else {1015 ret = MSVIDEO_CallTo16_long_lwwll((FARPROC16)whic->driverproc,whic->hdrv,hic,msg,lParam1,lParam2);1016 }1017 #endif 1018 } else {1019 ret = SendDriverMessage(whic->hdrv,msg,lParam1,lParam2);1020 }1011 if (bDrv32) { 1012 ret = whic->driverproc(whic->hdrv,hic,msg,lParam1,lParam2); 1013 } else { 1014 ret = MSVIDEO_CallTo16_long_lwwll((FARPROC16)whic->driverproc,whic->hdrv,hic,msg,lParam1,lParam2); 1015 } 1016 #endif 1017 } else { 1018 ret = SendDriverMessage(whic->hdrv,msg,lParam1,lParam2); 1019 } 1021 1020 1022 1021 #ifndef __WIN32OS2__ 1023 if (data16)1024 MSVIDEO_UnmapMsg16To32(msg,data16,&lParam1,&lParam2);1025 #endif 1026 1022 if (data16) 1023 MSVIDEO_UnmapMsg16To32(msg,data16,&lParam1,&lParam2); 1024 #endif 1025 1027 1026 out: 1028 GlobalUnlock16(hic);1029 1030 TRACE("-> 0x%08lx\n",ret);1031 return ret;1032 } 1033 1034 /*********************************************************************** 1035 * ICSendMessage[MSVFW32.@]1027 GlobalUnlock16(hic); 1028 1029 TRACE(" -> 0x%08lx\n",ret); 1030 return ret; 1031 } 1032 1033 /*********************************************************************** 1034 * ICSendMessage [MSVFW32.@] 1036 1035 */ 1037 1036 LRESULT VFWAPI ICSendMessage(HIC hic, UINT msg, DWORD lParam1, DWORD lParam2) { 1038 return MSVIDEO_SendMessage(hic,msg,lParam1,lParam2,TRUE);1037 return MSVIDEO_SendMessage(hic,msg,lParam1,lParam2,TRUE); 1039 1038 } 1040 1039 #ifndef __WIN32OS2__ 1041 1040 /*********************************************************************** 1042 * ICSendMessage[MSVIDEO.205]1041 * ICSendMessage [MSVIDEO.205] 1043 1042 */ 1044 1043 LRESULT VFWAPI ICSendMessage16(HIC16 hic, UINT16 msg, DWORD lParam1, DWORD lParam2) { 1045 return MSVIDEO_SendMessage(hic,msg,lParam1,lParam2,FALSE);1046 } 1047 1048 /*********************************************************************** 1049 * _ICMessage[MSVIDEO.207]1044 return MSVIDEO_SendMessage(hic,msg,lParam1,lParam2,FALSE); 1045 } 1046 1047 /*********************************************************************** 1048 * _ICMessage [MSVIDEO.207] 1050 1049 */ 1051 1050 LRESULT VFWAPIV ICMessage16(void) { 1052 HIC16 hic;1053 UINT16 msg;1054 UINT16 cb;1055 LPWORD lpData;1056 LRESULT ret;1057 UINT16 i;1058 1059 VA_LIST16 valist;1060 1061 VA_START16(valist);1062 hic = VA_ARG16(valist, HIC16);1063 msg = VA_ARG16(valist, UINT16);1064 cb = VA_ARG16(valist, UINT16);1065 1066 lpData = SEGPTR_ALLOC(cb);1067 1068 TRACE("0x%08lx, %u, %u, ...)\n",(DWORD)hic,msg,cb);1069 1070 for(i=0;i<cb/sizeof(WORD);i++) {1071 lpData[i] = VA_ARG16(valist, WORD);1072 }1073 1074 VA_END16(valist);1075 ret = ICSendMessage16(hic, msg, (DWORD)(SEGPTR_GET(lpData)), (DWORD)cb);1076 1077 SEGPTR_FREE(lpData);1078 return ret;1079 } 1080 #endif 1081 /*********************************************************************** 1082 * ICDrawBegin[MSVFW32.@]1051 HIC16 hic; 1052 UINT16 msg; 1053 UINT16 cb; 1054 LPWORD lpData; 1055 LRESULT ret; 1056 UINT16 i; 1057 1058 VA_LIST16 valist; 1059 1060 VA_START16(valist); 1061 hic = VA_ARG16(valist, HIC16); 1062 msg = VA_ARG16(valist, UINT16); 1063 cb = VA_ARG16(valist, UINT16); 1064 1065 lpData = SEGPTR_ALLOC(cb); 1066 1067 TRACE("0x%08lx, %u, %u, ...)\n",(DWORD)hic,msg,cb); 1068 1069 for(i=0;i<cb/sizeof(WORD);i++) { 1070 lpData[i] = VA_ARG16(valist, WORD); 1071 } 1072 1073 VA_END16(valist); 1074 ret = ICSendMessage16(hic, msg, (DWORD)(SEGPTR_GET(lpData)), (DWORD)cb); 1075 1076 SEGPTR_FREE(lpData); 1077 return ret; 1078 } 1079 #endif 1080 /*********************************************************************** 1081 * ICDrawBegin [MSVFW32.@] 1083 1082 */ 1084 1083 DWORD VFWAPIV ICDrawBegin( 1085 HIC hic, /* [in] */1086 DWORD dwFlags, /* [in] flags */1087 HPALETTE hpal, /* [in] palette to draw with */1088 HWND hwnd, /* [in] window to draw to */1089 HDC hdc, /* [in] HDC to draw to */1090 INT xDst, /* [in] destination rectangle */1091 INT yDst, /* [in] */1092 INT dxDst, /* [in] */1093 INT dyDst, /* [in] */1094 LPBITMAPINFOHEADER lpbi, /* [in] format of frame to draw */1095 INT xSrc, /* [in] source rectangle */1096 INT ySrc, /* [in] */1097 INT dxSrc, /* [in] */1098 INT dySrc, /* [in] */1099 DWORD dwRate, /* [in] frames/second = (dwRate/dwScale) */1100 DWORD dwScale) /* [in] */1084 HIC hic, /* [in] */ 1085 DWORD dwFlags, /* [in] flags */ 1086 HPALETTE hpal, /* [in] palette to draw with */ 1087 HWND hwnd, /* [in] window to draw to */ 1088 HDC hdc, /* [in] HDC to draw to */ 1089 INT xDst, /* [in] destination rectangle */ 1090 INT yDst, /* [in] */ 1091 INT dxDst, /* [in] */ 1092 INT dyDst, /* [in] */ 1093 LPBITMAPINFOHEADER lpbi, /* [in] format of frame to draw */ 1094 INT xSrc, /* [in] source rectangle */ 1095 INT ySrc, /* [in] */ 1096 INT dxSrc, /* [in] */ 1097 INT dySrc, /* [in] */ 1098 DWORD dwRate, /* [in] frames/second = (dwRate/dwScale) */ 1099 DWORD dwScale) /* [in] */ 1101 1100 { 1102 1103 ICDRAWBEGINicdb;1104 1105 TRACE("(0x%08lx,%ld,0x%08lx,0x%08lx,0x%08lx,%u,%u,%u,%u,%p,%u,%u,%u,%u,%ld,%ld)\n",1106 (DWORD)hic, dwFlags, (DWORD)hpal, (DWORD)hwnd, (DWORD)hdc, xDst, yDst, dxDst, dyDst,1107 lpbi, xSrc, ySrc, dxSrc, dySrc, dwRate, dwScale);1108 1109 icdb.dwFlags = dwFlags;1110 icdb.hpal = hpal;1111 icdb.hwnd = hwnd;1112 icdb.hdc = hdc;1113 icdb.xDst = xDst;1114 icdb.yDst = yDst;1115 icdb.dxDst = dxDst;1116 icdb.dyDst = dyDst;1117 icdb.lpbi = lpbi;1118 icdb.xSrc = xSrc;1119 icdb.ySrc = ySrc;1120 icdb.dxSrc = dxSrc;1121 icdb.dySrc = dySrc;1122 icdb.dwRate = dwRate;1123 icdb.dwScale = dwScale;1124 return ICSendMessage(hic,ICM_DRAW_BEGIN,(DWORD)&icdb,sizeof(icdb));1101 1102 ICDRAWBEGIN icdb; 1103 1104 TRACE("(0x%08lx,%ld,0x%08lx,0x%08lx,0x%08lx,%u,%u,%u,%u,%p,%u,%u,%u,%u,%ld,%ld)\n", 1105 (DWORD)hic, dwFlags, (DWORD)hpal, (DWORD)hwnd, (DWORD)hdc, xDst, yDst, dxDst, dyDst, 1106 lpbi, xSrc, ySrc, dxSrc, dySrc, dwRate, dwScale); 1107 1108 icdb.dwFlags = dwFlags; 1109 icdb.hpal = hpal; 1110 icdb.hwnd = hwnd; 1111 icdb.hdc = hdc; 1112 icdb.xDst = xDst; 1113 icdb.yDst = yDst; 1114 icdb.dxDst = dxDst; 1115 icdb.dyDst = dyDst; 1116 icdb.lpbi = lpbi; 1117 icdb.xSrc = xSrc; 1118 icdb.ySrc = ySrc; 1119 icdb.dxSrc = dxSrc; 1120 icdb.dySrc = dySrc; 1121 icdb.dwRate = dwRate; 1122 icdb.dwScale = dwScale; 1123 return ICSendMessage(hic,ICM_DRAW_BEGIN,(DWORD)&icdb,sizeof(icdb)); 1125 1124 } 1126 1125 1127 1126 #ifndef __WIN32OS2__ 1128 1127 /*********************************************************************** 1129 * _ICDrawBegin[MSVIDEO.232]1128 * _ICDrawBegin [MSVIDEO.232] 1130 1129 */ 1131 1130 DWORD VFWAPIV ICDrawBegin16( 1132 HIC16 hic, /* [in] */1133 DWORD dwFlags, /* [in] flags */1134 HPALETTE16 hpal, /* [in] palette to draw with */1135 HWND16 hwnd, /* [in] window to draw to */1136 HDC16 hdc, /* [in] HDC to draw to */1137 INT16 xDst, /* [in] destination rectangle */1138 INT16 yDst, /* [in] */1139 INT16 dxDst, /* [in] */1140 INT16 dyDst, /* [in] */1141 LPBITMAPINFOHEADER lpbi, /* [in] format of frame to draw NOTE: SEGPTR */1142 INT16xSrc, /* [in] source rectangle */1143 INT16ySrc, /* [in] */1144 INT16dxSrc, /* [in] */1145 INT16dySrc, /* [in] */1146 DWORDdwRate, /* [in] frames/second = (dwRate/dwScale) */1147 DWORDdwScale) /* [in] */1131 HIC16 hic, /* [in] */ 1132 DWORD dwFlags, /* [in] flags */ 1133 HPALETTE16 hpal, /* [in] palette to draw with */ 1134 HWND16 hwnd, /* [in] window to draw to */ 1135 HDC16 hdc, /* [in] HDC to draw to */ 1136 INT16 xDst, /* [in] destination rectangle */ 1137 INT16 yDst, /* [in] */ 1138 INT16 dxDst, /* [in] */ 1139 INT16 dyDst, /* [in] */ 1140 LPBITMAPINFOHEADER lpbi, /* [in] format of frame to draw NOTE: SEGPTR */ 1141 INT16 xSrc, /* [in] source rectangle */ 1142 INT16 ySrc, /* [in] */ 1143 INT16 dxSrc, /* [in] */ 1144 INT16 dySrc, /* [in] */ 1145 DWORD dwRate, /* [in] frames/second = (dwRate/dwScale) */ 1146 DWORD dwScale) /* [in] */ 1148 1147 { 1149 DWORD ret;1150 ICDRAWBEGIN16* icdb = SEGPTR_NEW(ICDRAWBEGIN16); /* SEGPTR for mapper to deal with */1151 1152 TRACE("(0x%08lx,%ld,0x%08lx,0x%08lx,0x%08lx,%u,%u,%u,%u,%p,%u,%u,%u,%u,%ld,%ld)\n",1153 (DWORD)hic, dwFlags, (DWORD)hpal, (DWORD)hwnd, (DWORD)hdc, xDst, yDst, dxDst, dyDst,1154 lpbi, xSrc, ySrc, dxSrc, dySrc, dwRate, dwScale);1155 1156 icdb->dwFlags = dwFlags;1157 icdb->hpal = hpal;1158 icdb->hwnd = hwnd;1159 icdb->hdc = hdc;1160 icdb->xDst = xDst;1161 icdb->yDst = yDst;1162 icdb->dxDst = dxDst;1163 icdb->dyDst = dyDst;1164 icdb->lpbi = lpbi; /* Keep this as SEGPTR for the mapping code to deal with */1165 icdb->xSrc = xSrc;1166 icdb->ySrc = ySrc;1167 icdb->dxSrc = dxSrc;1168 icdb->dySrc = dySrc;1169 icdb->dwRate = dwRate;1170 icdb->dwScale = dwScale;1171 1172 ret = (DWORD)ICSendMessage16(hic,ICM_DRAW_BEGIN,(DWORD)SEGPTR_GET(icdb),sizeof(ICDRAWBEGIN16));1173 SEGPTR_FREE(icdb);1174 return ret;1175 } 1176 #endif 1177 1178 /*********************************************************************** 1179 * ICDraw[MSVFW32.@]1148 DWORD ret; 1149 ICDRAWBEGIN16* icdb = SEGPTR_NEW(ICDRAWBEGIN16); /* SEGPTR for mapper to deal with */ 1150 1151 TRACE("(0x%08lx,%ld,0x%08lx,0x%08lx,0x%08lx,%u,%u,%u,%u,%p,%u,%u,%u,%u,%ld,%ld)\n", 1152 (DWORD)hic, dwFlags, (DWORD)hpal, (DWORD)hwnd, (DWORD)hdc, xDst, yDst, dxDst, dyDst, 1153 lpbi, xSrc, ySrc, dxSrc, dySrc, dwRate, dwScale); 1154 1155 icdb->dwFlags = dwFlags; 1156 icdb->hpal = hpal; 1157 icdb->hwnd = hwnd; 1158 icdb->hdc = hdc; 1159 icdb->xDst = xDst; 1160 icdb->yDst = yDst; 1161 icdb->dxDst = dxDst; 1162 icdb->dyDst = dyDst; 1163 icdb->lpbi = lpbi; /* Keep this as SEGPTR for the mapping code to deal with */ 1164 icdb->xSrc = xSrc; 1165 icdb->ySrc = ySrc; 1166 icdb->dxSrc = dxSrc; 1167 icdb->dySrc = dySrc; 1168 icdb->dwRate = dwRate; 1169 icdb->dwScale = dwScale; 1170 1171 ret = (DWORD)ICSendMessage16(hic,ICM_DRAW_BEGIN,(DWORD)SEGPTR_GET(icdb),sizeof(ICDRAWBEGIN16)); 1172 SEGPTR_FREE(icdb); 1173 return ret; 1174 } 1175 #endif 1176 1177 /*********************************************************************** 1178 * ICDraw [MSVFW32.@] 1180 1179 */ 1181 1180 DWORD VFWAPIV ICDraw(HIC hic, DWORD dwFlags, LPVOID lpFormat, LPVOID lpData, DWORD cbData, LONG lTime) { 1182 ICDRAWicd;1183 1184 TRACE("(0x%09lx,%ld,%p,%p,%ld,%ld)\n",(DWORD)hic,dwFlags,lpFormat,lpData,cbData,lTime);1185 1186 icd.dwFlags = dwFlags;1187 icd.lpFormat = lpFormat;1188 icd.lpData = lpData;1189 icd.cbData = cbData;1190 icd.lTime = lTime;1191 1192 return ICSendMessage(hic,ICM_DRAW,(DWORD)&icd,sizeof(icd));1181 ICDRAW icd; 1182 1183 TRACE("(0x%09lx,%ld,%p,%p,%ld,%ld)\n",(DWORD)hic,dwFlags,lpFormat,lpData,cbData,lTime); 1184 1185 icd.dwFlags = dwFlags; 1186 icd.lpFormat = lpFormat; 1187 icd.lpData = lpData; 1188 icd.cbData = cbData; 1189 icd.lTime = lTime; 1190 1191 return ICSendMessage(hic,ICM_DRAW,(DWORD)&icd,sizeof(icd)); 1193 1192 } 1194 1193 1195 1194 #ifndef __WIN32OS2__ 1196 1195 /*********************************************************************** 1197 * _ICDraw[MSVIDEO.234]1196 * _ICDraw [MSVIDEO.234] 1198 1197 */ 1199 1198 DWORD VFWAPIV ICDraw16( 1200 HIC16 hic,1201 DWORD dwFlags,1202 LPVOID lpFormat, /* [???] NOTE: SEGPTR */1203 LPVOID lpData, /* [???] NOTE: SEGPTR */1204 DWORD cbData, 1205 LONG lTime) 1199 HIC16 hic, 1200 DWORD dwFlags, 1201 LPVOID lpFormat, /* [???] NOTE: SEGPTR */ 1202 LPVOID lpData, /* [???] NOTE: SEGPTR */ 1203 DWORD cbData, 1204 LONG lTime) 1206 1205 { 1207 ICDRAW* icd = SEGPTR_NEW(ICDRAW); /* SEGPTR for mapper to deal with */1208 1209 TRACE("(0x%08lx,0x%08lx,%p,%p,%ld,%ld)\n",(DWORD)hic,dwFlags,lpFormat,lpData,cbData,lTime);1210 icd->dwFlags = dwFlags;1211 icd->lpFormat = lpFormat;1212 icd->lpData = lpData;1213 icd->cbData = cbData;1214 icd->lTime = lTime;1215 1216 return ICSendMessage16(hic,ICM_DRAW,(DWORD)SEGPTR_GET(icd),sizeof(ICDRAW));1217 } 1218 #endif 1219 1220 /*********************************************************************** 1221 * ICClose[MSVFW32.@]1206 ICDRAW* icd = SEGPTR_NEW(ICDRAW); /* SEGPTR for mapper to deal with */ 1207 1208 TRACE("(0x%08lx,0x%08lx,%p,%p,%ld,%ld)\n",(DWORD)hic,dwFlags,lpFormat,lpData,cbData,lTime); 1209 icd->dwFlags = dwFlags; 1210 icd->lpFormat = lpFormat; 1211 icd->lpData = lpData; 1212 icd->cbData = cbData; 1213 icd->lTime = lTime; 1214 1215 return ICSendMessage16(hic,ICM_DRAW,(DWORD)SEGPTR_GET(icd),sizeof(ICDRAW)); 1216 } 1217 #endif 1218 1219 /*********************************************************************** 1220 * ICClose [MSVFW32.@] 1222 1221 */ 1223 1222 LRESULT WINAPI ICClose(HIC hic) { 1224 WINE_HIC *whic = GlobalLock16(hic);1225 TRACE("(0x%08lx)\n",(DWORD)hic);1226 if (whic->driverproc) {1227 ICSendMessage(hic,DRV_CLOSE,0,0);1228 ICSendMessage(hic,DRV_DISABLE,0,0);1229 ICSendMessage(hic,DRV_FREE,0,0);1230 } else {1231 CloseDriver(whic->hdrv,0,0);1232 }1233 1234 GlobalUnlock16(hic);1235 GlobalFree16(hic);1236 return 0;1223 WINE_HIC *whic = GlobalLock16(hic); 1224 TRACE("(0x%08lx)\n",(DWORD)hic); 1225 if (whic->driverproc) { 1226 ICSendMessage(hic,DRV_CLOSE,0,0); 1227 ICSendMessage(hic,DRV_DISABLE,0,0); 1228 ICSendMessage(hic,DRV_FREE,0,0); 1229 } else { 1230 CloseDriver(whic->hdrv,0,0); 1231 } 1232 1233 GlobalUnlock16(hic); 1234 GlobalFree16(hic); 1235 return 0; 1237 1236 } 1238 1237 1239 1238 #ifndef __WIN32OS2__ 1240 1239 /*********************************************************************** 1241 * ICClose[MSVIDEO.204]1240 * ICClose [MSVIDEO.204] 1242 1241 */ 1243 1242 LRESULT WINAPI ICClose16(HIC16 hic) { 1244 return ICClose(hic);1245 } 1246 #endif 1247 1248 /*********************************************************************** 1249 * MCIWndCreate[MSVFW32.@]1250 * MCIWndCreateA[MSVFW32.@]1243 return ICClose(hic); 1244 } 1245 #endif 1246 1247 /*********************************************************************** 1248 * MCIWndCreate [MSVFW32.@] 1249 * MCIWndCreateA [MSVFW32.@] 1251 1250 */ 1252 1251 HWND VFWAPIV MCIWndCreateA(HWND hwndParent, HINSTANCE hInstance, 1253 1252 DWORD dwStyle,LPCSTR szFile) 1254 1253 { 1255 FIXME("%x %x %lx %s\n",hwndParent, hInstance, dwStyle, szFile);1256 return 0;1257 } 1258 1259 /*********************************************************************** 1260 * MCIWndCreateW[MSVFW32.@]1254 FIXME("%x %x %lx %s\n",hwndParent, hInstance, dwStyle, szFile); 1255 return 0; 1256 } 1257 1258 /*********************************************************************** 1259 * MCIWndCreateW [MSVFW32.@] 1261 1260 */ 1262 1261 HWND VFWAPIV MCIWndCreateW(HWND hwndParent, HINSTANCE hInstance, 1263 1262 DWORD dwStyle,LPCWSTR szFile) 1264 1263 { 1265 FIXME("%x %x %lx %s\n",hwndParent, hInstance, dwStyle, debugstr_w(szFile));1266 return 0;1267 } 1264 FIXME("%x %x %lx %s\n",hwndParent, hInstance, dwStyle, debugstr_w(szFile)); 1265 return 0; 1266 } -
trunk/src/setupapi/devinst.c
r6649 r6712 1 /* $Id: devinst.c,v 1.2 2001-09-05 13:38:23 bird Exp $ */2 1 /* 3 2 * SetupAPI device installer … … 13 12 14 13 /*********************************************************************** 15 * DiGetClassDevs (SETUPX.304)14 * DiGetClassDevs (SETUPX.304) 16 15 * Return a list of installed system devices. 17 16 * Uses HKLM\\ENUM to list devices. -
trunk/src/setupapi/infparse.c
r6649 r6712 1 /* $Id: infparse.c,v 1.2 2001-09-05 13:38:23 bird Exp $ */2 1 /* 3 2 * SetupX .inf file parsing functions … … 30 29 31 30 if (!lphInf) 32 return IP_ERROR;31 return IP_ERROR; 33 32 34 33 /* this could be improved by checking for already freed handles */ 35 if (IP_curr_handle == 0xffff) 36 return ERR_IP_OUT_OF_HANDLES; 34 if (IP_curr_handle == 0xffff) 35 return ERR_IP_OUT_OF_HANDLES; 37 36 38 37 if (hFile != HFILE_ERROR) 39 38 { 40 InfList = HeapReAlloc(GetProcessHeap(), 0, InfList, InfNumEntries+1);41 InfList[InfNumEntries].hInf = IP_curr_handle++;42 InfList[InfNumEntries].hInfFile = hFile;43 InfList[InfNumEntries].lpInfFileName = HeapAlloc( GetProcessHeap(), 0,39 InfList = HeapReAlloc(GetProcessHeap(), 0, InfList, InfNumEntries+1); 40 InfList[InfNumEntries].hInf = IP_curr_handle++; 41 InfList[InfNumEntries].hInfFile = hFile; 42 InfList[InfNumEntries].lpInfFileName = HeapAlloc( GetProcessHeap(), 0, 44 43 strlen(lpInfFileName)+1); 45 44 strcpy( InfList[InfNumEntries].lpInfFileName, lpInfFileName ); 46 45 *lphInf = InfList[InfNumEntries].hInf; 47 InfNumEntries++;48 TRACE("ret handle %d.\n", *lphInf);49 return OK;46 InfNumEntries++; 47 TRACE("ret handle %d.\n", *lphInf); 48 return OK; 50 49 } 51 50 *lphInf = 0xffff; … … 58 57 59 58 for (n=0; n < InfNumEntries; n++) 60 if (InfList[n].hInf == hInf)61 {62 *ret = n;63 return TRUE;64 }59 if (InfList[n].hInf == hInf) 60 { 61 *ret = n; 62 return TRUE; 63 } 65 64 return FALSE; 66 65 } 67 66 68 67 69 68 LPCSTR IP_GetFileName(HINF16 hInf) … … 72 71 if (IP_FindInf(hInf, &n)) 73 72 { 74 return InfList[n].lpInfFileName;73 return InfList[n].lpInfFileName; 75 74 } 76 75 return NULL; … … 85 84 if (IP_FindInf(hInf, &n)) 86 85 { 87 _lclose(InfList[n].hInfFile);88 HeapFree(GetProcessHeap(), 0, InfList[n].lpInfFileName);89 for (i=n; i < InfNumEntries-1; i++)90 InfList[i] = InfList[i+1];91 InfNumEntries--;92 InfList = HeapReAlloc(GetProcessHeap(), 0, InfList, InfNumEntries);93 res = OK;86 _lclose(InfList[n].hInfFile); 87 HeapFree(GetProcessHeap(), 0, InfList[n].lpInfFileName); 88 for (i=n; i < InfNumEntries-1; i++) 89 InfList[i] = InfList[i+1]; 90 InfNumEntries--; 91 InfList = HeapReAlloc(GetProcessHeap(), 0, InfList, InfNumEntries); 92 res = OK; 94 93 } 95 94 return res; … … 97 96 98 97 /*********************************************************************** 99 * IpOpen1698 * IpOpen16 100 99 * 101 100 */ … … 107 106 108 107 /*********************************************************************** 109 * IpClose16108 * IpClose16 110 109 */ 111 110 RETERR16 WINAPI IpClose16(HINF16 hInf) … … 115 114 116 115 /*********************************************************************** 117 * IpGetProfileString16116 * IpGetProfileString16 118 117 */ 119 RETERR16 WINAPI IpGetProfileString16(HINF16 hInf, LPCSTR section, LPCSTR entry, LPSTR buffer, WORD buflen) 118 RETERR16 WINAPI IpGetProfileString16(HINF16 hInf, LPCSTR section, LPCSTR entry, LPSTR buffer, WORD buflen) 120 119 { 121 120 TRACE("'%s': section '%s' entry '%s'\n", IP_GetFileName(hInf), section, entry); -
trunk/src/setupapi/setupx_main.c
r6649 r6712 1 /* $Id: setupx_main.c,v 1.2 2001-09-05 13:38:23 bird Exp $ */2 1 /* 3 2 * SETUPX library … … 27 26 * 28 27 * SETUPX consists of several parts with the following acronyms/prefixes: 29 * Di device installer (devinst.c ?)30 * Gen generic installer (geninst.c ?)31 * Ip .INF parsing (infparse.c)32 * LDD logical device descriptor (ldd.c ?)33 * LDID logical device ID28 * Di device installer (devinst.c ?) 29 * Gen generic installer (geninst.c ?) 30 * Ip .INF parsing (infparse.c) 31 * LDD logical device descriptor (ldd.c ?) 32 * LDID logical device ID 34 33 * SU setup (setup.c ?) 35 * Tp text processing (textproc.c ?)36 * Vcp virtual copy module (vcp.c ?)34 * Tp text processing (textproc.c ?) 35 * Vcp virtual copy module (vcp.c ?) 37 36 * ... 38 37 * … … 56 55 57 56 /*********************************************************************** 58 * SURegOpenKey57 * SURegOpenKey 59 58 */ 60 59 DWORD WINAPI SURegOpenKey( HKEY hkey, LPCSTR lpszSubKey, LPHKEY retkey ) … … 65 64 66 65 /*********************************************************************** 67 * SURegQueryValueEx66 * SURegQueryValueEx 68 67 */ 69 68 DWORD WINAPI SURegQueryValueEx( HKEY hkey, LPSTR lpszValueName, … … 95 94 while (1) 96 95 { 97 /* find beginning of real substring */98 while ( (*p == ' ') || (*p == '\t') || (*p == '"') ) p++;99 100 /* find end of real substring */101 q = p;102 while ( (*q)103 &&(*q != ' ') && (*q != '\t') && (*q != '"')104 && (*q != ';') && (*q != delimiter) ) q++;105 if (q == p)106 break;107 len = (int)q - (int)p;108 109 /* alloc entry for new substring in steps of 32 units and copy over */110 if (count % 32 == 0)111 { /* 1 for count field + current count + 32 */112 res = HeapReAlloc(GetProcessHeap(), 0, res, (1+count+32)*sizeof(LPSTR));113 }114 *(res+1+count) = HeapAlloc(GetProcessHeap(), 0, len+1);115 strncpy(*(res+1+count), p, len);116 (*(res+1+count))[len] = '\0';117 count++;118 119 /* we are still within last substring (before delimiter),120 * so get out of it */121 while ((*q) && (*q != ';') && (*q != delimiter)) q++;122 if ((!*q) || (*q == ';'))123 break;124 p = q+1;125 } 126 96 /* find beginning of real substring */ 97 while ( (*p == ' ') || (*p == '\t') || (*p == '"') ) p++; 98 99 /* find end of real substring */ 100 q = p; 101 while ( (*q) 102 && (*q != ' ') && (*q != '\t') && (*q != '"') 103 && (*q != ';') && (*q != delimiter) ) q++; 104 if (q == p) 105 break; 106 len = (int)q - (int)p; 107 108 /* alloc entry for new substring in steps of 32 units and copy over */ 109 if (count % 32 == 0) 110 { /* 1 for count field + current count + 32 */ 111 res = HeapReAlloc(GetProcessHeap(), 0, res, (1+count+32)*sizeof(LPSTR)); 112 } 113 *(res+1+count) = HeapAlloc(GetProcessHeap(), 0, len+1); 114 strncpy(*(res+1+count), p, len); 115 (*(res+1+count))[len] = '\0'; 116 count++; 117 118 /* we are still within last substring (before delimiter), 119 * so get out of it */ 120 while ((*q) && (*q != ';') && (*q != delimiter)) q++; 121 if ((!*q) || (*q == ';')) 122 break; 123 p = q+1; 124 } 125 127 126 /* put number of entries at beginning of list */ 128 127 *(DWORD *)res = count; … … 137 136 138 137 for (n=0; n < count; n++) 139 HeapFree(GetProcessHeap(), 0, *pStrings++);138 HeapFree(GetProcessHeap(), 0, *pStrings++); 140 139 141 140 HeapFree(GetProcessHeap(), 0, substr); … … 164 163 * Hmm, but on the other hand SETUPX_GetSubStrings() will probably 165 164 * soon be replaced by InitSubstrData() etc. anyway. 166 * 165 * 167 166 */ 168 167 static BOOL SETUPX_LookupRegistryString(LPSTR regstr, LPSTR buffer, DWORD buflen) … … 182 181 for (n=0; n < 5; n++) 183 182 { 184 q = strchr(p, ',');185 if (!q)186 {187 if (n == 4)188 q = p+strlen(p);189 else190 return FALSE;191 }192 next = q+1;193 if (q < regstr)183 q = strchr(p, ','); 184 if (!q) 185 { 186 if (n == 4) 187 q = p+strlen(p); 188 else 189 return FALSE; 190 } 191 next = q+1; 192 if (q < regstr) 194 193 return FALSE; 195 194 SETUPX_IsolateSubString(&p, &q); … … 198 197 strncpy(items[n], p, len); 199 198 items[n][len] = '\0'; 200 p = next;199 p = next; 201 200 } 202 201 TRACE("got '%s','%s','%s','%s','%s'\n", 203 items[0], items[1], items[2], items[3], items[4]);204 202 items[0], items[1], items[2], items[3], items[4]); 203 205 204 /* check root key */ 206 205 if (!strcasecmp(items[0], "HKCR")) 207 hkey = HKEY_CLASSES_ROOT;206 hkey = HKEY_CLASSES_ROOT; 208 207 else 209 208 if (!strcasecmp(items[0], "HKCU")) 210 hkey = HKEY_CURRENT_USER;209 hkey = HKEY_CURRENT_USER; 211 210 else 212 211 if (!strcasecmp(items[0], "HKLM")) 213 hkey = HKEY_LOCAL_MACHINE;212 hkey = HKEY_LOCAL_MACHINE; 214 213 else 215 214 if (!strcasecmp(items[0], "HKU")) 216 hkey = HKEY_USERS;215 hkey = HKEY_USERS; 217 216 else 218 217 { /* HKR ? -> relative to key passed to GenInstallEx */ 219 FIXME("unsupported regkey '%s'\n", items[0]);218 FIXME("unsupported regkey '%s'\n", items[0]); 220 219 goto regfailed; 221 220 } … … 225 224 226 225 if (RegQueryValueExA(hsubkey, items[2], NULL, &dwType, buffer, &buflen) 227 != ERROR_SUCCESS)226 != ERROR_SUCCESS) 228 227 goto regfailed; 229 228 goto done; … … 235 234 HeapFree(heap, 0, items[n]); 236 235 if (buffer) 237 TRACE("return '%s'\n", buffer);236 TRACE("return '%s'\n", buffer); 238 237 return TRUE; 239 238 } … … 245 244 246 245 do { 247 buf = HeapReAlloc(GetProcessHeap(), 0, buf, len);248 res = GetPrivateProfileStringA(NULL, NULL, NULL, buf, len, filename);249 len *= 2;246 buf = HeapReAlloc(GetProcessHeap(), 0, buf, len); 247 res = GetPrivateProfileStringA(NULL, NULL, NULL, buf, len, filename); 248 len *= 2; 250 249 } while ((!res) && (len < 1048576)); 251 250 if (!res) 252 251 { 253 HeapFree(GetProcessHeap(), 0, buf);254 return NULL;252 HeapFree(GetProcessHeap(), 0, buf); 253 return NULL; 255 254 } 256 255 return buf; … … 263 262 264 263 do { 265 buf = HeapReAlloc(GetProcessHeap(), 0, buf, len);266 res = GetPrivateProfileSectionA(section, buf, len, filename);267 len *= 2;264 buf = HeapReAlloc(GetProcessHeap(), 0, buf, len); 265 res = GetPrivateProfileSectionA(section, buf, len, filename); 266 len *= 2; 268 267 } while ((!res) && (len < 1048576)); 269 268 if (!res) 270 269 { 271 HeapFree(GetProcessHeap(), 0, buf);272 return NULL;270 HeapFree(GetProcessHeap(), 0, buf); 271 return NULL; 273 272 } 274 273 return buf; … … 277 276 278 277 /*********************************************************************** 279 * InstallHinfSection278 * InstallHinfSection 280 279 * 281 280 * hwnd = parent window … … 284 283 * Here "DefaultInstall" is the .inf file section to be installed (optional). 285 284 * The 132 value is made of the HOW_xxx flags and sometimes 128 (-> setupx16.h). 286 * 285 * 287 286 * nCmdShow = nCmdShow of CreateProcess 288 287 */ … … 298 297 HMODULE hMod; 299 298 MSGBOX_PROC pMessageBoxA; 300 299 301 300 TRACE("(%04x, %04x, %s, %d);\n", hwnd, hinst, lpszCmdLine, nCmdShow); 302 301 303 302 pSub = SETUPX_GetSubStrings((LPSTR)lpszCmdLine, ' '); 304 303 305 304 count = *(DWORD *)pSub; 306 305 if (count < 2) /* invalid number of arguments ? */ 307 goto end;306 goto end; 308 307 if (IpOpen16(*(pSub+count), &hInf) != OK) 309 308 { 310 res = ERROR_FILE_NOT_FOUND; /* yes, correct */311 goto end;309 res = ERROR_FILE_NOT_FOUND; /* yes, correct */ 310 goto end; 312 311 } 313 312 if (GenInstall16(hInf, *(pSub+count-2), GENINSTALL_DO_ALL) != OK) 314 goto end;313 goto end; 315 314 wFlags = atoi(*(pSub+count-1)) & ~128; 316 315 switch (wFlags) 317 316 { 318 case HOW_ALWAYS_SILENT_REBOOT:319 case HOW_SILENT_REBOOT:320 reboot = TRUE;321 break;322 case HOW_ALWAYS_PROMPT_REBOOT:323 case HOW_PROMPT_REBOOT:324 if ((hMod = GetModuleHandleA("user32.dll")))325 {326 if ((pMessageBoxA = (MSGBOX_PROC)GetProcAddress( hMod, "MessageBoxA" )))327 {328 329 if (pMessageBoxA(hwnd, "You must restart Wine before the new settings will take effect.\n\nDo you want to exit Wine now ?", "Systems Settings Change", MB_YESNO|MB_ICONQUESTION) == IDYES)330 reboot = TRUE;331 }332 }333 break;334 default:335 ERR("invalid flags %d !\n", wFlags);336 goto end;337 } 338 317 case HOW_ALWAYS_SILENT_REBOOT: 318 case HOW_SILENT_REBOOT: 319 reboot = TRUE; 320 break; 321 case HOW_ALWAYS_PROMPT_REBOOT: 322 case HOW_PROMPT_REBOOT: 323 if ((hMod = GetModuleHandleA("user32.dll"))) 324 { 325 if ((pMessageBoxA = (MSGBOX_PROC)GetProcAddress( hMod, "MessageBoxA" ))) 326 { 327 328 if (pMessageBoxA(hwnd, "You must restart Wine before the new settings will take effect.\n\nDo you want to exit Wine now ?", "Systems Settings Change", MB_YESNO|MB_ICONQUESTION) == IDYES) 329 reboot = TRUE; 330 } 331 } 332 break; 333 default: 334 ERR("invalid flags %d !\n", wFlags); 335 goto end; 336 } 337 339 338 res = OK; 340 339 end: … … 343 342 if (reboot) 344 343 { 345 /* FIXME: we should have a means of terminating all wine + wineserver */346 MESSAGE("Program or user told me to restart. Exiting Wine...\n");347 ExitProcess(1);344 /* FIXME: we should have a means of terminating all wine + wineserver */ 345 MESSAGE("Program or user told me to restart. Exiting Wine...\n"); 346 ExitProcess(1); 348 347 } 349 348 … … 360 359 { 361 360 { /* 0 (LDID_NULL) -- not defined */ 362 NULL,363 NULL361 NULL, 362 NULL 364 363 }, 365 364 { /* 1 (LDID_SRCPATH) = source of installation. hmm, what to do here ? */ 366 "SourcePath", /* hmm, does SETUPX have to care about updating it ?? */367 NULL365 "SourcePath", /* hmm, does SETUPX have to care about updating it ?? */ 366 NULL 368 367 }, 369 368 { /* 2 (LDID_SETUPTEMP) = setup temp dir */ 370 "SetupTempDir",371 NULL369 "SetupTempDir", 370 NULL 372 371 }, 373 372 { /* 3 (LDID_UNINSTALL) = uninstall backup dir */ 374 "UninstallDir",375 NULL373 "UninstallDir", 374 NULL 376 375 }, 377 376 { /* 4 (LDID_BACKUP) = backup dir */ 378 "BackupDir",379 NULL377 "BackupDir", 378 NULL 380 379 }, 381 380 { /* 5 (LDID_SETUPSCRATCH) = setup scratch dir */ 382 "SetupScratchDir",383 NULL381 "SetupScratchDir", 382 NULL 384 383 }, 385 384 { /* 6 -- not defined */ 386 NULL,387 NULL385 NULL, 386 NULL 388 387 }, 389 388 { /* 7 -- not defined */ 390 NULL,391 NULL389 NULL, 390 NULL 392 391 }, 393 392 { /* 8 -- not defined */ 394 NULL,395 NULL393 NULL, 394 NULL 396 395 }, 397 396 { /* 9 -- not defined */ 398 NULL,399 NULL397 NULL, 398 NULL 400 399 }, 401 400 { /* 10 (LDID_WIN) = windows dir */ 402 "WinDir",401 "WinDir", 403 402 "" 404 403 }, 405 404 { /* 11 (LDID_SYS) = system dir */ 406 "SysDir",407 NULL /* call GetSystemDirectory() instead */405 "SysDir", 406 NULL /* call GetSystemDirectory() instead */ 408 407 }, 409 408 { /* 12 (LDID_IOS) = IOSubSys dir */ 410 409 NULL, /* FIXME: registry string ? */ 411 "SYSTEM\\IOSUBSYS"410 "SYSTEM\\IOSUBSYS" 412 411 }, 413 412 { /* 13 (LDID_CMD) = COMMAND dir */ 414 NULL, /* FIXME: registry string ? */415 "COMMAND"413 NULL, /* FIXME: registry string ? */ 414 "COMMAND" 416 415 }, 417 416 { /* 14 (LDID_CPL) = control panel dir */ 418 NULL,419 ""417 NULL, 418 "" 420 419 }, 421 420 { /* 15 (LDID_PRINT) = windows printer dir */ 422 NULL,423 "SYSTEM" /* correct ?? */421 NULL, 422 "SYSTEM" /* correct ?? */ 424 423 }, 425 424 { /* 16 (LDID_MAIL) = destination mail dir */ 426 NULL,427 ""425 NULL, 426 "" 428 427 }, 429 428 { /* 17 (LDID_INF) = INF dir */ 430 "SetupScratchDir", /* correct ? */431 "INF"429 "SetupScratchDir", /* correct ? */ 430 "INF" 432 431 }, 433 432 { /* 18 (LDID_HELP) = HELP dir */ 434 NULL, /* ??? */435 "HELP"433 NULL, /* ??? */ 434 "HELP" 436 435 }, 437 436 { /* 19 (LDID_WINADMIN) = Admin dir */ 438 "WinAdminDir",439 ""437 "WinAdminDir", 438 "" 440 439 }, 441 440 { /* 20 (LDID_FONTS) = Fonts dir */ 442 NULL, /* ??? */443 "FONTS"441 NULL, /* ??? */ 442 "FONTS" 444 443 }, 445 444 { /* 21 (LDID_VIEWERS) = Viewers */ 446 NULL, /* ??? */447 "SYSTEM\\VIEWERS"445 NULL, /* ??? */ 446 "SYSTEM\\VIEWERS" 448 447 }, 449 448 { /* 22 (LDID_VMM32) = VMM32 dir */ 450 NULL, /* ??? */451 "SYSTEM\\VMM32"449 NULL, /* ??? */ 450 "SYSTEM\\VMM32" 452 451 }, 453 452 { /* 23 (LDID_COLOR) = ICM dir */ 454 "ICMPath",455 "SYSTEM\\COLOR"453 "ICMPath", 454 "SYSTEM\\COLOR" 456 455 }, 457 456 { /* 24 (LDID_APPS) = root of boot drive ? */ 458 "AppsDir",459 "C:\\"457 "AppsDir", 458 "C:\\" 460 459 }, 461 460 { /* 25 (LDID_SHARED) = shared dir */ 462 "SharedDir",463 ""461 "SharedDir", 462 "" 464 463 }, 465 464 { /* 26 (LDID_WINBOOT) = Windows boot dir */ 466 "WinBootDir",467 ""465 "WinBootDir", 466 "" 468 467 }, 469 468 { /* 27 (LDID_MACHINE) = machine specific files */ 470 "MachineDir",471 NULL469 "MachineDir", 470 NULL 472 471 }, 473 472 { /* 28 (LDID_HOST_WINBOOT) = Host Windows boot dir */ 474 "HostWinBootDir",475 NULL473 "HostWinBootDir", 474 NULL 476 475 }, 477 476 { /* 29 -- not defined */ 478 NULL,479 NULL477 NULL, 478 NULL 480 479 }, 481 480 { /* 30 (LDID_BOOT) = Root of boot drive */ 482 "BootDir",483 NULL481 "BootDir", 482 NULL 484 483 }, 485 484 { /* 31 (LDID_BOOT_HOST) = Root of boot drive host */ 486 "BootHost",487 NULL485 "BootHost", 486 NULL 488 487 }, 489 488 { /* 32 (LDID_OLD_WINBOOT) = subdir of root */ 490 "OldWinBootDir",491 NULL489 "OldWinBootDir", 490 NULL 492 491 }, 493 492 { /* 33 (LDID_OLD_WIN) = old win dir */ 494 "OldWinDir",495 NULL493 "OldWinDir", 494 NULL 496 495 } 497 496 /* the rest (34-38) isn't too interesting, so I'll forget about it */ 498 497 }; 499 498 500 /* 499 /* 501 500 * LDD == Logical Device Descriptor 502 501 * LDID == Logical Device ID … … 528 527 for (n=0; n < sizeof(LDID_Data)/sizeof(LDID_DATA); n++) 529 528 { 530 buffer[0] = '\0';531 532 len = MAX_PATH;533 if ( (hKey) && (LDID_Data[n].RegValName)534 && (RegQueryValueExA(hKey, LDID_Data[n].RegValName,535 NULL, &type, buffer, &len) == ERROR_SUCCESS)536 && (type == REG_SZ) )537 {538 TRACE("found value '%s' for LDID %d\n", buffer, n);539 }540 else529 buffer[0] = '\0'; 530 531 len = MAX_PATH; 532 if ( (hKey) && (LDID_Data[n].RegValName) 533 && (RegQueryValueExA(hKey, LDID_Data[n].RegValName, 534 NULL, &type, buffer, &len) == ERROR_SUCCESS) 535 && (type == REG_SZ) ) 536 { 537 TRACE("found value '%s' for LDID %d\n", buffer, n); 538 } 539 else 541 540 switch(n) 542 { 543 case LDID_SRCPATH: 544 FIXME("LDID_SRCPATH: what exactly do we have to do here ?\n"); 545 strcpy(buffer, "X:\\FIXME"); 546 break; 547 case LDID_SYS: 548 GetSystemDirectoryA(buffer, MAX_PATH); 549 break; 550 case LDID_APPS: 551 case LDID_MACHINE: 552 case LDID_HOST_WINBOOT: 553 case LDID_BOOT: 554 case LDID_BOOT_HOST: 555 strcpy(buffer, "C:\\"); 556 break; 557 default: 558 if (LDID_Data[n].StdString) 559 { 560 DWORD len = GetWindowsDirectoryA(buffer, MAX_PATH); 561 LPSTR p; 562 p = buffer + len; 563 *p++ = '\\'; 564 strcpy(p, LDID_Data[n].StdString); 541 { 542 case LDID_SRCPATH: 543 FIXME("LDID_SRCPATH: what exactly do we have to do here ?\n"); 544 strcpy(buffer, "X:\\FIXME"); 545 break; 546 case LDID_SYS: 547 GetSystemDirectoryA(buffer, MAX_PATH); 548 break; 549 case LDID_APPS: 550 case LDID_MACHINE: 551 case LDID_HOST_WINBOOT: 552 case LDID_BOOT: 553 case LDID_BOOT_HOST: 554 strcpy(buffer, "C:\\"); 555 break; 556 default: 557 if (LDID_Data[n].StdString) 558 { 559 DWORD len = GetWindowsDirectoryA(buffer, MAX_PATH); 560 LPSTR p; 561 p = buffer + len; 562 *p++ = '\\'; 563 strcpy(p, LDID_Data[n].StdString); 564 } 565 break; 565 566 } 566 break; 567 } 568 if (buffer[0]) 569 { 570 INIT_LDD(ldd, n); 571 ldd.pszPath = buffer; 572 TRACE("LDID %d -> '%s'\n", ldd.ldid, ldd.pszPath); 573 CtlSetLdd16(&ldd); 574 } 567 if (buffer[0]) 568 { 569 INIT_LDD(ldd, n); 570 ldd.pszPath = buffer; 571 TRACE("LDID %d -> '%s'\n", ldd.ldid, ldd.pszPath); 572 CtlSetLdd16(&ldd); 573 } 575 574 } 576 575 if (hKey) RegCloseKey(hKey); 577 576 } 578 579 /*********************************************************************** 580 * CtlDelLdd (SETUPX.37)577 578 /*********************************************************************** 579 * CtlDelLdd (SETUPX.37) 581 580 * 582 581 * RETURN … … 590 589 591 590 if (!std_LDDs_done) 592 SETUPX_CreateStandardLDDs();591 SETUPX_CreateStandardLDDs(); 593 592 594 593 if (ldid < LDID_ASSIGN_START) 595 return ERR_VCP_LDDINVALID;594 return ERR_VCP_LDDINVALID; 596 595 597 596 pCurr = pFirstLDD; … … 599 598 while ((pCurr != NULL) && (ldid > pCurr->pldd->ldid)) 600 599 { 601 pPrev = pCurr;602 pCurr = pCurr->next;600 pPrev = pCurr; 601 pCurr = pCurr->next; 603 602 } 604 603 if ( (pCurr == NULL) /* hit end of list */ 605 604 || (ldid != pCurr->pldd->ldid) ) 606 return ERR_VCP_LDDFIND; /* correct ? */605 return ERR_VCP_LDDFIND; /* correct ? */ 607 606 608 607 /* ok, found our victim: eliminate it */ 609 608 610 609 if (pPrev) 611 pPrev->next = pCurr->next;610 pPrev->next = pCurr->next; 612 611 613 612 if (pCurr == pFirstLDD) 614 pFirstLDD = NULL;613 pFirstLDD = NULL; 615 614 HeapFree(GetProcessHeap(), 0, pCurr); 616 615 617 616 return OK; 618 617 } 619 618 620 619 /*********************************************************************** 621 * CtlDelLdd (SETUPX.37)620 * CtlDelLdd (SETUPX.37) 622 621 */ 623 622 RETERR16 WINAPI CtlDelLdd16(LOGDISKID16 ldid) … … 628 627 629 628 /*********************************************************************** 630 * CtlFindLdd (SETUPX.35)629 * CtlFindLdd (SETUPX.35) 631 630 * 632 631 * doesn't check pldd ptr validity: crash (W98SE) … … 635 634 * ERR_VCP_LDDINVALID if pldd->cbSize != structsize 636 635 * 1 in all other cases ?? 637 * 636 * 638 637 */ 639 638 RETERR16 WINAPI CtlFindLdd16(LPLOGDISKDESC pldd) … … 642 641 643 642 TRACE("(%p)\n", pldd); 644 643 645 644 if (!std_LDDs_done) 646 SETUPX_CreateStandardLDDs();645 SETUPX_CreateStandardLDDs(); 647 646 648 647 if (pldd->cbSize != sizeof(LOGDISKDESC_S)) … … 653 652 while ((pCurr != NULL) && (pldd->ldid > pCurr->pldd->ldid)) 654 653 { 655 pPrev = pCurr;656 pCurr = pCurr->next;654 pPrev = pCurr; 655 pCurr = pCurr->next; 657 656 } 658 657 if ( (pCurr == NULL) /* hit end of list */ 659 658 || (pldd->ldid != pCurr->pldd->ldid) ) 660 return ERR_VCP_LDDFIND; /* correct ? */659 return ERR_VCP_LDDFIND; /* correct ? */ 661 660 662 661 memcpy(pldd, pCurr->pldd, pldd->cbSize); 663 662 /* hmm, we probably ought to strcpy() the string ptrs here */ 664 663 665 664 return 1; /* what is this ?? */ 666 665 } 667 666 668 667 /*********************************************************************** 669 * CtlSetLdd (SETUPX.33)668 * CtlSetLdd (SETUPX.33) 670 669 * 671 670 * Set an LDD entry. … … 685 684 686 685 if (!std_LDDs_done) 687 SETUPX_CreateStandardLDDs();686 SETUPX_CreateStandardLDDs(); 688 687 689 688 if (pldd->cbSize != sizeof(LOGDISKDESC_S)) 690 return ERR_VCP_LDDINVALID;689 return ERR_VCP_LDDINVALID; 691 690 692 691 heap = GetProcessHeap(); … … 695 694 while ((pCurr != NULL) && (pldd->ldid > pCurr->pldd->ldid)) 696 695 { 697 pPrev = pCurr;698 pCurr = pCurr->next;696 pPrev = pCurr; 697 pCurr = pCurr->next; 699 698 } 700 699 if (pCurr == NULL) /* hit end of list */ 701 700 { 702 is_new = TRUE;701 is_new = TRUE; 703 702 pCurr = HeapAlloc(heap, 0, sizeof(LDD_LIST)); 704 703 pCurr->pldd = HeapAlloc(heap, 0, sizeof(LOGDISKDESC_S)); … … 709 708 { 710 709 pCurrLDD = pCurr->pldd; 711 if (pCurrLDD->pszPath)HeapFree(heap, 0, pCurrLDD->pszPath);712 if (pCurrLDD->pszVolLabel)HeapFree(heap, 0, pCurrLDD->pszVolLabel);713 if (pCurrLDD->pszDiskName)HeapFree(heap, 0, pCurrLDD->pszDiskName);710 if (pCurrLDD->pszPath) HeapFree(heap, 0, pCurrLDD->pszPath); 711 if (pCurrLDD->pszVolLabel) HeapFree(heap, 0, pCurrLDD->pszVolLabel); 712 if (pCurrLDD->pszDiskName) HeapFree(heap, 0, pCurrLDD->pszDiskName); 714 713 } 715 714 … … 717 716 718 717 if (pldd->pszPath) 719 pCurrLDD->pszPath = HEAP_strdupA(heap, 0, pldd->pszPath);718 pCurrLDD->pszPath = HEAP_strdupA(heap, 0, pldd->pszPath); 720 719 if (pldd->pszVolLabel) 721 pCurrLDD->pszVolLabel= HEAP_strdupA(heap, 0, pldd->pszVolLabel);720 pCurrLDD->pszVolLabel = HEAP_strdupA(heap, 0, pldd->pszVolLabel); 722 721 if (pldd->pszDiskName) 723 pCurrLDD->pszDiskName= HEAP_strdupA(heap, 0, pldd->pszDiskName);722 pCurrLDD->pszDiskName = HEAP_strdupA(heap, 0, pldd->pszDiskName); 724 723 725 724 if (is_new) /* link into list */ 726 725 { 727 726 if (pPrev) 728 {729 pCurr->next = pPrev->next;727 { 728 pCurr->next = pPrev->next; 730 729 pPrev->next = pCurr; 731 }732 if (!pFirstLDD)733 pFirstLDD = pCurr;734 } 735 730 } 731 if (!pFirstLDD) 732 pFirstLDD = pCurr; 733 } 734 736 735 return OK; 737 736 } … … 739 738 740 739 /*********************************************************************** 741 * CtlAddLdd (SETUPX.36)740 * CtlAddLdd (SETUPX.36) 742 741 * 743 742 * doesn't check pldd ptr validity: crash (W98SE) … … 752 751 753 752 /*********************************************************************** 754 * CtlGetLdd (SETUPX.34)753 * CtlGetLdd (SETUPX.34) 755 754 * 756 755 * doesn't check pldd ptr validity: crash (W98SE) … … 759 758 * RETURN 760 759 * ERR_VCP_LDDINVALID if pldd->cbSize != structsize 761 * 760 * 762 761 */ 763 762 static RETERR16 SETUPX_GetLdd(LPLOGDISKDESC pldd) … … 766 765 767 766 if (!std_LDDs_done) 768 SETUPX_CreateStandardLDDs();767 SETUPX_CreateStandardLDDs(); 769 768 770 769 if (pldd->cbSize != sizeof(LOGDISKDESC_S)) … … 775 774 while ((pCurr != NULL) && (pldd->ldid > pCurr->pldd->ldid)) 776 775 { 777 pPrev = pCurr;778 pCurr = pCurr->next;776 pPrev = pCurr; 777 pCurr = pCurr->next; 779 778 } 780 779 if (pCurr == NULL) /* hit end of list */ 781 return ERR_VCP_LDDFIND; /* correct ? */780 return ERR_VCP_LDDFIND; /* correct ? */ 782 781 783 782 memcpy(pldd, pCurr->pldd, pldd->cbSize); … … 796 795 797 796 /*********************************************************************** 798 * CtlGetLddPath(SETUPX.38)797 * CtlGetLddPath (SETUPX.38) 799 798 * 800 799 * Gets the path of an LDD. … … 810 809 if (szPath) 811 810 { 812 LOGDISKDESC_S ldd;813 INIT_LDD(ldd, ldid);814 if (CtlFindLdd16(&ldd) == ERR_VCP_LDDFIND)815 return ERR_VCP_LDDUNINIT;816 SETUPX_GetLdd(&ldd);811 LOGDISKDESC_S ldd; 812 INIT_LDD(ldd, ldid); 813 if (CtlFindLdd16(&ldd) == ERR_VCP_LDDFIND) 814 return ERR_VCP_LDDUNINIT; 815 SETUPX_GetLdd(&ldd); 817 816 strcpy(szPath, ldd.pszPath); 818 TRACE("ret '%s' for LDID %d\n", szPath, ldid);817 TRACE("ret '%s' for LDID %d\n", szPath, ldid); 819 818 } 820 819 return OK; … … 822 821 823 822 /*********************************************************************** 824 * CtlSetLddPath(SETUPX.508)823 * CtlSetLddPath (SETUPX.508) 825 824 * 826 825 * Sets the path of an LDD. … … 831 830 LOGDISKDESC_S ldd; 832 831 TRACE("(%d, '%s');\n", ldid, szPath); 833 832 834 833 INIT_LDD(ldd, ldid); 835 834 ldd.pszPath = szPath; … … 848 847 * -- registry lookup --> 849 848 * C:\Program Files (or C:\ if not found in registry) 850 * 849 * 851 850 * FIXME: 852 851 * - maybe we ought to add a caching array for speed ? - I don't care :) … … 854 853 * LDIDs for both install and removal sections. 855 854 * - probably the whole function can be removed as installers add that on their 856 * own 855 * own 857 856 */ 858 857 static BOOL SETUPX_AddCustomLDID(int ldid, INT16 hInf) … … 870 869 if (!(sectionbuf = SETUPX_GetSections(filename))) 871 870 { 872 ERR("couldn't get sections !\n");873 return FALSE;871 ERR("couldn't get sections !\n"); 872 return FALSE; 874 873 } 875 874 for (pSec=sectionbuf; *pSec; pSec += strlen(pSec)+1) 876 875 { 877 if (!(entrybuf = SETUPX_GetSectionEntries(filename, pSec)))878 {879 ERR("couldn't get section entries !\n");880 goto end;881 }882 for (pEnt=entrybuf; *pEnt; pEnt += strlen(pEnt)+1)883 {884 if (strstr(pEnt, ldidstr))885 {886 pEqual = strchr(pEnt, '=');887 if (!pEqual) /* crippled entry ?? */888 continue;889 890 /* make sure we found the LDID on left side of the equation */891 if (pEnt+strlen(ldidstr) <= pEqual)892 { /* found */893 894 /* but we don't want entries in the strings section */895 if (!strcasecmp(pSec, "Strings"))896 goto next_section;897 p = pEqual+1;898 goto found;899 }900 }901 }876 if (!(entrybuf = SETUPX_GetSectionEntries(filename, pSec))) 877 { 878 ERR("couldn't get section entries !\n"); 879 goto end; 880 } 881 for (pEnt=entrybuf; *pEnt; pEnt += strlen(pEnt)+1) 882 { 883 if (strstr(pEnt, ldidstr)) 884 { 885 pEqual = strchr(pEnt, '='); 886 if (!pEqual) /* crippled entry ?? */ 887 continue; 888 889 /* make sure we found the LDID on left side of the equation */ 890 if (pEnt+strlen(ldidstr) <= pEqual) 891 { /* found */ 892 893 /* but we don't want entries in the strings section */ 894 if (!strcasecmp(pSec, "Strings")) 895 goto next_section; 896 p = pEqual+1; 897 goto found; 898 } 899 } 900 } 902 901 next_section: 903 902 } … … 908 907 if (*(DWORD *)pSub > 2) 909 908 { 910 ERR("malformed entry '%s' ?\n", p);911 goto end;909 ERR("malformed entry '%s' ?\n", p); 910 goto end; 912 911 } 913 912 TRACE("found section '%s'\n", *(pSub+1)); … … 917 916 if (!(regsectionbuf = SETUPX_GetSectionEntries(filename, *(pSub+1)))) 918 917 { 919 ERR("couldn't get registry section entries !\n");920 goto end;918 ERR("couldn't get registry section entries !\n"); 919 goto end; 921 920 } 922 921 /* sectionbuf is > 1024 bytes anyway, so use it */ … … 929 928 end: 930 929 SETUPX_FreeSubStrings(pSub); 931 if (sectionbuf) HeapFree(GetProcessHeap(), 0, sectionbuf);932 if (entrybuf) HeapFree(GetProcessHeap(), 0, entrybuf);933 if (regsectionbuf) HeapFree(GetProcessHeap(), 0, regsectionbuf);930 if (sectionbuf) HeapFree(GetProcessHeap(), 0, sectionbuf); 931 if (entrybuf) HeapFree(GetProcessHeap(), 0, entrybuf); 932 if (regsectionbuf) HeapFree(GetProcessHeap(), 0, regsectionbuf); 934 933 return ret; 935 934 } … … 948 947 if (CtlFindLdd16(&ldd) == ERR_VCP_LDDFIND) 949 948 { 950 /* hmm, it seems the installers already do the work for us951 * (by calling CtlSetLddPath) that SETUPX_AddCustomLDID952 * is supposed to do. Grmbl ;-)953 * Well, I'll leave it here anyway, but print error... */954 ERR("hmm, LDID %d not registered yet !?\n", ldid);955 handled = SETUPX_AddCustomLDID(ldid, hInf);949 /* hmm, it seems the installers already do the work for us 950 * (by calling CtlSetLddPath) that SETUPX_AddCustomLDID 951 * is supposed to do. Grmbl ;-) 952 * Well, I'll leave it here anyway, but print error... */ 953 ERR("hmm, LDID %d not registered yet !?\n", ldid); 954 handled = SETUPX_AddCustomLDID(ldid, hInf); 956 955 } 957 956 else 958 handled = TRUE;959 957 handled = TRUE; 958 960 959 SETUPX_GetLdd(&ldd); 961 960 962 961 if (!handled) 963 962 { 964 963 FIXME("What is LDID %d ??\n", ldid); 965 *p = "LDID_FIXME";964 *p = "LDID_FIXME"; 966 965 } 967 966 else 968 *p = ldd.pszPath;967 *p = ldd.pszPath; 969 968 970 969 return handled; … … 972 971 973 972 /*********************************************************************** 974 * GenFormStrWithoutPlaceHolders973 * GenFormStrWithoutPlaceHolders 975 974 * 976 975 * ought to be pretty much implemented, I guess... … … 981 980 LPSTR pDst = szDst, p, pPHBegin; 982 981 int count; 983 982 984 983 TRACE("(%p, '%s', %04x);\n", szDst, szSrc, hInf); 985 984 while (pSrc < pSrcEnd) 986 985 { 987 p = strchr(pSrc, '%');988 if (p)989 {990 count = (int)p - (int)pSrc;991 strncpy(pDst, pSrc, count);992 pSrc += count;993 pDst += count;994 pPHBegin = p+1;995 p = strchr(pPHBegin, '%');996 if (p)997 {998 char placeholder[80]; /* that really ought to be enough ;) */999 int ldid;1000 BOOL done = TRUE;1001 count = (int)p - (int)pPHBegin;1002 strncpy(placeholder, pPHBegin, count);1003 placeholder[count] = '\0';1004 ldid = atoi(placeholder);1005 if (ldid)1006 {1007 LPSTR p;1008 done = SETUPX_IP_TranslateLDID(ldid, &p, hInf);1009 strcpy(pDst, p);1010 if (done)1011 pDst += strlen(pDst);1012 }1013 else1014 { /* hmm, string placeholder. Need to look up1015 in the [strings] section of the hInf */1016 DWORD ret;1017 char buf[256]; /* long enough ? */1018 1019 ret = GetPrivateProfileStringA("strings", placeholder, "",1020 buf, 256, IP_GetFileName(hInf));1021 if (ret)1022 {1023 strcpy(pDst, buf);1024 pDst += strlen(buf);1025 }1026 else1027 {1028 ERR("placeholder string '%s' not found !\n", placeholder);1029 done = FALSE;1030 }1031 }1032 if (!done)1033 { /* copy raw placeholder string over */1034 count = (int)p - (int)pPHBegin + 2;1035 strncpy(pDst, pPHBegin-1, count);1036 pDst += count;1037 1038 }1039 pSrc = p+1;1040 continue;1041 }1042 }1043 1044 /* copy the remaining source string over */1045 strncpy(pDst, pSrc, (int)pSrcEnd - (int)pSrc + 1);1046 break;986 p = strchr(pSrc, '%'); 987 if (p) 988 { 989 count = (int)p - (int)pSrc; 990 strncpy(pDst, pSrc, count); 991 pSrc += count; 992 pDst += count; 993 pPHBegin = p+1; 994 p = strchr(pPHBegin, '%'); 995 if (p) 996 { 997 char placeholder[80]; /* that really ought to be enough ;) */ 998 int ldid; 999 BOOL done = TRUE; 1000 count = (int)p - (int)pPHBegin; 1001 strncpy(placeholder, pPHBegin, count); 1002 placeholder[count] = '\0'; 1003 ldid = atoi(placeholder); 1004 if (ldid) 1005 { 1006 LPSTR p; 1007 done = SETUPX_IP_TranslateLDID(ldid, &p, hInf); 1008 strcpy(pDst, p); 1009 if (done) 1010 pDst += strlen(pDst); 1011 } 1012 else 1013 { /* hmm, string placeholder. Need to look up 1014 in the [strings] section of the hInf */ 1015 DWORD ret; 1016 char buf[256]; /* long enough ? */ 1017 1018 ret = GetPrivateProfileStringA("strings", placeholder, "", 1019 buf, 256, IP_GetFileName(hInf)); 1020 if (ret) 1021 { 1022 strcpy(pDst, buf); 1023 pDst += strlen(buf); 1024 } 1025 else 1026 { 1027 ERR("placeholder string '%s' not found !\n", placeholder); 1028 done = FALSE; 1029 } 1030 } 1031 if (!done) 1032 { /* copy raw placeholder string over */ 1033 count = (int)p - (int)pPHBegin + 2; 1034 strncpy(pDst, pPHBegin-1, count); 1035 pDst += count; 1036 1037 } 1038 pSrc = p+1; 1039 continue; 1040 } 1041 } 1042 1043 /* copy the remaining source string over */ 1044 strncpy(pDst, pSrc, (int)pSrcEnd - (int)pSrc + 1); 1045 break; 1047 1046 } 1048 1047 TRACE("ret '%s'\n", szDst); … … 1050 1049 1051 1050 /*********************************************************************** 1052 * VcpOpen1051 * VcpOpen 1053 1052 * 1054 1053 * No idea what to do here. … … 1061 1060 1062 1061 /*********************************************************************** 1063 * VcpClose1062 * VcpClose 1064 1063 * 1065 1064 * Is fl related to VCPDISKINFO.fl ? … … 1092 1091 for (n=0; n < *(DWORD *)pSub; n++) 1093 1092 { 1094 pCopyEntry = *(pSub+1+n);1095 if (*pCopyEntry == '@')1096 {1097 ERR("single file not handled yet !\n");1098 continue;1099 }1100 1101 /* get source directory for that entry */1102 INIT_LDD(ldd, LDID_SRCPATH);1103 SETUPX_GetLdd(&ldd);1104 pSrcDir = ldd.pszPath;1105 1093 pCopyEntry = *(pSub+1+n); 1094 if (*pCopyEntry == '@') 1095 { 1096 ERR("single file not handled yet !\n"); 1097 continue; 1098 } 1099 1100 /* get source directory for that entry */ 1101 INIT_LDD(ldd, LDID_SRCPATH); 1102 SETUPX_GetLdd(&ldd); 1103 pSrcDir = ldd.pszPath; 1104 1106 1105 /* get destination directory for that entry */ 1107 if (!(GetPrivateProfileStringA("DestinationDirs", pCopyEntry, "",1108 pDestStr, sizeof(pDestStr), filename)))1109 continue;1110 1111 /* translate destination dir if given as LDID */1112 ldid = atoi(pDestStr);1113 if (ldid)1114 {1115 if (!(SETUPX_IP_TranslateLDID(ldid, &pDstDir, hInf)))1116 continue;1117 }1118 else1119 pDstDir = pDestStr;1120 1121 /* now that we have the destination dir, iterate over files to copy */1122 pFileEntries = SETUPX_GetSectionEntries(filename, pCopyEntry);1106 if (!(GetPrivateProfileStringA("DestinationDirs", pCopyEntry, "", 1107 pDestStr, sizeof(pDestStr), filename))) 1108 continue; 1109 1110 /* translate destination dir if given as LDID */ 1111 ldid = atoi(pDestStr); 1112 if (ldid) 1113 { 1114 if (!(SETUPX_IP_TranslateLDID(ldid, &pDstDir, hInf))) 1115 continue; 1116 } 1117 else 1118 pDstDir = pDestStr; 1119 1120 /* now that we have the destination dir, iterate over files to copy */ 1121 pFileEntries = SETUPX_GetSectionEntries(filename, pCopyEntry); 1123 1122 for (p=pFileEntries; *p; p +=strlen(p)+1) 1124 {1125 pSubFile = SETUPX_GetSubStrings(p, ',');1126 pSrcFile = *(pSubFile+1);1127 pDstFile = (*(DWORD *)pSubFile > 1) ? *(pSubFile+2) : pSrcFile;1128 TRACE("copying file '%s\\%s' to '%s\\%s'\n", pSrcDir, pSrcFile, pDstDir, pDstFile);1129 if (*(DWORD *)pSubFile > 2)1130 {1131 WORD flag;1132 if ((flag = atoi(*(pSubFile+3)))) /* ah, flag */1133 {1134 if (flag & 0x2c)1135 FIXME("VNLP_xxx flag %d not handled yet.\n", flag);1136 }1137 else1138 FIXME("temp file name '%s' given. Need to register in wininit.ini !\n", *(pSubFile+3)); /* strong guess that this is VcpQueueCopy() */1139 }1140 SETUPX_FreeSubStrings(pSubFile);1141 /* we don't copy ANYTHING yet ! (I'm too lazy and want to verify1142 * this first before destroying whole partitions ;-) */1143 }1144 } 1145 1123 { 1124 pSubFile = SETUPX_GetSubStrings(p, ','); 1125 pSrcFile = *(pSubFile+1); 1126 pDstFile = (*(DWORD *)pSubFile > 1) ? *(pSubFile+2) : pSrcFile; 1127 TRACE("copying file '%s\\%s' to '%s\\%s'\n", pSrcDir, pSrcFile, pDstDir, pDstFile); 1128 if (*(DWORD *)pSubFile > 2) 1129 { 1130 WORD flag; 1131 if ((flag = atoi(*(pSubFile+3)))) /* ah, flag */ 1132 { 1133 if (flag & 0x2c) 1134 FIXME("VNLP_xxx flag %d not handled yet.\n", flag); 1135 } 1136 else 1137 FIXME("temp file name '%s' given. Need to register in wininit.ini !\n", *(pSubFile+3)); /* strong guess that this is VcpQueueCopy() */ 1138 } 1139 SETUPX_FreeSubStrings(pSubFile); 1140 /* we don't copy ANYTHING yet ! (I'm too lazy and want to verify 1141 * this first before destroying whole partitions ;-) */ 1142 } 1143 } 1144 1146 1145 return res; 1147 1146 } 1148 1147 1149 1148 /*********************************************************************** 1150 * GenInstall1149 * GenInstall 1151 1150 * 1152 1151 * general install function for .INF file sections 1153 1152 * 1154 1153 * This is not perfect - patch whenever you can ! 1155 * 1154 * 1156 1155 * wFlags == GENINSTALL_DO_xxx 1157 1156 * e.g. NetMeeting: … … 1170 1169 if (!pEntries) 1171 1170 { 1172 ERR("couldn't find entries for section '%s' !\n", szInstallSection);1173 return ERR_IP_SECT_NOT_FOUND;1171 ERR("couldn't find entries for section '%s' !\n", szInstallSection); 1172 return ERR_IP_SECT_NOT_FOUND; 1174 1173 } 1175 1174 for (p=pEntries; *p; p +=strlen(p)+1) 1176 1175 { 1177 pEnd = strchr(p, '=');1178 if (!pEnd) continue;1179 pSub = SETUPX_GetSubStrings(pEnd+1, ','); /* split entries after the '=' */1180 SETUPX_IsolateSubString(&p, &pEnd);1181 len = (int)pEnd - (int)p;1182 1183 if (wFlags & GENINSTALL_DO_FILES)1184 {1185 if (!strncasecmp(p, "CopyFiles", len))1186 {1187 SETUPX_CopyFiles(pSub, hInfFile);1188 continue;1189 }1176 pEnd = strchr(p, '='); 1177 if (!pEnd) continue; 1178 pSub = SETUPX_GetSubStrings(pEnd+1, ','); /* split entries after the '=' */ 1179 SETUPX_IsolateSubString(&p, &pEnd); 1180 len = (int)pEnd - (int)p; 1181 1182 if (wFlags & GENINSTALL_DO_FILES) 1183 { 1184 if (!strncasecmp(p, "CopyFiles", len)) 1185 { 1186 SETUPX_CopyFiles(pSub, hInfFile); 1187 continue; 1188 } 1190 1189 #if IMPLEMENT_THAT 1191 else1192 if (!strncasecmp(p, "DelFiles", len))1193 {1194 SETUPX_DelFiles(filename, szInstallSection, pSub);1195 continue;1196 }1190 else 1191 if (!strncasecmp(p, "DelFiles", len)) 1192 { 1193 SETUPX_DelFiles(filename, szInstallSection, pSub); 1194 continue; 1195 } 1197 1196 #endif 1198 }1199 if (wFlags & GENINSTALL_DO_INI)1200 {1197 } 1198 if (wFlags & GENINSTALL_DO_INI) 1199 { 1201 1200 #if IMPLEMENT_THAT 1202 if (!strncasecmp(p, "UpdateInis", len))1203 {1204 SETUPX_UpdateInis(filename, szInstallSection, pSub);1205 continue;1206 }1201 if (!strncasecmp(p, "UpdateInis", len)) 1202 { 1203 SETUPX_UpdateInis(filename, szInstallSection, pSub); 1204 continue; 1205 } 1207 1206 #endif 1208 }1209 if (wFlags & GENINSTALL_DO_REG)1210 {1207 } 1208 if (wFlags & GENINSTALL_DO_REG) 1209 { 1211 1210 #if IMPLEMENT_THAT 1212 /* probably use SUReg*() functions here */1213 if (!strncasecmp(p, "AddReg", len))1214 {1215 SETUPX_AddReg(filename, szInstallSection, pSub);1216 continue;1217 }1218 else1219 if (!strncasecmp(p, "DelReg", len))1220 {1221 SETUPX_DelReg(filename, szInstallSection, pSub);1222 continue;1223 }1211 /* probably use SUReg*() functions here */ 1212 if (!strncasecmp(p, "AddReg", len)) 1213 { 1214 SETUPX_AddReg(filename, szInstallSection, pSub); 1215 continue; 1216 } 1217 else 1218 if (!strncasecmp(p, "DelReg", len)) 1219 { 1220 SETUPX_DelReg(filename, szInstallSection, pSub); 1221 continue; 1222 } 1224 1223 #endif 1225 }1226 1227 SETUPX_FreeSubStrings(pSub);1224 } 1225 1226 SETUPX_FreeSubStrings(pSub); 1228 1227 } 1229 1228 HeapFree(GetProcessHeap(), 0, pEntries); -
trunk/src/setupapi/stubs.c
r6649 r6712 1 1 /* -*- tab-width: 8; c-basic-offset: 8 -*- */ 2 /* $Id: stubs.c,v 1.2 2001-09-05 13:38:24 bird Exp $ */3 2 /* 4 3 * SetupAPI stubs … … 17 16 18 17 /*********************************************************************** 19 * SetupCloseFileQueue18 * SetupCloseFileQueue 20 19 */ 21 20 VOID WINAPI SetupCloseFileQueue(HSPFILEQ QueueHandle) 22 21 { 23 FIXME("not implemented (setupapi.dll) \n");24 } 25 26 /*********************************************************************** 27 * SetupCommitFileQueueA22 FIXME("not implemented (setupapi.dll) \n"); 23 } 24 25 /*********************************************************************** 26 * SetupCommitFileQueueA 28 27 */ 29 28 BOOL WINAPI SetupCommitFileQueueA(HWND Owner, HSPFILEQ QueueHandle, 30 PSP_FILE_CALLBACK_A MsgHandler,31 PVOID Context)32 { 33 FIXME("not implemented (setupapi.dll) \n");34 return FALSE;35 } 36 37 /*********************************************************************** 38 * SetupIterateCabinetA29 PSP_FILE_CALLBACK_A MsgHandler, 30 PVOID Context) 31 { 32 FIXME("not implemented (setupapi.dll) \n"); 33 return FALSE; 34 } 35 36 /*********************************************************************** 37 * SetupIterateCabinetA 39 38 */ 40 39 BOOL WINAPI SetupIterateCabinetA(PCSTR CabinetFile, DWORD Reserved, 41 40 PSP_FILE_CALLBACK_A MsgHandler, PVOID Context) 42 41 { 43 FIXME("not implemented (setupapi.dll) \n");44 return 0;45 } 46 47 /*********************************************************************** 48 * SetupIterateCabinetW42 FIXME("not implemented (setupapi.dll) \n"); 43 return 0; 44 } 45 46 /*********************************************************************** 47 * SetupIterateCabinetW 49 48 */ 50 49 BOOL WINAPI SetupIterateCabinetW(PWSTR CabinetFile, DWORD Reserved, 51 PSP_FILE_CALLBACK_W MsgHandler, PVOID Context) 52 { 53 FIXME("not implemented (setupapi.dll) \n");54 return 0;55 } 56 57 58 /*********************************************************************** 59 * SetupGetLineTextA50 PSP_FILE_CALLBACK_W MsgHandler, PVOID Context) 51 { 52 FIXME("not implemented (setupapi.dll) \n"); 53 return 0; 54 } 55 56 57 /*********************************************************************** 58 * SetupGetLineTextA 60 59 */ 61 60 BOOL WINAPI SetupGetLineTextA (PINFCONTEXT Context, HINF InfHandle, … … 63 62 DWORD ReturnBufferSize, PDWORD RequiredSize) 64 63 { 65 FIXME("not implemented (setupapi.dll) \n");66 return 0;67 } 68 69 /*********************************************************************** 70 * SetupGetStringFieldA71 */ 72 BOOL WINAPI SetupGetStringFieldA(PINFCONTEXT Context, DWORD FieldIndex, 64 FIXME("not implemented (setupapi.dll) \n"); 65 return 0; 66 } 67 68 /*********************************************************************** 69 * SetupGetStringFieldA 70 */ 71 BOOL WINAPI SetupGetStringFieldA(PINFCONTEXT Context, DWORD FieldIndex, 73 72 LPSTR ReturnBuffer, DWORD ReturnBufferSize, 74 73 PDWORD RequiredSize) 75 74 { 76 FIXME("not implemented (setupapi.dll) \n");77 return 0;78 } 79 80 81 /*********************************************************************** 82 * SetupFindNextLine75 FIXME("not implemented (setupapi.dll) \n"); 76 return 0; 77 } 78 79 80 /*********************************************************************** 81 * SetupFindNextLine 83 82 */ 84 83 BOOL WINAPI SetupFindNextLine (PINFCONTEXT ContextIn, PINFCONTEXT ContextOut) 85 84 { 86 FIXME("not implemented (setupapi.dll) \n");87 return 0;88 } 89 90 91 /*********************************************************************** 92 * SetupInitDefaultQueueCallback85 FIXME("not implemented (setupapi.dll) \n"); 86 return 0; 87 } 88 89 90 /*********************************************************************** 91 * SetupInitDefaultQueueCallback 93 92 */ 94 93 PVOID WINAPI SetupInitDefaultQueueCallback(HWND OwnerWindow) 95 94 { 96 FIXME("not implemented (setupapi.dll) \n");97 return 0;98 } 99 100 /*********************************************************************** 101 * SetupInitDefaultQueueCallbackEx95 FIXME("not implemented (setupapi.dll) \n"); 96 return 0; 97 } 98 99 /*********************************************************************** 100 * SetupInitDefaultQueueCallbackEx 102 101 */ 103 102 PVOID WINAPI SetupInitDefaultQueueCallbackEx(HWND OwnerWindow, 104 HWND AlternativeProgressWindow,105 UINT ProgressMessage,106 DWORD res1,107 PVOID res2)108 { 109 FIXME("not implemented (setupapi.dll) \n");110 return 0;111 } 112 113 /*********************************************************************** 114 * SetupCloseInfFile103 HWND AlternativeProgressWindow, 104 UINT ProgressMessage, 105 DWORD res1, 106 PVOID res2) 107 { 108 FIXME("not implemented (setupapi.dll) \n"); 109 return 0; 110 } 111 112 /*********************************************************************** 113 * SetupCloseInfFile 115 114 */ 116 115 VOID WINAPI SetupCloseInfFile (HINF InfHandle) 117 116 { 118 FIXME("not implemented (setupapi.dll) \n");119 } 120 121 122 /*********************************************************************** 123 * SetupDefaultQueueCallbackA117 FIXME("not implemented (setupapi.dll) \n"); 118 } 119 120 121 /*********************************************************************** 122 * SetupDefaultQueueCallbackA 124 123 */ 125 124 UINT WINAPI SetupDefaultQueueCallbackA (PVOID Context, UINT Notification, 126 125 UINT Param1, UINT Param2) 127 126 { 128 FIXME("not implemented (setupapi.dll) \n");129 return 0;130 } 131 132 133 /*********************************************************************** 134 * SetupFindFirstLineA127 FIXME("not implemented (setupapi.dll) \n"); 128 return 0; 129 } 130 131 132 /*********************************************************************** 133 * SetupFindFirstLineA 135 134 */ 136 135 BOOL WINAPI SetupFindFirstLineA (HINF InfHandle, PCSTR Section, PCSTR Key, 137 136 PINFCONTEXT Context) 138 137 { 139 FIXME("not implemented (setupapi.dll) \n");140 return 0;141 } 142 143 /*********************************************************************** 144 * SetupGetLineByIndexA138 FIXME("not implemented (setupapi.dll) \n"); 139 return 0; 140 } 141 142 /*********************************************************************** 143 * SetupGetLineByIndexA 145 144 */ 146 145 BOOL WINAPI SetupGetLineByIndexA (HINF InfHandle, PCSTR Section, DWORD Index, 147 146 PINFCONTEXT Context) 148 147 { 149 FIXME("not implemented (setupapi.dll) \n");150 return FALSE;151 } 152 153 154 /*********************************************************************** 155 * SetupInstallFromInfSectionA148 FIXME("not implemented (setupapi.dll) \n"); 149 return FALSE; 150 } 151 152 153 /*********************************************************************** 154 * SetupInstallFromInfSectionA 156 155 */ 157 156 BOOL WINAPI SetupInstallFromInfSectionA (HWND Owner, HINF InfHandle, PCSTR SectionName, … … 161 160 PSP_DEVINFO_DATA DeviceInfoData) 162 161 { 163 FIXME("not implemented (setupapi.dll) \n");164 return 0;165 } 166 167 /*********************************************************************** 168 * SetupOpenAppendInfFileA162 FIXME("not implemented (setupapi.dll) \n"); 163 return 0; 164 } 165 166 /*********************************************************************** 167 * SetupOpenAppendInfFileA 169 168 */ 170 169 BOOL WINAPI SetupOpenAppendInfFileA (PCSTR FileName, HINF InfHandle, 171 PUINT ErrorLine)172 { 173 FIXME("not implemented (setupapi.dll) \n");174 return FALSE;175 } 176 177 /*********************************************************************** 178 * SetupOpenFileQueue170 PUINT ErrorLine) 171 { 172 FIXME("not implemented (setupapi.dll) \n"); 173 return FALSE; 174 } 175 176 /*********************************************************************** 177 * SetupOpenFileQueue 179 178 */ 180 179 HSPFILEQ WINAPI SetupOpenFileQueue (VOID) 181 180 { 182 FIXME("not implemented (setupapi.dll) \n");183 return (HSPFILEQ) INVALID_HANDLE_VALUE;184 } 185 186 /*********************************************************************** 187 * SetupOpenInfFileA181 FIXME("not implemented (setupapi.dll) \n"); 182 return (HSPFILEQ) INVALID_HANDLE_VALUE; 183 } 184 185 /*********************************************************************** 186 * SetupOpenInfFileA 188 187 */ 189 188 HINF WINAPI SetupOpenInfFileA (PCSTR FileName, PCSTR InfClass, DWORD InfStyle, 190 189 PUINT ErrorLine) 191 190 { 192 FIXME("not implemented (setupapi.dll) \n");193 return 0;194 } 195 196 /*********************************************************************** 197 * SetupQueueCopyA191 FIXME("not implemented (setupapi.dll) \n"); 192 return 0; 193 } 194 195 /*********************************************************************** 196 * SetupQueueCopyA 198 197 */ 199 198 BOOL WINAPI SetupQueueCopyA (HSPFILEQ QueueHandle, PCSTR SourceRootPath, PCSTR SourcePath, 200 PCSTR SourceFileName, PCSTR SourceDescription, PCSTR SourceTagFile,201 PCSTR TargetDirectory, PCSTR TargetFileName, DWORD CopyStyle)202 { 203 FIXME("not implemented (setupapi.dll) \n");204 return FALSE;205 } 206 207 /*********************************************************************** 208 * SetupSetDirectoryIdA199 PCSTR SourceFileName, PCSTR SourceDescription, PCSTR SourceTagFile, 200 PCSTR TargetDirectory, PCSTR TargetFileName, DWORD CopyStyle) 201 { 202 FIXME("not implemented (setupapi.dll) \n"); 203 return FALSE; 204 } 205 206 /*********************************************************************** 207 * SetupSetDirectoryIdA 209 208 */ 210 209 BOOL WINAPI SetupSetDirectoryIdA (HINF InfHandle, 211 DWORD Id,212 PCSTR Directory)213 { 214 FIXME("not implemented (setupapi.dll) \n");215 return FALSE;216 } 217 218 219 /*********************************************************************** 220 * SetupTermDefaultQueueCallback210 DWORD Id, 211 PCSTR Directory) 212 { 213 FIXME("not implemented (setupapi.dll) \n"); 214 return FALSE; 215 } 216 217 218 /*********************************************************************** 219 * SetupTermDefaultQueueCallback 221 220 */ 222 221 VOID WINAPI SetupTermDefaultQueueCallback (PVOID Callback) 223 222 { 224 FIXME("not implemented (setupapi.dll) \n");225 } 226 223 FIXME("not implemented (setupapi.dll) \n"); 224 } 225 -
trunk/src/shdocvw/classinfo.c
r6649 r6712 1 /* $Id: classinfo.c,v 1.2 2001-09-05 13:39:11 bird Exp $ */2 1 /* 3 2 * Implementation of IProvideClassInfo interfaces for IE Web Browser control … … 57 56 */ 58 57 59 static ICOM_VTABLE(IProvideClassInfo) WBPCI_Vtbl = 58 static ICOM_VTABLE(IProvideClassInfo) WBPCI_Vtbl = 60 59 { 61 60 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE … … 142 141 */ 143 142 144 static ICOM_VTABLE(IProvideClassInfo2) WBPCI2_Vtbl = 143 static ICOM_VTABLE(IProvideClassInfo2) WBPCI2_Vtbl = 145 144 { 146 145 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE -
trunk/src/shdocvw/events.c
r6649 r6712 1 /* $Id: events.c,v 1.2 2001-09-05 13:39:11 bird Exp $ */2 1 /* 3 2 * Implementation of event-related interfaces for IE Web Browser control: … … 87 86 */ 88 87 89 static ICOM_VTABLE(IConnectionPointContainer) WBCPC_Vtbl = 88 static ICOM_VTABLE(IConnectionPointContainer) WBCPC_Vtbl = 90 89 { 91 90 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE … … 182 181 */ 183 182 184 static ICOM_VTABLE(IConnectionPoint) WBCP_Vtbl = 183 static ICOM_VTABLE(IConnectionPoint) WBCP_Vtbl = 185 184 { 186 185 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE -
trunk/src/shdocvw/factory.c
r6649 r6712 1 /* $Id: factory.c,v 1.2 2001-09-05 13:39:11 bird Exp $ */2 1 /* 3 2 * Implementation of class factory for IE Web Browser … … 96 95 } 97 96 98 static ICOM_VTABLE(IClassFactory) WBCF_Vtbl = 97 static ICOM_VTABLE(IClassFactory) WBCF_Vtbl = 99 98 { 100 99 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE -
trunk/src/shdocvw/misc.c
r6649 r6712 1 /* $Id: misc.c,v 1.2 2001-09-05 13:39:12 bird Exp $ */2 1 /* 3 2 * Implementation of miscellaneous interfaces for IE Web Browser control: … … 68 67 */ 69 68 70 static ICOM_VTABLE(IQuickActivate) WBQA_Vtbl = 69 static ICOM_VTABLE(IQuickActivate) WBQA_Vtbl = 71 70 { 72 71 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE -
trunk/src/shdocvw/oleobject.c
r6649 r6712 1 /* $Id: oleobject.c,v 1.2 2001-09-05 13:39:12 bird Exp $ */2 1 /* 3 2 * Implementation of IOleObject interfaces for IE Web Browser … … 397 396 */ 398 397 399 static ICOM_VTABLE(IOleObject) WBOOBJ_Vtbl = 398 static ICOM_VTABLE(IOleObject) WBOOBJ_Vtbl = 400 399 { 401 400 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE … … 515 514 */ 516 515 517 static ICOM_VTABLE(IOleInPlaceObject) WBOIPO_Vtbl = 516 static ICOM_VTABLE(IOleInPlaceObject) WBOIPO_Vtbl = 518 517 { 519 518 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE … … 590 589 */ 591 590 592 static ICOM_VTABLE(IOleControl) WBOC_Vtbl = 591 static ICOM_VTABLE(IOleControl) WBOC_Vtbl = 593 592 { 594 593 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE -
trunk/src/shdocvw/persist.c
r6649 r6712 1 /* $Id: persist.c,v 1.2 2001-09-05 13:39:12 bird Exp $ */2 1 /* 3 2 * Implementation of IPersist interfaces for IE Web Browser control … … 82 81 */ 83 82 84 static ICOM_VTABLE(IPersistStorage) WBPS_Vtbl = 83 static ICOM_VTABLE(IPersistStorage) WBPS_Vtbl = 85 84 { 86 85 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE … … 171 170 */ 172 171 173 static ICOM_VTABLE(IPersistStreamInit) WBPSI_Vtbl = 172 static ICOM_VTABLE(IPersistStreamInit) WBPSI_Vtbl = 174 173 { 175 174 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE -
trunk/src/shdocvw/shdocvw_main.c
r6649 r6712 1 /* $Id: shdocvw_main.c,v 1.2 2001-09-05 13:39:12 bird Exp $ */2 1 /* 3 2 * SHDOCVW - Internet Explorer Web Control … … 67 66 68 67 /*********************************************************************** 69 * DllRegisterServer (SHDOCVW.124)68 * DllRegisterServer (SHDOCVW.124) 70 69 */ 71 70 HRESULT WINAPI SHDOCVW_DllRegisterServer() … … 76 75 77 76 /*********************************************************************** 78 * DllUnregisterServer (SHDOCVW.127)77 * DllUnregisterServer (SHDOCVW.127) 79 78 */ 80 79 HRESULT WINAPI SHDOCVW_DllUnregisterServer() -
trunk/src/shdocvw/webbrowser.c
r6649 r6712 1 /* $Id: webbrowser.c,v 1.2 2001-09-05 13:39:12 bird Exp $ */2 1 /* 3 2 * Implementation of IWebBrowser interface for IE Web Browser control … … 229 228 */ 230 229 231 static ICOM_VTABLE(IWebBrowser) WB_Vtbl = 230 static ICOM_VTABLE(IWebBrowser) WB_Vtbl = 232 231 { 233 232 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE -
trunk/src/shlwapi/ordinal.c
r6650 r6712 1 /* $Id: ordinal.c,v 1.6 2001-09-05 13:48:37 bird Exp $ */2 1 /* 3 2 * SHLWAPI ordinal functions … … 66 65 #ifndef __WIN32OS2__ 67 66 /************************************************************************* 68 * SHLWAPI_1 [SHLWAPI.1]67 * SHLWAPI_1 [SHLWAPI.1] 69 68 */ 70 69 DWORD WINAPI SHLWAPI_1 ( 71 LPSTR lpURL,72 LPDWORD lpdwFlags)70 LPSTR lpURL, 71 LPDWORD lpdwFlags) 73 72 { 74 73 if (lpURL == NULL) 75 74 return E_INVALIDARG; 76 75 77 76 if (lpdwFlags == NULL) 78 77 return E_INVALIDARG; 79 78 80 79 // verify flags 81 80 if (*lpdwFlags != 0x18) // some unknown flag 82 81 return E_INVALIDARG; // some unknown error condition 83 82 84 83 FIXME("(%p %s %p %s)\n",lpStr, debugstr_a(lpStr),x, debugstr_a(x)); 85 84 return 0; … … 87 86 88 87 /************************************************************************* 89 * SHLWAPI_2 [SHLWAPI.2]88 * SHLWAPI_2 [SHLWAPI.2] 90 89 */ 91 90 DWORD WINAPI SHLWAPI_2 (LPCWSTR x,LPVOID y) 92 91 { 93 FIXME("(%s,%p)\n",debugstr_w(x),y);94 return 0;95 } 96 97 /************************************************************************* 98 * SHLWAPI_16 [SHLWAPI.16]92 FIXME("(%s,%p)\n",debugstr_w(x),y); 93 return 0; 94 } 95 96 /************************************************************************* 97 * SHLWAPI_16 [SHLWAPI.16] 99 98 */ 100 99 HRESULT WINAPI SHLWAPI_16 ( 101 LPVOID w,102 LPVOID x,103 LPVOID y,104 LPWSTR z)105 { 106 FIXME("(%p %p %p %p)stub\n",w,x,y,z);107 return 0xabba1252;108 } 109 #endif 110 111 /************************************************************************* 112 * SHLWAPI_23 [SHLWAPI.23]100 LPVOID w, 101 LPVOID x, 102 LPVOID y, 103 LPWSTR z) 104 { 105 FIXME("(%p %p %p %p)stub\n",w,x,y,z); 106 return 0xabba1252; 107 } 108 #endif 109 110 /************************************************************************* 111 * SHLWAPI_23 [SHLWAPI.23] 113 112 * 114 113 * NOTES 115 * converts a guid to a string116 * returns strlen(str)114 * converts a guid to a string 115 * returns strlen(str) 117 116 */ 118 117 DWORD WINAPI SHLWAPI_23 ( 119 REFGUID guid,/* [in] clsid */120 LPSTR str,/* [out] buffer */121 INT cmax)/* [in] size of buffer */122 { 123 char xguid[40];118 REFGUID guid, /* [in] clsid */ 119 LPSTR str, /* [out] buffer */ 120 INT cmax) /* [in] size of buffer */ 121 { 122 char xguid[40]; 124 123 125 124 sprintf( xguid, "{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", … … 127 126 guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3], 128 127 guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7] ); 129 TRACE("(%s %p 0x%08x)stub\n", xguid, str, cmax);130 if (strlen(xguid)>=cmax) return 0;131 strcpy(str,xguid);132 return strlen(xguid) + 1;133 } 134 135 /************************************************************************* 136 * SHLWAPI_24 [SHLWAPI.24]128 TRACE("(%s %p 0x%08x)stub\n", xguid, str, cmax); 129 if (strlen(xguid)>=cmax) return 0; 130 strcpy(str,xguid); 131 return strlen(xguid) + 1; 132 } 133 134 /************************************************************************* 135 * SHLWAPI_24 [SHLWAPI.24] 137 136 * 138 137 * NOTES 139 * converts a guid to a string140 * returns strlen(str)138 * converts a guid to a string 139 * returns strlen(str) 141 140 */ 142 141 DWORD WINAPI SHLWAPI_24 ( 143 REFGUID guid,/* [in] clsid */144 LPWSTR str,/* [out] buffer */145 INT cmax)/* [in] size of buffer */142 REFGUID guid, /* [in] clsid */ 143 LPWSTR str, /* [out] buffer */ 144 INT cmax) /* [in] size of buffer */ 146 145 { 147 146 char xguid[40]; … … 155 154 156 155 /************************************************************************* 157 * SHLWAPI_30 [SHLWAPI.30]156 * SHLWAPI_30 [SHLWAPI.30] 158 157 * 159 158 * Seems to be an isspaceW. … … 174 173 175 174 /************************************************************************* 176 * SHLWAPI_32 [SHLWAPI.32]175 * SHLWAPI_32 [SHLWAPI.32] 177 176 */ 178 177 BOOL WINAPI SHLWAPI_32(LPCWSTR lpcChar) … … 188 187 189 188 /************************************************************************* 190 * SHLWAPI_40 [SHLWAPI.40]189 * SHLWAPI_40 [SHLWAPI.40] 191 190 * 192 191 * Get pointer to next Unicode character. … … 198 197 199 198 /************************************************************************* 200 * SHLWAPI_74 [SHLWAPI.74]199 * SHLWAPI_74 [SHLWAPI.74] 201 200 * 202 201 * Get the text from a given dialog item. … … 213 212 } 214 213 /************************************************************************* 215 * SHLWAPI_151 [SHLWAPI.151]214 * SHLWAPI_151 [SHLWAPI.151] 216 215 */ 217 216 #ifdef __WIN32OS2__ … … 239 238 240 239 /************************************************************************* 241 * SHLWAPI_152 [SHLWAPI.152]240 * SHLWAPI_152 [SHLWAPI.152] 242 241 */ 243 242 DWORD WINAPI SHLWAPI_152(LPWSTR str1, LPWSTR str2, INT len) … … 255 254 256 255 /************************************************************************* 257 * SHLWAPI_153 [SHLWAPI.153]256 * SHLWAPI_153 [SHLWAPI.153] 258 257 */ 259 258 #ifdef __WIN32OS2__ … … 285 284 286 285 /************************************************************************* 287 * SHLWAPI_156 [SHLWAPI.156]288 * 289 * Case sensitive string compare. Does not SetLastError().286 * SHLWAPI_156 [SHLWAPI.156] 287 * 288 * Case sensitive string compare. Does not SetLastError(). 290 289 */ 291 290 DWORD WINAPI SHLWAPI_156 ( LPWSTR str1, LPWSTR str2) … … 296 295 297 296 /************************************************************************* 298 * SHLWAPI_162 [SHLWAPI.162]297 * SHLWAPI_162 [SHLWAPI.162] 299 298 * 300 299 * Ensure a multibyte character string doesn't end in a hanging lead byte. … … 320 319 321 320 /************************************************************************* 322 * SHLWAPI_165 [SHLWAPI.165]321 * SHLWAPI_165 [SHLWAPI.165] 323 322 * 324 323 * SetWindowLongA with mask. … … 335 334 336 335 /************************************************************************* 337 * SHLWAPI_169 [SHLWAPI.169]336 * SHLWAPI_169 [SHLWAPI.169] 338 337 */ 339 338 DWORD WINAPI SHLWAPI_169 (IUnknown * lpUnknown) 340 339 { 341 TRACE("(%p)\n",lpUnknown);340 TRACE("(%p)\n",lpUnknown); 342 341 #if 0 343 if(!lpUnknown || !*((LPDWORD)lpUnknown)) return 0;344 return IUnknown_Release(lpUnknown);345 #endif 346 return 0;347 } 348 349 /************************************************************************* 350 * SHLWAPI_170 [SHLWAPI.170]342 if(!lpUnknown || !*((LPDWORD)lpUnknown)) return 0; 343 return IUnknown_Release(lpUnknown); 344 #endif 345 return 0; 346 } 347 348 /************************************************************************* 349 * SHLWAPI_170 [SHLWAPI.170] 351 350 * 352 351 * Skip URL '//' sequence. … … 360 359 361 360 /************************************************************************* 362 * SHLWAPI_181 [SHLWAPI.181]363 * 364 * Enable or disable a menu item.361 * SHLWAPI_181 [SHLWAPI.181] 362 * 363 * Enable or disable a menu item. 365 364 */ 366 365 UINT WINAPI SHLWAPI_181(HMENU hMenu, UINT wItemID, BOOL bEnable) … … 370 369 371 370 /************************************************************************* 372 * SHLWAPI_183 [SHLWAPI.183]371 * SHLWAPI_183 [SHLWAPI.183] 373 372 * 374 373 * Register a window class if it isn't already. … … 383 382 384 383 /************************************************************************* 385 * SHLWAPI_193 [SHLWAPI.193]384 * SHLWAPI_193 [SHLWAPI.193] 386 385 */ 387 386 DWORD WINAPI SHLWAPI_193 () 388 387 { 389 HDC hdc;390 DWORD ret;391 392 TRACE("()\n");393 394 hdc = GetDC(0);395 ret = GetDeviceCaps(hdc, BITSPIXEL) * GetDeviceCaps(hdc, PLANES);396 ReleaseDC(0, hdc);397 return ret;398 } 399 400 /************************************************************************* 401 * SHLWAPI_215 [SHLWAPI.215]388 HDC hdc; 389 DWORD ret; 390 391 TRACE("()\n"); 392 393 hdc = GetDC(0); 394 ret = GetDeviceCaps(hdc, BITSPIXEL) * GetDeviceCaps(hdc, PLANES); 395 ReleaseDC(0, hdc); 396 return ret; 397 } 398 399 /************************************************************************* 400 * SHLWAPI_215 [SHLWAPI.215] 402 401 * 403 402 * NOTES … … 405 404 */ 406 405 LPWSTR WINAPI SHLWAPI_215 ( 407 LPWSTR lpStrSrc,408 LPVOID lpwStrDest,409 int len)410 { 411 WARN("(%p %p %u)\n",lpStrSrc,lpwStrDest,len);412 return strncpyW(lpwStrDest, lpStrSrc, len);413 } 414 415 /************************************************************************* 416 * SHLWAPI_218 [SHLWAPI.218]406 LPWSTR lpStrSrc, 407 LPVOID lpwStrDest, 408 int len) 409 { 410 WARN("(%p %p %u)\n",lpStrSrc,lpwStrDest,len); 411 return strncpyW(lpwStrDest, lpStrSrc, len); 412 } 413 414 /************************************************************************* 415 * SHLWAPI_218 [SHLWAPI.218] 417 416 * 418 417 * WideCharToMultiByte with multi language support. … … 508 507 509 508 /************************************************************************* 510 * SHLWAPI_217 [SHLWAPI.217]509 * SHLWAPI_217 [SHLWAPI.217] 511 510 * 512 511 */ … … 518 517 #ifndef __WIN32OS2__ 519 518 /************************************************************************* 520 * SHLWAPI_219 [SHLWAPI.219]519 * SHLWAPI_219 [SHLWAPI.219] 521 520 * 522 521 * NOTES … … 524 523 */ 525 524 HRESULT WINAPI SHLWAPI_219 ( 526 LPVOID w, /* [???] NOTE: returned by LocalAlloc, 0x450 bytes, iface */527 LPVOID x,528 REFIID riid,529 LPWSTR z) /* [???] NOTE: OUT: path */530 { 531 FIXME("(%p %p %s %p)stub\n",w,x,debugstr_guid(riid),z);532 return 0xabba1252;533 } 534 #endif 535 536 /************************************************************************* 537 * SHLWAPI_222 [SHLWAPI.222]525 LPVOID w, /* [???] NOTE: returned by LocalAlloc, 0x450 bytes, iface */ 526 LPVOID x, 527 REFIID riid, 528 LPWSTR z) /* [???] NOTE: OUT: path */ 529 { 530 FIXME("(%p %p %s %p)stub\n",w,x,debugstr_guid(riid),z); 531 return 0xabba1252; 532 } 533 #endif 534 535 /************************************************************************* 536 * SHLWAPI_222 [SHLWAPI.222] 538 537 * 539 538 * NOTES … … 542 541 HANDLE WINAPI SHLWAPI_222 (LPCLSID guid) 543 542 { 544 char lpstrName[80];543 char lpstrName[80]; 545 544 546 545 sprintf( lpstrName, "shell.{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", … … 548 547 guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3], 549 548 guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7] ); 550 FIXME("(%s) stub\n", lpstrName);551 return CreateSemaphoreA(NULL,0, 0x7fffffff, lpstrName);552 } 553 554 /************************************************************************* 555 * SHLWAPI_223 [SHLWAPI.223]549 FIXME("(%s) stub\n", lpstrName); 550 return CreateSemaphoreA(NULL,0, 0x7fffffff, lpstrName); 551 } 552 553 /************************************************************************* 554 * SHLWAPI_223 [SHLWAPI.223] 556 555 * 557 556 * NOTES … … 560 559 DWORD WINAPI SHLWAPI_223 (HANDLE handle) 561 560 { 562 DWORD oldCount;563 564 FIXME("(0x%08x) stub\n",handle);565 566 ReleaseSemaphore( handle, 1, &oldCount);/* +1 */567 WaitForSingleObject( handle, 0 );/* -1 */568 return oldCount;569 } 570 571 /************************************************************************* 572 * SHLWAPI_237 [SHLWAPI.237]561 DWORD oldCount; 562 563 FIXME("(0x%08x) stub\n",handle); 564 565 ReleaseSemaphore( handle, 1, &oldCount); /* +1 */ 566 WaitForSingleObject( handle, 0 ); /* -1 */ 567 return oldCount; 568 } 569 570 /************************************************************************* 571 * SHLWAPI_237 [SHLWAPI.237] 573 572 * 574 573 * Unicode version of SHLWAPI_183. … … 576 575 DWORD WINAPI SHLWAPI_237 (WNDCLASSW * lpWndClass) 577 576 { 578 WNDCLASSW WndClass;579 580 TRACE("(0x%08x %s)\n",lpWndClass->hInstance, debugstr_w(lpWndClass->lpszClassName));581 582 if (GetClassInfoW(lpWndClass->hInstance, lpWndClass->lpszClassName, &WndClass))583 return TRUE;584 return RegisterClassW(lpWndClass);585 } 586 587 /************************************************************************* 588 * SHLWAPI_240 [SHLWAPI.240]589 * 590 * Calls ASCII or Unicode WindowProc for the given window.577 WNDCLASSW WndClass; 578 579 TRACE("(0x%08x %s)\n",lpWndClass->hInstance, debugstr_w(lpWndClass->lpszClassName)); 580 581 if (GetClassInfoW(lpWndClass->hInstance, lpWndClass->lpszClassName, &WndClass)) 582 return TRUE; 583 return RegisterClassW(lpWndClass); 584 } 585 586 /************************************************************************* 587 * SHLWAPI_240 [SHLWAPI.240] 588 * 589 * Calls ASCII or Unicode WindowProc for the given window. 591 590 */ 592 591 LRESULT CALLBACK SHLWAPI_240(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam) 593 592 { 594 if (IsWindowUnicode(hWnd))595 return DefWindowProcW(hWnd, uMessage, wParam, lParam);596 return DefWindowProcA(hWnd, uMessage, wParam, lParam);593 if (IsWindowUnicode(hWnd)) 594 return DefWindowProcW(hWnd, uMessage, wParam, lParam); 595 return DefWindowProcA(hWnd, uMessage, wParam, lParam); 597 596 } 598 597 #ifndef __WIN32OS2__ 599 598 /************************************************************************* 600 * SHLWAPI_241 [SHLWAPI.241]599 * SHLWAPI_241 [SHLWAPI.241] 601 600 * 602 601 */ 603 602 DWORD WINAPI SHLWAPI_241 () 604 603 { 605 FIXME("()stub\n");606 return 0xabba1243;607 } 608 609 /************************************************************************* 610 * SHLWAPI_266 [SHLWAPI.266]604 FIXME("()stub\n"); 605 return 0xabba1243; 606 } 607 608 /************************************************************************* 609 * SHLWAPI_266 [SHLWAPI.266] 611 610 */ 612 611 DWORD WINAPI SHLWAPI_266 ( 613 LPVOID w,614 LPVOID x,615 LPVOID y,616 LPVOID z)617 { 618 FIXME("(%p %p %p %p)stub\n",w,x,y,z);619 return 0xabba1248;620 } 621 622 /************************************************************************* 623 * SHLWAPI_267 [SHLWAPI.267]612 LPVOID w, 613 LPVOID x, 614 LPVOID y, 615 LPVOID z) 616 { 617 FIXME("(%p %p %p %p)stub\n",w,x,y,z); 618 return 0xabba1248; 619 } 620 621 /************************************************************************* 622 * SHLWAPI_267 [SHLWAPI.267] 624 623 */ 625 624 HRESULT WINAPI SHLWAPI_267 ( 626 LPVOID w, /* [???] NOTE: same as 1th parameter of SHLWAPI_219 */627 LPVOID x, /* [???] NOTE: same as 2nd parameter of SHLWAPI_219 */628 LPVOID y,629 LPVOID z)630 { 631 FIXME("(%p %p %p %p)stub\n",w,x,y,z);632 *((LPDWORD)z) = 0xabba1200;633 return 0xabba1254;634 } 635 636 /************************************************************************* 637 * SHLWAPI_268 [SHLWAPI.268]625 LPVOID w, /* [???] NOTE: same as 1th parameter of SHLWAPI_219 */ 626 LPVOID x, /* [???] NOTE: same as 2nd parameter of SHLWAPI_219 */ 627 LPVOID y, 628 LPVOID z) 629 { 630 FIXME("(%p %p %p %p)stub\n",w,x,y,z); 631 *((LPDWORD)z) = 0xabba1200; 632 return 0xabba1254; 633 } 634 635 /************************************************************************* 636 * SHLWAPI_268 [SHLWAPI.268] 638 637 */ 639 638 DWORD WINAPI SHLWAPI_268 ( 640 LPVOID w,641 LPVOID x)642 { 643 FIXME("(%p %p)\n",w,x);644 return 0xabba1251; /* 0 = failure */645 } 646 647 /************************************************************************* 648 * SHLWAPI_276 [SHLWAPI.276]639 LPVOID w, 640 LPVOID x) 641 { 642 FIXME("(%p %p)\n",w,x); 643 return 0xabba1251; /* 0 = failure */ 644 } 645 646 /************************************************************************* 647 * SHLWAPI_276 [SHLWAPI.276] 649 648 * 650 649 */ 651 650 DWORD WINAPI SHLWAPI_276 () 652 651 { 653 FIXME("()stub\n");654 return 0xabba1244;655 } 656 #endif 657 /************************************************************************* 658 * SHLWAPI_278 [SHLWAPI.278]652 FIXME("()stub\n"); 653 return 0xabba1244; 654 } 655 #endif 656 /************************************************************************* 657 * SHLWAPI_278 [SHLWAPI.278] 659 658 * 660 659 */ 661 660 DWORD WINAPI SHLWAPI_278 ( 662 LONG wndProc,663 HWND hWndParent,664 DWORD dwExStyle,665 DWORD dwStyle,666 HMENU hMenu,667 LONG z)668 { 669 WNDCLASSA wndclass;670 HWND hwnd;671 HCURSOR hCursor;672 char * clsname = "WorkerA";673 674 FIXME("(0x%08lx 0x%08x 0x%08lx 0x%08lx 0x%08x 0x%08lx)stub\n",675 wndProc,hWndParent,dwExStyle,dwStyle,hMenu,z);676 677 hCursor = LoadCursorA(0x00000000,IDC_ARROWA);678 679 if(!GetClassInfoA(shlwapi_hInstance, clsname, &wndclass))680 {681 RtlZeroMemory(&wndclass, sizeof(WNDCLASSA));682 wndclass.lpfnWndProc = DefWindowProcW;683 wndclass.cbWndExtra = 4;684 wndclass.hInstance = shlwapi_hInstance;685 wndclass.hCursor = hCursor;686 wndclass.hbrBackground = COLOR_BTNSHADOW;687 wndclass.lpszMenuName = NULL;688 wndclass.lpszClassName = clsname;689 RegisterClassA (&wndclass);690 }691 hwnd = CreateWindowExA(dwExStyle, clsname, 0,dwStyle,0,0,0,0,hWndParent,692 hMenu,shlwapi_hInstance,0);693 SetWindowLongA(hwnd, 0, z);694 SetWindowLongA(hwnd, GWL_WNDPROC, wndProc);695 return hwnd;696 } 697 698 /************************************************************************* 699 * SHLWAPI_289 [SHLWAPI.289]661 LONG wndProc, 662 HWND hWndParent, 663 DWORD dwExStyle, 664 DWORD dwStyle, 665 HMENU hMenu, 666 LONG z) 667 { 668 WNDCLASSA wndclass; 669 HWND hwnd; 670 HCURSOR hCursor; 671 char * clsname = "WorkerA"; 672 673 FIXME("(0x%08lx 0x%08x 0x%08lx 0x%08lx 0x%08x 0x%08lx)stub\n", 674 wndProc,hWndParent,dwExStyle,dwStyle,hMenu,z); 675 676 hCursor = LoadCursorA(0x00000000,IDC_ARROWA); 677 678 if(!GetClassInfoA(shlwapi_hInstance, clsname, &wndclass)) 679 { 680 RtlZeroMemory(&wndclass, sizeof(WNDCLASSA)); 681 wndclass.lpfnWndProc = DefWindowProcW; 682 wndclass.cbWndExtra = 4; 683 wndclass.hInstance = shlwapi_hInstance; 684 wndclass.hCursor = hCursor; 685 wndclass.hbrBackground = COLOR_BTNSHADOW; 686 wndclass.lpszMenuName = NULL; 687 wndclass.lpszClassName = clsname; 688 RegisterClassA (&wndclass); 689 } 690 hwnd = CreateWindowExA(dwExStyle, clsname, 0,dwStyle,0,0,0,0,hWndParent, 691 hMenu,shlwapi_hInstance,0); 692 SetWindowLongA(hwnd, 0, z); 693 SetWindowLongA(hwnd, GWL_WNDPROC, wndProc); 694 return hwnd; 695 } 696 697 /************************************************************************* 698 * SHLWAPI_289 [SHLWAPI.289] 700 699 * 701 700 * Late bound call to winmm.PlaySoundW … … 710 709 711 710 /************************************************************************* 712 * SHLWAPI_313 [SHLWAPI.313]711 * SHLWAPI_313 [SHLWAPI.313] 713 712 * 714 713 * Late bound call to shell32.SHGetFileInfoW … … 724 723 725 724 /************************************************************************* 726 * SHLWAPI_318 [SHLWAPI.318]725 * SHLWAPI_318 [SHLWAPI.318] 727 726 * 728 727 * Late bound call to shell32.DragQueryFileW … … 737 736 738 737 /************************************************************************* 739 * SHLWAPI_333 [SHLWAPI.333]738 * SHLWAPI_333 [SHLWAPI.333] 740 739 * 741 740 * Late bound call to shell32.SHBrowseForFolderW … … 750 749 751 750 /************************************************************************* 752 * SHLWAPI_334 [SHLWAPI.334]751 * SHLWAPI_334 [SHLWAPI.334] 753 752 * 754 753 * Late bound call to shell32.SHGetPathFromIDListW … … 763 762 764 763 /************************************************************************* 765 * SHLWAPI_335 [SHLWAPI.335]764 * SHLWAPI_335 [SHLWAPI.335] 766 765 * 767 766 * Late bound call to shell32.ShellExecuteExW … … 776 775 777 776 /************************************************************************* 778 * SHLWAPI_336 [SHLWAPI.336]777 * SHLWAPI_336 [SHLWAPI.336] 779 778 * 780 779 * Late bound call to shell32.SHFileOperationW. … … 789 788 790 789 /************************************************************************* 791 * SHLWAPI_337 [SHLWAPI.337]790 * SHLWAPI_337 [SHLWAPI.337] 792 791 * 793 792 * Late bound call to shell32.ExtractIconExW. … … 804 803 //Bugbug: is forwarder for InterlockedCompareExchange 805 804 /************************************************************************* 806 * SHLWAPI_342 [SHLWAPI.342]805 * SHLWAPI_342 [SHLWAPI.342] 807 806 * 808 807 */ 809 808 DWORD WINAPI SHLWAPI_342 ( 810 LPVOID w,811 LPVOID x,812 LPVOID y,813 LPVOID z)814 { 815 FIXME("(%p %p %p %p)stub\n",w,x,y,z);816 return 0xabba1249;817 } 818 #endif 819 /************************************************************************* 820 * SHLWAPI_346 [SHLWAPI.346]809 LPVOID w, 810 LPVOID x, 811 LPVOID y, 812 LPVOID z) 813 { 814 FIXME("(%p %p %p %p)stub\n",w,x,y,z); 815 return 0xabba1249; 816 } 817 #endif 818 /************************************************************************* 819 * SHLWAPI_346 [SHLWAPI.346] 821 820 */ 822 821 DWORD WINAPI SHLWAPI_346 ( 823 LPCWSTR src,824 LPWSTR dest,825 int len)826 { 827 FIXME("(%s %p 0x%08x)stub\n",debugstr_w(src),dest,len);828 lstrcpynW(dest, src, len);829 return lstrlenW(dest)+1;830 } 831 832 /************************************************************************* 833 * SHLWAPI_357 [SHLWAPI.357]822 LPCWSTR src, 823 LPWSTR dest, 824 int len) 825 { 826 FIXME("(%s %p 0x%08x)stub\n",debugstr_w(src),dest,len); 827 lstrcpynW(dest, src, len); 828 return lstrlenW(dest)+1; 829 } 830 831 /************************************************************************* 832 * SHLWAPI_357 [SHLWAPI.357] 834 833 * 835 834 * Late bound call to shell32.SHGetNewLinkInfoW … … 845 844 846 845 /************************************************************************* 847 * SHLWAPI_358 [SHLWAPI.358]846 * SHLWAPI_358 [SHLWAPI.358] 848 847 * 849 848 * Late bound call to shell32.SHDefExtractIconW … … 860 859 861 860 /************************************************************************* 862 * SHLWAPI_364 [SHLWAPI.364]861 * SHLWAPI_364 [SHLWAPI.364] 863 862 * 864 863 * Wrapper for lstrcpynA with src and dst swapped. … … 871 870 872 871 /************************************************************************* 873 * SHLWAPI_370 [SHLWAPI.370]872 * SHLWAPI_370 [SHLWAPI.370] 874 873 * 875 874 * Late bound call to shell32.ExtractIconW … … 885 884 886 885 /************************************************************************* 887 * SHLWAPI_376 [SHLWAPI.376]886 * SHLWAPI_376 [SHLWAPI.376] 888 887 */ 889 888 DWORD WINAPI SHLWAPI_376 (LONG x) 890 889 { 891 FIXME("(0x%08lx)stub\n", x );890 FIXME("(0x%08lx)stub\n", x ); 892 891 /* FIXME: This should be a forward in the .spec file to the win2k function 893 892 * kernel32.GetUserDefaultUILanguage, however that function isn't there yet. … … 897 896 #ifndef __WIN32OS2__ 898 897 /************************************************************************* 899 * SHLWAPI_377 [SHLWAPI.377]898 * SHLWAPI_377 [SHLWAPI.377] 900 899 */ 901 900 DWORD WINAPI SHLWAPI_377 (LPVOID x, LPVOID y, LPVOID z) 902 901 { 903 FIXME("(%p %p %p)stub\n", x,y,z);904 return 0xabba1246;905 } 906 #endif 907 /************************************************************************* 908 * SHLWAPI_378 [SHLWAPI.378]902 FIXME("(%p %p %p)stub\n", x,y,z); 903 return 0xabba1246; 904 } 905 #endif 906 /************************************************************************* 907 * SHLWAPI_378 [SHLWAPI.378] 909 908 */ 910 909 DWORD WINAPI SHLWAPI_378 ( 911 LPSTR x,912 LPVOID y, /* [???] 0x50000000 */913 LPVOID z) /* [???] 4 */914 { 915 FIXME("(%s %p %p)stub\n", x,y,z);916 return LoadLibraryA(x);917 } 918 919 /************************************************************************* 920 * SHLWAPI_389 [SHLWAPI.389]910 LPSTR x, 911 LPVOID y, /* [???] 0x50000000 */ 912 LPVOID z) /* [???] 4 */ 913 { 914 FIXME("(%s %p %p)stub\n", x,y,z); 915 return LoadLibraryA(x); 916 } 917 918 /************************************************************************* 919 * SHLWAPI_389 [SHLWAPI.389] 921 920 * 922 921 * Late bound call to comdlg32.GetSaveFileNameW … … 931 930 932 931 /************************************************************************* 933 * SHLWAPI_390 [SHLWAPI.390]932 * SHLWAPI_390 [SHLWAPI.390] 934 933 * 935 934 * Late bound call to mpr.WNetRestoreConnectionW … … 945 944 946 945 /************************************************************************* 947 * SHLWAPI_391 [SHLWAPI.391]946 * SHLWAPI_391 [SHLWAPI.391] 948 947 * 949 948 * Late bound call to mpr.WNetGetLastErrorW … … 960 959 961 960 /************************************************************************* 962 * SHLWAPI_401 [SHLWAPI.401]961 * SHLWAPI_401 [SHLWAPI.401] 963 962 * 964 963 * Late bound call to comdlg32.PageSetupDlgW … … 973 972 974 973 /************************************************************************* 975 * SHLWAPI_402 [SHLWAPI.402]974 * SHLWAPI_402 [SHLWAPI.402] 976 975 * 977 976 * Late bound call to comdlg32.PrintDlgW … … 986 985 987 986 /************************************************************************* 988 * SHLWAPI_403 [SHLWAPI.403]987 * SHLWAPI_403 [SHLWAPI.403] 989 988 * 990 989 * Late bound call to comdlg32.GetOpenFileNameW … … 1017 1016 1018 1017 /************************************************************************* 1019 * ColorHLSToRGB [SHLWAPI.404]1018 * ColorHLSToRGB [SHLWAPI.404] 1020 1019 * 1021 1020 * Convert from HLS color space into an RGB COLORREF. … … 1051 1050 1052 1051 /************************************************************************* 1053 * SHLWAPI_431 [SHLWAPI.431]1052 * SHLWAPI_431 [SHLWAPI.431] 1054 1053 */ 1055 1054 DWORD WINAPI SHLWAPI_431 (DWORD x) 1056 1055 { 1057 FIXME("(0x%08lx)stub\n", x);1058 return 0xabba1247;1056 FIXME("(0x%08lx)stub\n", x); 1057 return 0xabba1247; 1059 1058 } 1060 1059 1061 1060 #ifndef __WIN32OS2__ 1062 1061 /************************************************************************* 1063 * SHLWAPI_437 [SHLWAPI.437]1062 * SHLWAPI_437 [SHLWAPI.437] 1064 1063 * 1065 1064 * NOTES … … 1074 1073 DWORD WINAPI SHLWAPI_437 (DWORD functionToCall) 1075 1074 { 1076 FIXME("(0x%08lx)stub\n", functionToCall);1077 return 0xabba1247;1078 } 1079 #endif 1080 1081 /************************************************************************* 1082 * SHCreateShellPalette [SHLWAPI.@]1075 FIXME("(0x%08lx)stub\n", functionToCall); 1076 return 0xabba1247; 1077 } 1078 #endif 1079 1080 /************************************************************************* 1081 * SHCreateShellPalette [SHLWAPI.@] 1083 1082 */ 1084 1083 HPALETTE WINAPI SHCreateShellPalette(HDC hdc) 1085 1084 { 1086 FIXME("stub\n");1087 return CreateHalftonePalette(hdc);1088 } 1089 1090 /************************************************************************* 1091 * SHGetInverseCMAP1085 FIXME("stub\n"); 1086 return CreateHalftonePalette(hdc); 1087 } 1088 1089 /************************************************************************* 1090 * SHGetInverseCMAP 1092 1091 */ 1093 1092 DWORD WINAPI SHGetInverseCMAP (LPVOID x, DWORD why) 1094 1093 { 1095 FIXME("(%p, %#lx)stub\n", x, why);1096 return 0;1094 FIXME("(%p, %#lx)stub\n", x, why); 1095 return 0; 1097 1096 } 1098 1097 #ifndef __WIN32OS2__ 1099 1098 /************************************************************************* 1100 * SHIsLowMemoryMachine [SHLWAPI.@]1099 * SHIsLowMemoryMachine [SHLWAPI.@] 1101 1100 */ 1102 1101 DWORD WINAPI SHIsLowMemoryMachine (DWORD x) 1103 1102 { 1104 FIXME("0x%08lx\n", x);1105 return 0;1106 } 1107 #endif 1108 1109 /************************************************************************* 1110 * GetMenuPosFromID [SHLWAPI.@]1103 FIXME("0x%08lx\n", x); 1104 return 0; 1105 } 1106 #endif 1107 1108 /************************************************************************* 1109 * GetMenuPosFromID [SHLWAPI.@] 1111 1110 */ 1112 1111 INT WINAPI GetMenuPosFromID(HMENU hMenu, UINT wID) … … 1126 1125 1127 1126 /************************************************************************* 1128 * _SHGetInstanceExplorer [SHLWAPI.@]1127 * _SHGetInstanceExplorer [SHLWAPI.@] 1129 1128 * 1130 1129 * Late bound call to shell32.SHGetInstanceExplorer. -
trunk/src/shlwapi/path.c
r6650 r6712 1 /* $Id: path.c,v 1.14 2001-09-05 13:48:38 bird Exp $ */2 1 /* 3 2 * Path Functions … … 43 42 #define isSlash(x) ((x)=='\\' || (x)=='/') 44 43 /* 45 ########## Combining and Constructing paths ##########44 ########## Combining and Constructing paths ########## 46 45 */ 47 46 48 47 /************************************************************************* 49 * PathAppendA [SHLWAPI.@]50 * 48 * PathAppendA [SHLWAPI.@] 49 * 51 50 * NOTES 52 51 * concat path lpszPath2 onto lpszPath1 … … 56 55 */ 57 56 BOOL WINAPI PathAppendA( 58 LPSTR lpszPath1,59 LPCSTR lpszPath2) 60 { 61 TRACE("%s %s\n",lpszPath1, lpszPath2);62 while (lpszPath2[0]=='\\') lpszPath2++;63 PathCombineA(lpszPath1,lpszPath1,lpszPath2);64 return TRUE;65 } 66 67 /************************************************************************* 68 * PathAppendW [SHLWAPI.@]57 LPSTR lpszPath1, 58 LPCSTR lpszPath2) 59 { 60 TRACE("%s %s\n",lpszPath1, lpszPath2); 61 while (lpszPath2[0]=='\\') lpszPath2++; 62 PathCombineA(lpszPath1,lpszPath1,lpszPath2); 63 return TRUE; 64 } 65 66 /************************************************************************* 67 * PathAppendW [SHLWAPI.@] 69 68 */ 70 69 BOOL WINAPI PathAppendW( 71 LPWSTR lpszPath1,72 LPCWSTR lpszPath2) 73 { 74 TRACE("%s %s\n",debugstr_w(lpszPath1), debugstr_w(lpszPath2));75 while (lpszPath2[0]=='\\') lpszPath2++;76 PathCombineW(lpszPath1,lpszPath1,lpszPath2);77 return TRUE;78 } 79 80 /************************************************************************* 81 * PathCombineA [SHLWAPI.@]82 * 70 LPWSTR lpszPath1, 71 LPCWSTR lpszPath2) 72 { 73 TRACE("%s %s\n",debugstr_w(lpszPath1), debugstr_w(lpszPath2)); 74 while (lpszPath2[0]=='\\') lpszPath2++; 75 PathCombineW(lpszPath1,lpszPath1,lpszPath2); 76 return TRUE; 77 } 78 79 /************************************************************************* 80 * PathCombineA [SHLWAPI.@] 81 * 83 82 * NOTES 84 83 * if lpszFile='.' skip it … … 89 88 */ 90 89 LPSTR WINAPI PathCombineA( 91 LPSTR szDest,92 LPCSTR lpszDir,93 LPCSTR lpszFile) 94 { 95 char sTemp[MAX_PATH];96 TRACE("%p %p->%s %p->%s\n",szDest, lpszDir, lpszDir, lpszFile, lpszFile);97 98 99 if (!lpszFile || !lpszFile[0] || (lpszFile[0]=='.' && !lpszFile[1]) ) 100 {101 strcpy(szDest,lpszDir);102 return szDest;103 }104 105 /* if lpszFile is a complete path don't care about lpszDir */106 if (PathGetDriveNumberA(lpszFile) != -1)107 {108 strcpy(szDest,lpszFile);109 }110 else if (lpszFile[0] == '\\' )111 {112 strcpy(sTemp,lpszDir);113 PathStripToRootA(sTemp);114 strcat(sTemp,lpszFile);115 strcpy(szDest,sTemp);116 }117 else118 {119 strcpy(sTemp,lpszDir);120 PathAddBackslashA(sTemp);121 strcat(sTemp,lpszFile);122 strcpy(szDest,sTemp);123 }124 return szDest;125 } 126 127 /************************************************************************* 128 * PathCombineW [SHLWAPI.@]90 LPSTR szDest, 91 LPCSTR lpszDir, 92 LPCSTR lpszFile) 93 { 94 char sTemp[MAX_PATH]; 95 TRACE("%p %p->%s %p->%s\n",szDest, lpszDir, lpszDir, lpszFile, lpszFile); 96 97 98 if (!lpszFile || !lpszFile[0] || (lpszFile[0]=='.' && !lpszFile[1]) ) 99 { 100 strcpy(szDest,lpszDir); 101 return szDest; 102 } 103 104 /* if lpszFile is a complete path don't care about lpszDir */ 105 if (PathGetDriveNumberA(lpszFile) != -1) 106 { 107 strcpy(szDest,lpszFile); 108 } 109 else if (lpszFile[0] == '\\' ) 110 { 111 strcpy(sTemp,lpszDir); 112 PathStripToRootA(sTemp); 113 strcat(sTemp,lpszFile); 114 strcpy(szDest,sTemp); 115 } 116 else 117 { 118 strcpy(sTemp,lpszDir); 119 PathAddBackslashA(sTemp); 120 strcat(sTemp,lpszFile); 121 strcpy(szDest,sTemp); 122 } 123 return szDest; 124 } 125 126 /************************************************************************* 127 * PathCombineW [SHLWAPI.@] 129 128 */ 130 129 LPWSTR WINAPI PathCombineW( 131 LPWSTR szDest,132 LPCWSTR lpszDir,133 LPCWSTR lpszFile) 134 { 135 WCHAR sTemp[MAX_PATH];136 TRACE("%p %p->%s %p->%s\n",szDest, lpszDir, debugstr_w(lpszDir),137 lpszFile, debugstr_w(lpszFile));138 139 140 if (!lpszFile || !lpszFile[0] || (lpszFile[0]==(WCHAR)'.' && !lpszFile[1]) ) 141 {130 LPWSTR szDest, 131 LPCWSTR lpszDir, 132 LPCWSTR lpszFile) 133 { 134 WCHAR sTemp[MAX_PATH]; 135 TRACE("%p %p->%s %p->%s\n",szDest, lpszDir, debugstr_w(lpszDir), 136 lpszFile, debugstr_w(lpszFile)); 137 138 139 if (!lpszFile || !lpszFile[0] || (lpszFile[0]==(WCHAR)'.' && !lpszFile[1]) ) 140 { 142 141 strcpyW(szDest,lpszDir); 143 return szDest;144 }145 146 /* if lpszFile is a complete path don't care about lpszDir */147 if (PathGetDriveNumberW(lpszFile) != -1)148 {142 return szDest; 143 } 144 145 /* if lpszFile is a complete path don't care about lpszDir */ 146 if (PathGetDriveNumberW(lpszFile) != -1) 147 { 149 148 strcpyW(szDest,lpszFile); 150 }151 else if (lpszFile[0] == (WCHAR)'\\' )152 {153 strcpyW(sTemp,lpszDir);154 PathStripToRootW(sTemp);155 strcatW(sTemp,lpszFile);156 strcpyW(szDest,sTemp);157 }158 else159 {160 strcpyW(sTemp,lpszDir);161 PathAddBackslashW(sTemp);162 strcatW(sTemp,lpszFile);163 strcpyW(szDest,sTemp);164 }165 return szDest;166 } 167 168 /************************************************************************* 169 * PathAddBackslashA [SHLWAPI.@]149 } 150 else if (lpszFile[0] == (WCHAR)'\\' ) 151 { 152 strcpyW(sTemp,lpszDir); 153 PathStripToRootW(sTemp); 154 strcatW(sTemp,lpszFile); 155 strcpyW(szDest,sTemp); 156 } 157 else 158 { 159 strcpyW(sTemp,lpszDir); 160 PathAddBackslashW(sTemp); 161 strcatW(sTemp,lpszFile); 162 strcpyW(szDest,sTemp); 163 } 164 return szDest; 165 } 166 167 /************************************************************************* 168 * PathAddBackslashA [SHLWAPI.@] 170 169 * 171 170 * NOTES … … 174 173 LPSTR WINAPI PathAddBackslashA(LPSTR lpszPath) 175 174 { 176 int len;177 TRACE("%p->%s\n",lpszPath,lpszPath);178 179 len = strlen(lpszPath);180 if (len && lpszPath[len-1]!='\\') 181 {182 lpszPath[len] = '\\';183 lpszPath[len+1]= 0x00;184 return lpszPath+len+1;185 }186 return lpszPath+len;187 } 188 189 /************************************************************************* 190 * PathAddBackslashW [SHLWAPI.@]175 int len; 176 TRACE("%p->%s\n",lpszPath,lpszPath); 177 178 len = strlen(lpszPath); 179 if (len && lpszPath[len-1]!='\\') 180 { 181 lpszPath[len] = '\\'; 182 lpszPath[len+1]= 0x00; 183 return lpszPath+len+1; 184 } 185 return lpszPath+len; 186 } 187 188 /************************************************************************* 189 * PathAddBackslashW [SHLWAPI.@] 191 190 */ 192 191 LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath) 193 192 { 194 int len;195 TRACE("%p->%s\n",lpszPath,debugstr_w(lpszPath));196 197 len = strlenW(lpszPath);198 if (len && lpszPath[len-1]!=(WCHAR)'\\') 199 {200 lpszPath[len] = (WCHAR)'\\';201 lpszPath[len+1]= 0x00;202 return lpszPath+len+1;203 }204 return lpszPath+len;205 } 206 207 /************************************************************************* 208 * PathBuildRootA [SHLWAPI.@]209 */ 210 LPSTR WINAPI PathBuildRootA(LPSTR lpszPath, int drive) 211 { 212 TRACE("%p %i\n",lpszPath, drive);213 214 strcpy(lpszPath,"A:\\");215 lpszPath[0]+=drive;216 return lpszPath;217 } 218 219 /************************************************************************* 220 * PathBuildRootW [SHLWAPI.@]221 */ 222 LPWSTR WINAPI PathBuildRootW(LPWSTR lpszPath, int drive) 223 { 224 lpszPath[0] = 'A' + drive;225 lpszPath[1] = ':';226 lpszPath[2] = '\\';227 lpszPath[3] = 0;228 TRACE("%p %i\n",debugstr_w(lpszPath), drive);229 return lpszPath;193 int len; 194 TRACE("%p->%s\n",lpszPath,debugstr_w(lpszPath)); 195 196 len = strlenW(lpszPath); 197 if (len && lpszPath[len-1]!=(WCHAR)'\\') 198 { 199 lpszPath[len] = (WCHAR)'\\'; 200 lpszPath[len+1]= 0x00; 201 return lpszPath+len+1; 202 } 203 return lpszPath+len; 204 } 205 206 /************************************************************************* 207 * PathBuildRootA [SHLWAPI.@] 208 */ 209 LPSTR WINAPI PathBuildRootA(LPSTR lpszPath, int drive) 210 { 211 TRACE("%p %i\n",lpszPath, drive); 212 213 strcpy(lpszPath,"A:\\"); 214 lpszPath[0]+=drive; 215 return lpszPath; 216 } 217 218 /************************************************************************* 219 * PathBuildRootW [SHLWAPI.@] 220 */ 221 LPWSTR WINAPI PathBuildRootW(LPWSTR lpszPath, int drive) 222 { 223 lpszPath[0] = 'A' + drive; 224 lpszPath[1] = ':'; 225 lpszPath[2] = '\\'; 226 lpszPath[3] = 0; 227 TRACE("%p %i\n",debugstr_w(lpszPath), drive); 228 return lpszPath; 230 229 } 231 230 232 231 /* 233 Extracting Component Parts232 Extracting Component Parts 234 233 */ 235 234 236 235 /************************************************************************* 237 * PathFindFileNameA [SHLWAPI.@]236 * PathFindFileNameA [SHLWAPI.@] 238 237 */ 239 238 LPSTR WINAPI PathFindFileNameA(LPCSTR lpszPath) 240 239 { 241 LPCSTR lastSlash = lpszPath;242 243 TRACE("%s\n",lpszPath);244 while (*lpszPath) 245 {246 if ( isSlash(lpszPath[0]) && lpszPath[1])247 lastSlash = lpszPath+1;248 lpszPath = CharNextA(lpszPath);249 }250 return (LPSTR)lastSlash;251 252 } 253 254 /************************************************************************* 255 * PathFindFileNameW [SHLWAPI.@]240 LPCSTR lastSlash = lpszPath; 241 242 TRACE("%s\n",lpszPath); 243 while (*lpszPath) 244 { 245 if ( isSlash(lpszPath[0]) && lpszPath[1]) 246 lastSlash = lpszPath+1; 247 lpszPath = CharNextA(lpszPath); 248 } 249 return (LPSTR)lastSlash; 250 251 } 252 253 /************************************************************************* 254 * PathFindFileNameW [SHLWAPI.@] 256 255 */ 257 256 LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath) 258 257 { 259 LPCWSTR wslash;260 wslash = lpszPath;261 262 TRACE("%s\n",debugstr_w(wslash));263 while (lpszPath[0]) 264 {265 if (((lpszPath[0]=='\\') || (lpszPath[0]==':')) && lpszPath[1] && lpszPath[1]!='\\')266 wslash = lpszPath+1;267 lpszPath = CharNextW(lpszPath);268 }269 return (LPWSTR)wslash; 270 } 271 272 /************************************************************************* 273 * PathFindExtensionA [SHLWAPI.@]258 LPCWSTR wslash; 259 wslash = lpszPath; 260 261 TRACE("%s\n",debugstr_w(wslash)); 262 while (lpszPath[0]) 263 { 264 if (((lpszPath[0]=='\\') || (lpszPath[0]==':')) && lpszPath[1] && lpszPath[1]!='\\') 265 wslash = lpszPath+1; 266 lpszPath = CharNextW(lpszPath); 267 } 268 return (LPWSTR)wslash; 269 } 270 271 /************************************************************************* 272 * PathFindExtensionA [SHLWAPI.@] 274 273 * 275 274 * NOTES … … 277 276 */ 278 277 279 LPSTR WINAPI PathFindExtensionA(LPCSTR lpszPath) 280 { 281 LPCSTR lastpoint = NULL;282 283 TRACE("%p %s\n",lpszPath,lpszPath);284 285 while (*lpszPath) 286 {287 if (*lpszPath=='\\'||*lpszPath==' ')288 lastpoint=NULL;289 if (*lpszPath=='.')290 lastpoint=lpszPath;291 lpszPath = CharNextA(lpszPath);292 }293 return (LPSTR)(lastpoint?lastpoint:lpszPath);294 } 295 296 /************************************************************************* 297 * PathFindExtensionW [SHLWAPI.@]298 */ 299 LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath) 300 { 301 LPCWSTR lastpoint = NULL;302 303 TRACE("(%p %s)\n",lpszPath,debugstr_w(lpszPath));304 305 while (*lpszPath)306 {307 if (*lpszPath==(WCHAR)'\\'||*lpszPath==(WCHAR)' ')308 lastpoint=NULL;309 if (*lpszPath==(WCHAR)'.')310 lastpoint=lpszPath;311 lpszPath = CharNextW(lpszPath);312 }313 return (LPWSTR)(lastpoint?lastpoint:lpszPath);314 } 315 316 /************************************************************************* 317 * PathGetArgsA [SHLWAPI.@]278 LPSTR WINAPI PathFindExtensionA(LPCSTR lpszPath) 279 { 280 LPCSTR lastpoint = NULL; 281 282 TRACE("%p %s\n",lpszPath,lpszPath); 283 284 while (*lpszPath) 285 { 286 if (*lpszPath=='\\'||*lpszPath==' ') 287 lastpoint=NULL; 288 if (*lpszPath=='.') 289 lastpoint=lpszPath; 290 lpszPath = CharNextA(lpszPath); 291 } 292 return (LPSTR)(lastpoint?lastpoint:lpszPath); 293 } 294 295 /************************************************************************* 296 * PathFindExtensionW [SHLWAPI.@] 297 */ 298 LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath) 299 { 300 LPCWSTR lastpoint = NULL; 301 302 TRACE("(%p %s)\n",lpszPath,debugstr_w(lpszPath)); 303 304 while (*lpszPath) 305 { 306 if (*lpszPath==(WCHAR)'\\'||*lpszPath==(WCHAR)' ') 307 lastpoint=NULL; 308 if (*lpszPath==(WCHAR)'.') 309 lastpoint=lpszPath; 310 lpszPath = CharNextW(lpszPath); 311 } 312 return (LPWSTR)(lastpoint?lastpoint:lpszPath); 313 } 314 315 /************************************************************************* 316 * PathGetArgsA [SHLWAPI.@] 318 317 * 319 318 * NOTES … … 324 323 * quoting by '\' 325 324 */ 326 LPSTR WINAPI PathGetArgsA(LPCSTR lpszPath) 327 { 328 BOOLqflag = FALSE;329 330 TRACE("%s\n",lpszPath);331 332 while (*lpszPath) 333 {334 if ((*lpszPath==' ') && !qflag)335 return (LPSTR)lpszPath+1;336 if (*lpszPath=='"')337 qflag=!qflag;338 lpszPath = CharNextA(lpszPath);339 }340 return (LPSTR)lpszPath;341 } 342 343 /************************************************************************* 344 * PathGetArgsW [SHLWAPI.@]345 */ 346 LPWSTR WINAPI PathGetArgsW(LPCWSTR lpszPath) 347 { 348 BOOLqflag = FALSE;349 350 TRACE("%s\n",debugstr_w(lpszPath));351 352 while (*lpszPath) 353 {354 if ((*lpszPath==' ') && !qflag)355 return (LPWSTR)lpszPath+1;356 if (*lpszPath=='"')357 qflag=!qflag;358 lpszPath = CharNextW(lpszPath);359 }360 return (LPWSTR)lpszPath;361 } 362 363 /************************************************************************* 364 * PathGetDriveNumberA [SHLWAPI.@]325 LPSTR WINAPI PathGetArgsA(LPCSTR lpszPath) 326 { 327 BOOL qflag = FALSE; 328 329 TRACE("%s\n",lpszPath); 330 331 while (*lpszPath) 332 { 333 if ((*lpszPath==' ') && !qflag) 334 return (LPSTR)lpszPath+1; 335 if (*lpszPath=='"') 336 qflag=!qflag; 337 lpszPath = CharNextA(lpszPath); 338 } 339 return (LPSTR)lpszPath; 340 } 341 342 /************************************************************************* 343 * PathGetArgsW [SHLWAPI.@] 344 */ 345 LPWSTR WINAPI PathGetArgsW(LPCWSTR lpszPath) 346 { 347 BOOL qflag = FALSE; 348 349 TRACE("%s\n",debugstr_w(lpszPath)); 350 351 while (*lpszPath) 352 { 353 if ((*lpszPath==' ') && !qflag) 354 return (LPWSTR)lpszPath+1; 355 if (*lpszPath=='"') 356 qflag=!qflag; 357 lpszPath = CharNextW(lpszPath); 358 } 359 return (LPWSTR)lpszPath; 360 } 361 362 /************************************************************************* 363 * PathGetDriveNumberA [SHLWAPI.@] 365 364 */ 366 365 int WINAPI PathGetDriveNumberA(LPCSTR lpszPath) 367 366 { 368 int chr = tolower(lpszPath[0]);369 370 TRACE ("%s\n",debugstr_a(lpszPath));371 372 if (!lpszPath || lpszPath[1]!=':' || chr < 'a' || chr > 'z') return -1;373 return tolower(lpszPath[0]) - 'a' ;374 } 375 376 /************************************************************************* 377 * PathGetDriveNumberW [SHLWAPI.@]367 int chr = tolower(lpszPath[0]); 368 369 TRACE ("%s\n",debugstr_a(lpszPath)); 370 371 if (!lpszPath || lpszPath[1]!=':' || chr < 'a' || chr > 'z') return -1; 372 return tolower(lpszPath[0]) - 'a' ; 373 } 374 375 /************************************************************************* 376 * PathGetDriveNumberW [SHLWAPI.@] 378 377 */ 379 378 int WINAPI PathGetDriveNumberW(LPCWSTR lpszPath) 380 379 { 381 int chr = tolowerW(lpszPath[0]);382 383 TRACE ("%s\n",debugstr_w(lpszPath));384 385 if (!lpszPath || lpszPath[1]!=':' || chr < 'a' || chr > 'z') return -1;386 return tolowerW(lpszPath[0]) - 'a' ;387 } 388 389 /************************************************************************* 390 * PathRemoveFileSpecA [SHLWAPI.@]391 * 380 int chr = tolowerW(lpszPath[0]); 381 382 TRACE ("%s\n",debugstr_w(lpszPath)); 383 384 if (!lpszPath || lpszPath[1]!=':' || chr < 'a' || chr > 'z') return -1; 385 return tolowerW(lpszPath[0]) - 'a' ; 386 } 387 388 /************************************************************************* 389 * PathRemoveFileSpecA [SHLWAPI.@] 390 * 392 391 * NOTES 393 392 * truncates passed argument to a valid path … … 395 394 * "\foo\xx\foo"-> "\foo\xx" 396 395 * "\" -> "\" 397 * "a:\foo" -> "a:\"396 * "a:\foo" -> "a:\" 398 397 */ 399 398 BOOL WINAPI PathRemoveFileSpecA(LPSTR lpszPath) 400 399 { 401 LPSTR cutplace = lpszPath;402 BOOL ret = FALSE;403 404 TRACE("%s\n",lpszPath);405 406 if(lpszPath)407 {408 while (*lpszPath == '\\') cutplace = ++lpszPath;409 410 while (*lpszPath)411 {412 if(lpszPath[0] == '\\') cutplace = lpszPath;413 414 if(lpszPath[0] == ':')415 {416 cutplace = lpszPath + 1;417 if (lpszPath[1] == '\\') cutplace++;418 lpszPath++;419 }420 lpszPath = CharNextA(lpszPath);421 if (!lpszPath) break;422 }423 424 ret = (*cutplace!='\0');425 *cutplace = '\0';426 }427 return ret;428 } 429 430 /************************************************************************* 431 * PathRemoveFileSpecW [SHLWAPI.@]400 LPSTR cutplace = lpszPath; 401 BOOL ret = FALSE; 402 403 TRACE("%s\n",lpszPath); 404 405 if(lpszPath) 406 { 407 while (*lpszPath == '\\') cutplace = ++lpszPath; 408 409 while (*lpszPath) 410 { 411 if(lpszPath[0] == '\\') cutplace = lpszPath; 412 413 if(lpszPath[0] == ':') 414 { 415 cutplace = lpszPath + 1; 416 if (lpszPath[1] == '\\') cutplace++; 417 lpszPath++; 418 } 419 lpszPath = CharNextA(lpszPath); 420 if (!lpszPath) break; 421 } 422 423 ret = (*cutplace!='\0'); 424 *cutplace = '\0'; 425 } 426 return ret; 427 } 428 429 /************************************************************************* 430 * PathRemoveFileSpecW [SHLWAPI.@] 432 431 */ 433 432 BOOL WINAPI PathRemoveFileSpecW(LPWSTR lpszPath) 434 433 { 435 LPWSTR cutplace = lpszPath;436 BOOL ret = FALSE;437 438 TRACE("%s\n",debugstr_w(lpszPath));439 440 if(lpszPath)441 {442 while (*lpszPath == '\\') cutplace = ++lpszPath;443 444 while (*lpszPath)445 {446 if(lpszPath[0] == '\\') cutplace = lpszPath;447 448 if(lpszPath[0] == ':')449 {450 cutplace = lpszPath + 1;451 if (lpszPath[1] == '\\') cutplace++;452 lpszPath++;453 }454 lpszPath = CharNextW(lpszPath);455 if (!lpszPath) break;456 }457 458 ret = (*cutplace!='\0');459 *cutplace = '\0';460 }461 return ret;462 } 463 464 /************************************************************************* 465 * PathStripPathA [SHELLWAPI.@]466 * 434 LPWSTR cutplace = lpszPath; 435 BOOL ret = FALSE; 436 437 TRACE("%s\n",debugstr_w(lpszPath)); 438 439 if(lpszPath) 440 { 441 while (*lpszPath == '\\') cutplace = ++lpszPath; 442 443 while (*lpszPath) 444 { 445 if(lpszPath[0] == '\\') cutplace = lpszPath; 446 447 if(lpszPath[0] == ':') 448 { 449 cutplace = lpszPath + 1; 450 if (lpszPath[1] == '\\') cutplace++; 451 lpszPath++; 452 } 453 lpszPath = CharNextW(lpszPath); 454 if (!lpszPath) break; 455 } 456 457 ret = (*cutplace!='\0'); 458 *cutplace = '\0'; 459 } 460 return ret; 461 } 462 463 /************************************************************************* 464 * PathStripPathA [SHELLWAPI.@] 465 * 467 466 * NOTES 468 467 * removes the path from the beginning of a filename … … 470 469 void WINAPI PathStripPathA(LPSTR lpszPath) 471 470 { 472 LPSTR lpszFileName = PathFindFileNameA(lpszPath);473 474 TRACE("%s\n", lpszPath);475 476 if(lpszFileName)477 RtlMoveMemory(lpszPath, lpszFileName, strlen(lpszFileName)+1); 478 } 479 480 /************************************************************************* 481 * PathStripPathW [SHELLWAPI.@]471 LPSTR lpszFileName = PathFindFileNameA(lpszPath); 472 473 TRACE("%s\n", lpszPath); 474 475 if(lpszFileName) 476 RtlMoveMemory(lpszPath, lpszFileName, strlen(lpszFileName)+1); 477 } 478 479 /************************************************************************* 480 * PathStripPathW [SHELLWAPI.@] 482 481 */ 483 482 void WINAPI PathStripPathW(LPWSTR lpszPath) 484 483 { 485 LPWSTR lpszFileName = PathFindFileNameW(lpszPath);486 487 TRACE("%s\n", debugstr_w(lpszPath));488 if(lpszFileName)489 RtlMoveMemory(lpszPath, lpszFileName, (strlenW(lpszFileName)+1)*sizeof(WCHAR)); 490 } 491 492 /************************************************************************* 493 * PathStripToRootA [SHLWAPI.@]484 LPWSTR lpszFileName = PathFindFileNameW(lpszPath); 485 486 TRACE("%s\n", debugstr_w(lpszPath)); 487 if(lpszFileName) 488 RtlMoveMemory(lpszPath, lpszFileName, (strlenW(lpszFileName)+1)*sizeof(WCHAR)); 489 } 490 491 /************************************************************************* 492 * PathStripToRootA [SHLWAPI.@] 494 493 */ 495 494 BOOL WINAPI PathStripToRootA(LPSTR lpszPath) 496 495 { 497 TRACE("%s\n", lpszPath);498 499 if (!lpszPath) return FALSE;500 while(!PathIsRootA(lpszPath))501 if (!PathRemoveFileSpecA(lpszPath)) return FALSE;502 return TRUE;503 } 504 505 /************************************************************************* 506 * PathStripToRootW [SHLWAPI.@]496 TRACE("%s\n", lpszPath); 497 498 if (!lpszPath) return FALSE; 499 while(!PathIsRootA(lpszPath)) 500 if (!PathRemoveFileSpecA(lpszPath)) return FALSE; 501 return TRUE; 502 } 503 504 /************************************************************************* 505 * PathStripToRootW [SHLWAPI.@] 507 506 */ 508 507 BOOL WINAPI PathStripToRootW(LPWSTR lpszPath) 509 508 { 510 TRACE("%s\n", debugstr_w(lpszPath));511 512 if (!lpszPath) return FALSE;513 while(!PathIsRootW(lpszPath))514 if (!PathRemoveFileSpecW(lpszPath)) return FALSE;515 return TRUE;516 } 517 518 /************************************************************************* 519 * PathRemoveArgsA [SHLWAPI.@]509 TRACE("%s\n", debugstr_w(lpszPath)); 510 511 if (!lpszPath) return FALSE; 512 while(!PathIsRootW(lpszPath)) 513 if (!PathRemoveFileSpecW(lpszPath)) return FALSE; 514 return TRUE; 515 } 516 517 /************************************************************************* 518 * PathRemoveArgsA [SHLWAPI.@] 520 519 * 521 520 */ 522 521 void WINAPI PathRemoveArgsA(LPSTR lpszPath) 523 522 { 524 TRACE("%s\n",lpszPath);525 526 if(lpszPath)527 {528 LPSTR lpszArgs = PathGetArgsA(lpszPath);529 if (!*lpszArgs)530 {531 LPSTR lpszLastChar = CharPrevA(lpszPath, lpszArgs);532 if(*lpszLastChar==' ') *lpszLastChar = '\0';533 }534 }535 } 536 537 /************************************************************************* 538 * PathRemoveArgsW [SHLWAPI.@]523 TRACE("%s\n",lpszPath); 524 525 if(lpszPath) 526 { 527 LPSTR lpszArgs = PathGetArgsA(lpszPath); 528 if (!*lpszArgs) 529 { 530 LPSTR lpszLastChar = CharPrevA(lpszPath, lpszArgs); 531 if(*lpszLastChar==' ') *lpszLastChar = '\0'; 532 } 533 } 534 } 535 536 /************************************************************************* 537 * PathRemoveArgsW [SHLWAPI.@] 539 538 */ 540 539 void WINAPI PathRemoveArgsW(LPWSTR lpszPath) 541 540 { 542 TRACE("%s\n", debugstr_w(lpszPath));543 544 if(lpszPath)545 {546 LPWSTR lpszArgs = PathGetArgsW(lpszPath);547 if (!*lpszArgs)548 {549 LPWSTR lpszLastChar = CharPrevW(lpszPath, lpszArgs);550 if(*lpszLastChar==' ') *lpszLastChar = '\0';551 }552 }553 } 554 555 /************************************************************************* 556 * PathRemoveExtensionA [SHLWAPI.@]541 TRACE("%s\n", debugstr_w(lpszPath)); 542 543 if(lpszPath) 544 { 545 LPWSTR lpszArgs = PathGetArgsW(lpszPath); 546 if (!*lpszArgs) 547 { 548 LPWSTR lpszLastChar = CharPrevW(lpszPath, lpszArgs); 549 if(*lpszLastChar==' ') *lpszLastChar = '\0'; 550 } 551 } 552 } 553 554 /************************************************************************* 555 * PathRemoveExtensionA [SHLWAPI.@] 557 556 */ 558 557 void WINAPI PathRemoveExtensionA(LPSTR lpszPath) 559 558 { 560 LPSTR lpszExtension = PathFindExtensionA(lpszPath);561 562 TRACE("%s\n", lpszPath);563 564 if (lpszExtension) *lpszExtension='\0';565 } 566 567 /************************************************************************* 568 * PathRemoveExtensionW [SHLWAPI.@]559 LPSTR lpszExtension = PathFindExtensionA(lpszPath); 560 561 TRACE("%s\n", lpszPath); 562 563 if (lpszExtension) *lpszExtension='\0'; 564 } 565 566 /************************************************************************* 567 * PathRemoveExtensionW [SHLWAPI.@] 569 568 */ 570 569 void WINAPI PathRemoveExtensionW(LPWSTR lpszPath) 571 570 { 572 LPWSTR lpszExtension = PathFindExtensionW(lpszPath);573 574 TRACE("%s\n", debugstr_w(lpszPath));575 576 if (lpszExtension) *lpszExtension='\0';577 } 578 579 /************************************************************************* 580 * PathRemoveBackslashA [SHLWAPI.@]571 LPWSTR lpszExtension = PathFindExtensionW(lpszPath); 572 573 TRACE("%s\n", debugstr_w(lpszPath)); 574 575 if (lpszExtension) *lpszExtension='\0'; 576 } 577 578 /************************************************************************* 579 * PathRemoveBackslashA [SHLWAPI.@] 581 580 * 582 581 * If the path ends in a backslash it is replaced by a NULL 583 582 * and the address of the NULL is returned 584 * Otherwise 583 * Otherwise 585 584 * the address of the last character is returned. 586 585 * … … 590 589 LPSTR WINAPI PathRemoveBackslashA( LPSTR lpszPath ) 591 590 { 592 int len;593 LPSTR szTemp = NULL;594 595 if(lpszPath)596 {597 len = strlen(lpszPath);598 szTemp = CharPrevA(lpszPath, lpszPath+len);599 if (! PathIsRootA(lpszPath))600 {601 if (*szTemp == '\\') *szTemp = '\0';602 }603 }604 return szTemp;605 } 606 607 /************************************************************************* 608 * PathRemoveBackslashW [SHLWAPI.@]591 int len; 592 LPSTR szTemp = NULL; 593 594 if(lpszPath) 595 { 596 len = strlen(lpszPath); 597 szTemp = CharPrevA(lpszPath, lpszPath+len); 598 if (! PathIsRootA(lpszPath)) 599 { 600 if (*szTemp == '\\') *szTemp = '\0'; 601 } 602 } 603 return szTemp; 604 } 605 606 /************************************************************************* 607 * PathRemoveBackslashW [SHLWAPI.@] 609 608 */ 610 609 LPWSTR WINAPI PathRemoveBackslashW( LPWSTR lpszPath ) 611 610 { 612 int len;613 LPWSTR szTemp = NULL;614 615 if(lpszPath)616 {617 len = strlenW(lpszPath);618 szTemp = CharPrevW(lpszPath, lpszPath+len);619 if (! PathIsRootW(lpszPath))620 {621 if (*szTemp == '\\') *szTemp = '\0';622 }623 }624 return szTemp;611 int len; 612 LPWSTR szTemp = NULL; 613 614 if(lpszPath) 615 { 616 len = strlenW(lpszPath); 617 szTemp = CharPrevW(lpszPath, lpszPath+len); 618 if (! PathIsRootW(lpszPath)) 619 { 620 if (*szTemp == '\\') *szTemp = '\0'; 621 } 622 } 623 return szTemp; 625 624 } 626 625 627 626 628 627 /* 629 Path Manipulations628 Path Manipulations 630 629 */ 631 630 632 631 /************************************************************************* 633 632 * PathRemoveBlanksA [SHLWAPI.@] 634 * 633 * 635 634 * NOTES 636 635 * remove spaces from beginning and end of passed string … … 638 637 void WINAPI PathRemoveBlanksA(LPSTR str) 639 638 { 640 LPSTR x = str;641 642 TRACE("%s\n",str);643 644 if(str)645 {646 while (*x==' ') x = CharNextA(x);647 if (x!=str) strcpy(str,x);648 x=str+strlen(str)-1;649 while (*x==' ') x = CharPrevA(str, x);650 if (*x==' ') *x='\0';651 }639 LPSTR x = str; 640 641 TRACE("%s\n",str); 642 643 if(str) 644 { 645 while (*x==' ') x = CharNextA(x); 646 if (x!=str) strcpy(str,x); 647 x=str+strlen(str)-1; 648 while (*x==' ') x = CharPrevA(str, x); 649 if (*x==' ') *x='\0'; 650 } 652 651 } 653 652 … … 657 656 void WINAPI PathRemoveBlanksW(LPWSTR str) 658 657 { 659 LPWSTR x = str;660 661 TRACE("%s\n",debugstr_w(str));662 663 if(str)664 {665 while (*x==' ') x = CharNextW(x);666 if (x!=str) strcpyW(str,x);667 x=str+strlenW(str)-1;668 while (*x==' ') x = CharPrevW(str, x);669 if (*x==' ') *x='\0';670 }658 LPWSTR x = str; 659 660 TRACE("%s\n",debugstr_w(str)); 661 662 if(str) 663 { 664 while (*x==' ') x = CharNextW(x); 665 if (x!=str) strcpyW(str,x); 666 x=str+strlenW(str)-1; 667 while (*x==' ') x = CharPrevW(str, x); 668 if (*x==' ') *x='\0'; 669 } 671 670 } 672 671 673 672 /************************************************************************* 674 673 * PathQuoteSpacesA [SHLWAPI.@] 675 * 674 * 676 675 */ 677 676 LPSTR WINAPI PathQuoteSpacesA(LPSTR lpszPath) 678 677 { 679 TRACE("%s\n",lpszPath);680 681 if(StrChrA(lpszPath,' '))682 {683 int len = strlen(lpszPath);684 RtlMoveMemory(lpszPath+1, lpszPath, len);685 *(lpszPath++) = '"';686 lpszPath += len;687 *(lpszPath++) = '"';688 *(lpszPath) = '\0';689 return --lpszPath;690 }691 return 0;678 TRACE("%s\n",lpszPath); 679 680 if(StrChrA(lpszPath,' ')) 681 { 682 int len = strlen(lpszPath); 683 RtlMoveMemory(lpszPath+1, lpszPath, len); 684 *(lpszPath++) = '"'; 685 lpszPath += len; 686 *(lpszPath++) = '"'; 687 *(lpszPath) = '\0'; 688 return --lpszPath; 689 } 690 return 0; 692 691 } 693 692 … … 697 696 LPWSTR WINAPI PathQuoteSpacesW(LPWSTR lpszPath) 698 697 { 699 TRACE("%s\n",debugstr_w(lpszPath));700 701 if(StrChrW(lpszPath,' '))702 {703 int len = strlenW(lpszPath);704 RtlMoveMemory(lpszPath+1, lpszPath, len*sizeof(WCHAR));705 *(lpszPath++) = '"';706 lpszPath += len;707 *(lpszPath++) = '"';708 *(lpszPath) = '\0';709 return --lpszPath;710 }711 return 0;698 TRACE("%s\n",debugstr_w(lpszPath)); 699 700 if(StrChrW(lpszPath,' ')) 701 { 702 int len = strlenW(lpszPath); 703 RtlMoveMemory(lpszPath+1, lpszPath, len*sizeof(WCHAR)); 704 *(lpszPath++) = '"'; 705 lpszPath += len; 706 *(lpszPath++) = '"'; 707 *(lpszPath) = '\0'; 708 return --lpszPath; 709 } 710 return 0; 712 711 } 713 712 714 713 /************************************************************************* 715 714 * PathUnquoteSpacesA [SHLWAPI.@] 716 * 715 * 717 716 * NOTES 718 717 * unquote string (remove ") 719 718 */ 720 VOID WINAPI PathUnquoteSpacesA(LPSTR str) 721 { 722 DWORD len = strlen(str);723 724 TRACE("%s\n",str);725 726 if (*str!='"')727 return;728 if (str[len-1]!='"')729 return;730 str[len-1]='\0';731 strcpy(str,str+1);732 return;719 VOID WINAPI PathUnquoteSpacesA(LPSTR str) 720 { 721 DWORD len = strlen(str); 722 723 TRACE("%s\n",str); 724 725 if (*str!='"') 726 return; 727 if (str[len-1]!='"') 728 return; 729 str[len-1]='\0'; 730 strcpy(str,str+1); 731 return; 733 732 } 734 733 … … 736 735 * PathUnquoteSpacesW [SHLWAPI.@] 737 736 */ 738 VOID WINAPI PathUnquoteSpacesW(LPWSTR str) 739 { 740 DWORD len = strlenW(str);741 742 TRACE("%s\n",debugstr_w(str));743 744 if (*str!='"')745 return;746 if (str[len-1]!='"')747 return;748 str[len-1]='\0';749 strcpyW(str,str+1);750 return;751 } 752 753 /************************************************************************* 754 * PathParseIconLocationA [SHLWAPI.@]737 VOID WINAPI PathUnquoteSpacesW(LPWSTR str) 738 { 739 DWORD len = strlenW(str); 740 741 TRACE("%s\n",debugstr_w(str)); 742 743 if (*str!='"') 744 return; 745 if (str[len-1]!='"') 746 return; 747 str[len-1]='\0'; 748 strcpyW(str,str+1); 749 return; 750 } 751 752 /************************************************************************* 753 * PathParseIconLocationA [SHLWAPI.@] 755 754 */ 756 755 int WINAPI PathParseIconLocationA(LPSTR lpszPath) 757 756 { 758 LPSTR lpstrComma = strchr(lpszPath, ',');759 760 FIXME("%s stub\n", debugstr_a(lpszPath));761 762 if (lpstrComma && lpstrComma[1])763 {764 lpstrComma[0]='\0';765 /* return atoi(&lpstrComma[1]);FIXME */766 }767 768 PathUnquoteSpacesA(lpszPath);769 return 0;770 } 771 772 /************************************************************************* 773 * PathParseIconLocationW [SHLWAPI.@]757 LPSTR lpstrComma = strchr(lpszPath, ','); 758 759 FIXME("%s stub\n", debugstr_a(lpszPath)); 760 761 if (lpstrComma && lpstrComma[1]) 762 { 763 lpstrComma[0]='\0'; 764 /* return atoi(&lpstrComma[1]); FIXME */ 765 } 766 767 PathUnquoteSpacesA(lpszPath); 768 return 0; 769 } 770 771 /************************************************************************* 772 * PathParseIconLocationW [SHLWAPI.@] 774 773 */ 775 774 int WINAPI PathParseIconLocationW(LPWSTR lpszPath) 776 775 { 777 LPWSTR lpstrComma = strchrW(lpszPath, ',');778 779 FIXME("%s stub\n", debugstr_w(lpszPath));780 781 if (lpstrComma && lpstrComma[1])782 {783 lpstrComma[0]='\0';784 /* return _wtoi(&lpstrComma[1]);FIXME */785 }786 PathUnquoteSpacesW(lpszPath);787 return 0;776 LPWSTR lpstrComma = strchrW(lpszPath, ','); 777 778 FIXME("%s stub\n", debugstr_w(lpszPath)); 779 780 if (lpstrComma && lpstrComma[1]) 781 { 782 lpstrComma[0]='\0'; 783 /* return _wtoi(&lpstrComma[1]); FIXME */ 784 } 785 PathUnquoteSpacesW(lpszPath); 786 return 0; 788 787 } 789 788 790 789 /* 791 ########## cleaning and resolving paths ##########792 */ 793 794 /************************************************************************* 795 * PathFindOnPathA [SHLWAPI.@]790 ########## cleaning and resolving paths ########## 791 */ 792 793 /************************************************************************* 794 * PathFindOnPathA [SHLWAPI.@] 796 795 */ 797 796 BOOL WINAPI PathFindOnPathA(LPSTR sFile, LPCSTR sOtherDirs) 798 797 { 799 FIXME("%s %s\n",sFile, sOtherDirs);800 return FALSE;801 } 802 803 /************************************************************************* 804 * PathFindOnPathW [SHLWAPI.@]798 FIXME("%s %s\n",sFile, sOtherDirs); 799 return FALSE; 800 } 801 802 /************************************************************************* 803 * PathFindOnPathW [SHLWAPI.@] 805 804 */ 806 805 BOOL WINAPI PathFindOnPathW(LPWSTR sFile, LPCWSTR sOtherDirs) 807 806 { 808 FIXME("%s %s\n",debugstr_w(sFile), debugstr_w(sOtherDirs));809 return FALSE;810 } 811 812 /************************************************************************* 813 * PathCompactPathExA [SHLWAPI.@]807 FIXME("%s %s\n",debugstr_w(sFile), debugstr_w(sOtherDirs)); 808 return FALSE; 809 } 810 811 /************************************************************************* 812 * PathCompactPathExA [SHLWAPI.@] 814 813 */ 815 814 BOOL WINAPI PathCompactPathExA( 816 LPSTR pszOut,817 LPCSTR pszSrc,818 UINT cchMax,819 DWORD dwFlags)820 { 821 FIXME("%p %s 0x%08x 0x%08lx\n", pszOut, pszSrc, cchMax, dwFlags);822 return FALSE;823 } 824 825 /************************************************************************* 826 * PathCompactPathExW [SHLWAPI.@]815 LPSTR pszOut, 816 LPCSTR pszSrc, 817 UINT cchMax, 818 DWORD dwFlags) 819 { 820 FIXME("%p %s 0x%08x 0x%08lx\n", pszOut, pszSrc, cchMax, dwFlags); 821 return FALSE; 822 } 823 824 /************************************************************************* 825 * PathCompactPathExW [SHLWAPI.@] 827 826 */ 828 827 BOOL WINAPI PathCompactPathExW( 829 LPWSTR pszOut,830 LPCWSTR pszSrc,831 UINT cchMax,832 DWORD dwFlags)833 { 834 FIXME("%p %s 0x%08x 0x%08lx\n", pszOut, debugstr_w(pszSrc), cchMax, dwFlags);835 return FALSE;828 LPWSTR pszOut, 829 LPCWSTR pszSrc, 830 UINT cchMax, 831 DWORD dwFlags) 832 { 833 FIXME("%p %s 0x%08x 0x%08lx\n", pszOut, debugstr_w(pszSrc), cchMax, dwFlags); 834 return FALSE; 836 835 } 837 836 838 837 /* 839 ########## Path Testing ##########838 ########## Path Testing ########## 840 839 */ 841 840 842 841 /************************************************************************* 843 * PathIsUNCA [SHLWAPI.@]844 * 842 * PathIsUNCA [SHLWAPI.@] 843 * 845 844 * NOTES 846 845 * PathIsUNC(char*path); 847 846 */ 848 BOOL WINAPI PathIsUNCA(LPCSTR lpszPath) 849 { 850 TRACE("%s\n",lpszPath);851 852 return (lpszPath && (lpszPath[0]=='\\') && (lpszPath[1]=='\\'));853 } 854 855 /************************************************************************* 856 * PathIsUNCW [SHLWAPI.@]857 */ 858 BOOL WINAPI PathIsUNCW(LPCWSTR lpszPath) 859 { 860 TRACE("%s\n",debugstr_w(lpszPath));861 862 return (lpszPath && (lpszPath[0]=='\\') && (lpszPath[1]=='\\'));863 } 864 865 /************************************************************************* 866 * PathIsRelativeA [SHLWAPI.@]847 BOOL WINAPI PathIsUNCA(LPCSTR lpszPath) 848 { 849 TRACE("%s\n",lpszPath); 850 851 return (lpszPath && (lpszPath[0]=='\\') && (lpszPath[1]=='\\')); 852 } 853 854 /************************************************************************* 855 * PathIsUNCW [SHLWAPI.@] 856 */ 857 BOOL WINAPI PathIsUNCW(LPCWSTR lpszPath) 858 { 859 TRACE("%s\n",debugstr_w(lpszPath)); 860 861 return (lpszPath && (lpszPath[0]=='\\') && (lpszPath[1]=='\\')); 862 } 863 864 /************************************************************************* 865 * PathIsRelativeA [SHLWAPI.@] 867 866 */ 868 867 BOOL WINAPI PathIsRelativeA (LPCSTR lpszPath) 869 868 { 870 TRACE("lpszPath=%s\n",lpszPath);871 872 return (lpszPath && (lpszPath[0]!='\\' && lpszPath[1]!=':'));873 } 874 875 /************************************************************************* 876 * PathIsRelativeW [SHLWAPI.@]869 TRACE("lpszPath=%s\n",lpszPath); 870 871 return (lpszPath && (lpszPath[0]!='\\' && lpszPath[1]!=':')); 872 } 873 874 /************************************************************************* 875 * PathIsRelativeW [SHLWAPI.@] 877 876 */ 878 877 BOOL WINAPI PathIsRelativeW (LPCWSTR lpszPath) 879 878 { 880 TRACE("lpszPath=%s\n",debugstr_w(lpszPath));881 882 return (lpszPath && (lpszPath[0]!='\\' && lpszPath[1]!=':'));883 } 884 885 /************************************************************************* 886 * PathIsRootA [SHLWAPI.@]879 TRACE("lpszPath=%s\n",debugstr_w(lpszPath)); 880 881 return (lpszPath && (lpszPath[0]!='\\' && lpszPath[1]!=':')); 882 } 883 884 /************************************************************************* 885 * PathIsRootA [SHLWAPI.@] 887 886 * 888 887 * notes … … 891 890 BOOL WINAPI PathIsRootA(LPCSTR lpszPath) 892 891 { 893 TRACE("%s\n",lpszPath);894 895 /* X:\ */896 if (lpszPath[1]==':' && lpszPath[2]=='\\' && lpszPath[3]=='\0')897 return TRUE;898 899 /* "\" */900 if (lpszPath[0]=='\\' && lpszPath[1]=='\0')901 return TRUE;902 903 /* UNC "\\<computer>\<share>" */904 if (lpszPath[0]=='\\' && lpszPath[1]=='\\') 905 {906 int foundbackslash = 0;907 lpszPath += 2;908 while (*lpszPath)909 {910 if (*lpszPath=='\\') foundbackslash++;911 lpszPath = CharNextA(lpszPath);912 }913 if (foundbackslash <= 1)914 return TRUE;915 }916 return FALSE;917 } 918 919 /************************************************************************* 920 * PathIsRootW [SHLWAPI.@]921 */ 922 BOOL WINAPI PathIsRootW(LPCWSTR lpszPath) 923 { 924 TRACE("%s\n",debugstr_w(lpszPath));925 926 /* X:\ */927 if (lpszPath[1]==':' && lpszPath[2]=='\\' && lpszPath[3]=='\0')928 return TRUE;929 930 /* "\" */931 if (lpszPath[0]=='\\' && lpszPath[1]=='\0')932 return TRUE;933 934 /* UNC "\\<computer>\<share>" */935 if (lpszPath[0]=='\\' && lpszPath[1]=='\\') 936 {937 int foundbackslash = 0;938 lpszPath += 2;939 while (*lpszPath)940 {941 if (*lpszPath=='\\') foundbackslash++;942 lpszPath = CharNextW(lpszPath);943 }944 if (foundbackslash <= 1)945 return TRUE;946 }947 return FALSE;948 949 } 950 951 /************************************************************************* 952 * PathIsDirectoryA [SHLWAPI.@]892 TRACE("%s\n",lpszPath); 893 894 /* X:\ */ 895 if (lpszPath[1]==':' && lpszPath[2]=='\\' && lpszPath[3]=='\0') 896 return TRUE; 897 898 /* "\" */ 899 if (lpszPath[0]=='\\' && lpszPath[1]=='\0') 900 return TRUE; 901 902 /* UNC "\\<computer>\<share>" */ 903 if (lpszPath[0]=='\\' && lpszPath[1]=='\\') 904 { 905 int foundbackslash = 0; 906 lpszPath += 2; 907 while (*lpszPath) 908 { 909 if (*lpszPath=='\\') foundbackslash++; 910 lpszPath = CharNextA(lpszPath); 911 } 912 if (foundbackslash <= 1) 913 return TRUE; 914 } 915 return FALSE; 916 } 917 918 /************************************************************************* 919 * PathIsRootW [SHLWAPI.@] 920 */ 921 BOOL WINAPI PathIsRootW(LPCWSTR lpszPath) 922 { 923 TRACE("%s\n",debugstr_w(lpszPath)); 924 925 /* X:\ */ 926 if (lpszPath[1]==':' && lpszPath[2]=='\\' && lpszPath[3]=='\0') 927 return TRUE; 928 929 /* "\" */ 930 if (lpszPath[0]=='\\' && lpszPath[1]=='\0') 931 return TRUE; 932 933 /* UNC "\\<computer>\<share>" */ 934 if (lpszPath[0]=='\\' && lpszPath[1]=='\\') 935 { 936 int foundbackslash = 0; 937 lpszPath += 2; 938 while (*lpszPath) 939 { 940 if (*lpszPath=='\\') foundbackslash++; 941 lpszPath = CharNextW(lpszPath); 942 } 943 if (foundbackslash <= 1) 944 return TRUE; 945 } 946 return FALSE; 947 948 } 949 950 /************************************************************************* 951 * PathIsDirectoryA [SHLWAPI.@] 953 952 */ 954 953 BOOL WINAPI PathIsDirectoryA(LPCSTR lpszPath) 955 954 { 956 DWORD dwAttr;957 958 TRACE("%s\n", debugstr_a(lpszPath));959 960 dwAttr = GetFileAttributesA(lpszPath);961 return (dwAttr != -1) ? dwAttr & FILE_ATTRIBUTE_DIRECTORY : 0;962 } 963 964 /************************************************************************* 965 * PathIsDirectoryW [SHLWAPI.@]955 DWORD dwAttr; 956 957 TRACE("%s\n", debugstr_a(lpszPath)); 958 959 dwAttr = GetFileAttributesA(lpszPath); 960 return (dwAttr != -1) ? dwAttr & FILE_ATTRIBUTE_DIRECTORY : 0; 961 } 962 963 /************************************************************************* 964 * PathIsDirectoryW [SHLWAPI.@] 966 965 */ 967 966 BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath) 968 967 { 969 DWORD dwAttr;970 971 TRACE("%s\n", debugstr_w(lpszPath));972 973 dwAttr = GetFileAttributesW(lpszPath);974 return (dwAttr != -1) ? dwAttr & FILE_ATTRIBUTE_DIRECTORY : 0;975 } 976 977 /************************************************************************* 978 * PathFileExistsA [SHLWAPI.@]979 * 968 DWORD dwAttr; 969 970 TRACE("%s\n", debugstr_w(lpszPath)); 971 972 dwAttr = GetFileAttributesW(lpszPath); 973 return (dwAttr != -1) ? dwAttr & FILE_ATTRIBUTE_DIRECTORY : 0; 974 } 975 976 /************************************************************************* 977 * PathFileExistsA [SHLWAPI.@] 978 * 980 979 * NOTES 981 980 * file_exists(char *fn); 982 981 */ 983 BOOL WINAPI PathFileExistsA(LPCSTR lpszPath) 984 { 985 TRACE("%s\n",lpszPath);986 return (GetFileAttributesA(lpszPath)!=-1);987 } 988 989 /************************************************************************* 990 * PathFileExistsW [SHLWAPI.@]991 */ 992 BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath) 993 { 994 TRACE("%s\n",debugstr_w(lpszPath));995 return (GetFileAttributesW(lpszPath)!=-1);996 } 997 998 /************************************************************************* 999 * PathMatchSingleMaskA [internal]1000 * 982 BOOL WINAPI PathFileExistsA(LPCSTR lpszPath) 983 { 984 TRACE("%s\n",lpszPath); 985 return (GetFileAttributesA(lpszPath)!=-1); 986 } 987 988 /************************************************************************* 989 * PathFileExistsW [SHLWAPI.@] 990 */ 991 BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath) 992 { 993 TRACE("%s\n",debugstr_w(lpszPath)); 994 return (GetFileAttributesW(lpszPath)!=-1); 995 } 996 997 /************************************************************************* 998 * PathMatchSingleMaskA [internal] 999 * 1001 1000 * NOTES 1002 1001 * internal (used by PathMatchSpec) … … 1004 1003 static BOOL PathMatchSingleMaskA(LPCSTR name, LPCSTR mask) 1005 1004 { 1006 while (*name && *mask && *mask!=';') 1007 {1008 if (*mask=='*') 1009 {1010 do 1011 {1012 if (PathMatchSingleMaskA(name,mask+1)) return 1; /* try substrings */1013 } while (*name++);1014 return 0;1015 }1016 if (toupper(*mask)!=toupper(*name) && *mask!='?') return 0;1017 name = CharNextA(name);1018 mask = CharNextA(mask);1019 }1020 if (!*name) 1021 {1022 while (*mask=='*') mask++;1023 if (!*mask || *mask==';') return 1;1024 }1025 return 0;1026 } 1027 1028 /************************************************************************* 1029 * PathMatchSingleMaskW [internal]1005 while (*name && *mask && *mask!=';') 1006 { 1007 if (*mask=='*') 1008 { 1009 do 1010 { 1011 if (PathMatchSingleMaskA(name,mask+1)) return 1; /* try substrings */ 1012 } while (*name++); 1013 return 0; 1014 } 1015 if (toupper(*mask)!=toupper(*name) && *mask!='?') return 0; 1016 name = CharNextA(name); 1017 mask = CharNextA(mask); 1018 } 1019 if (!*name) 1020 { 1021 while (*mask=='*') mask++; 1022 if (!*mask || *mask==';') return 1; 1023 } 1024 return 0; 1025 } 1026 1027 /************************************************************************* 1028 * PathMatchSingleMaskW [internal] 1030 1029 */ 1031 1030 static BOOL PathMatchSingleMaskW(LPCWSTR name, LPCWSTR mask) 1032 1031 { 1033 while (*name && *mask && *mask!=';') 1034 {1035 if (*mask=='*') 1036 {1037 do 1038 {1039 if (PathMatchSingleMaskW(name,mask+1)) return 1; /* try substrings */1040 } while (*name++);1041 return 0;1042 }1043 if (toupperW(*mask)!=toupperW(*name) && *mask!='?') return 0;1044 name = CharNextW(name);1045 mask = CharNextW(mask);1046 }1047 if (!*name) 1048 {1049 while (*mask=='*') mask++;1050 if (!*mask || *mask==';') return 1;1051 }1052 return 0;1053 } 1054 /************************************************************************* 1055 * PathMatchSpecA [SHLWAPI.@]1056 * 1032 while (*name && *mask && *mask!=';') 1033 { 1034 if (*mask=='*') 1035 { 1036 do 1037 { 1038 if (PathMatchSingleMaskW(name,mask+1)) return 1; /* try substrings */ 1039 } while (*name++); 1040 return 0; 1041 } 1042 if (toupperW(*mask)!=toupperW(*name) && *mask!='?') return 0; 1043 name = CharNextW(name); 1044 mask = CharNextW(mask); 1045 } 1046 if (!*name) 1047 { 1048 while (*mask=='*') mask++; 1049 if (!*mask || *mask==';') return 1; 1050 } 1051 return 0; 1052 } 1053 /************************************************************************* 1054 * PathMatchSpecA [SHLWAPI.@] 1055 * 1057 1056 * NOTES 1058 1057 * used from COMDLG32 1059 1058 */ 1060 BOOL WINAPI PathMatchSpecA(LPCSTR name, LPCSTR mask) 1061 { 1062 TRACE("%s %s\n",name,mask);1063 1064 if (!lstrcmpA( mask, "*.*" )) return 1; /* we don't require a period */1065 1066 while (*mask) 1067 {1068 if (PathMatchSingleMaskA(name,mask)) return 1; /* helper function */1069 while (*mask && *mask!=';') mask = CharNextA(mask);1070 if (*mask==';') 1071 {1072 mask++;1073 while (*mask==' ') mask++; /* masks may be separated by "; " */1074 }1075 }1076 return 0;1077 } 1078 1079 /************************************************************************* 1080 * PathMatchSpecW [SHLWAPI.@]1081 */ 1082 BOOL WINAPI PathMatchSpecW(LPCWSTR name, LPCWSTR mask) 1059 BOOL WINAPI PathMatchSpecA(LPCSTR name, LPCSTR mask) 1060 { 1061 TRACE("%s %s\n",name,mask); 1062 1063 if (!lstrcmpA( mask, "*.*" )) return 1; /* we don't require a period */ 1064 1065 while (*mask) 1066 { 1067 if (PathMatchSingleMaskA(name,mask)) return 1; /* helper function */ 1068 while (*mask && *mask!=';') mask = CharNextA(mask); 1069 if (*mask==';') 1070 { 1071 mask++; 1072 while (*mask==' ') mask++; /* masks may be separated by "; " */ 1073 } 1074 } 1075 return 0; 1076 } 1077 1078 /************************************************************************* 1079 * PathMatchSpecW [SHLWAPI.@] 1080 */ 1081 BOOL WINAPI PathMatchSpecW(LPCWSTR name, LPCWSTR mask) 1083 1082 { 1084 1083 static const WCHAR stemp[] = { '*','.','*',0 }; 1085 TRACE("%s %s\n",debugstr_w(name),debugstr_w(mask));1086 1087 if (!lstrcmpW( mask, stemp )) return 1; /* we don't require a period */1088 1089 while (*mask) 1090 {1091 if (PathMatchSingleMaskW(name,mask)) return 1; /* helper function */1092 while (*mask && *mask!=';') mask = CharNextW(mask);1093 if (*mask==';') 1094 {1095 mask++;1096 while (*mask==' ') mask++; /* masks may be separated by "; " */1097 }1098 }1099 return 0;1100 } 1101 1102 /************************************************************************* 1103 * PathIsSameRootA [SHLWAPI.@]1084 TRACE("%s %s\n",debugstr_w(name),debugstr_w(mask)); 1085 1086 if (!lstrcmpW( mask, stemp )) return 1; /* we don't require a period */ 1087 1088 while (*mask) 1089 { 1090 if (PathMatchSingleMaskW(name,mask)) return 1; /* helper function */ 1091 while (*mask && *mask!=';') mask = CharNextW(mask); 1092 if (*mask==';') 1093 { 1094 mask++; 1095 while (*mask==' ') mask++; /* masks may be separated by "; " */ 1096 } 1097 } 1098 return 0; 1099 } 1100 1101 /************************************************************************* 1102 * PathIsSameRootA [SHLWAPI.@] 1104 1103 * 1105 1104 * FIXME … … 1108 1107 BOOL WINAPI PathIsSameRootA(LPCSTR lpszPath1, LPCSTR lpszPath2) 1109 1108 { 1110 TRACE("%s %s\n", lpszPath1, lpszPath2);1111 1112 if (PathIsRelativeA(lpszPath1) || PathIsRelativeA(lpszPath2)) return FALSE;1113 1114 /* usual path */1115 if ( toupper(lpszPath1[0])==toupper(lpszPath2[0]) &&1116 lpszPath1[1]==':' && lpszPath2[1]==':' &&1117 lpszPath1[2]=='\\' && lpszPath2[2]=='\\')1118 return TRUE;1119 1120 /* UNC */1121 if (lpszPath1[0]=='\\' && lpszPath2[0]=='\\' &&1122 lpszPath1[1]=='\\' && lpszPath2[1]=='\\')1123 {1124 int pos=2, bsfound=0;1125 while (lpszPath1[pos] && lpszPath2[pos] &&1126 (lpszPath1[pos] == lpszPath2[pos]))1127 {1128 if (lpszPath1[pos]=='\\') bsfound++;1129 if (bsfound == 2) return TRUE;1130 pos++; /* fixme: use CharNext*/1131 }1132 return (lpszPath1[pos] == lpszPath2[pos]);1133 }1134 return FALSE;1135 } 1136 1137 /************************************************************************* 1138 * PathIsSameRootW [SHLWAPI.@]1109 TRACE("%s %s\n", lpszPath1, lpszPath2); 1110 1111 if (PathIsRelativeA(lpszPath1) || PathIsRelativeA(lpszPath2)) return FALSE; 1112 1113 /* usual path */ 1114 if ( toupper(lpszPath1[0])==toupper(lpszPath2[0]) && 1115 lpszPath1[1]==':' && lpszPath2[1]==':' && 1116 lpszPath1[2]=='\\' && lpszPath2[2]=='\\') 1117 return TRUE; 1118 1119 /* UNC */ 1120 if (lpszPath1[0]=='\\' && lpszPath2[0]=='\\' && 1121 lpszPath1[1]=='\\' && lpszPath2[1]=='\\') 1122 { 1123 int pos=2, bsfound=0; 1124 while (lpszPath1[pos] && lpszPath2[pos] && 1125 (lpszPath1[pos] == lpszPath2[pos])) 1126 { 1127 if (lpszPath1[pos]=='\\') bsfound++; 1128 if (bsfound == 2) return TRUE; 1129 pos++; /* fixme: use CharNext*/ 1130 } 1131 return (lpszPath1[pos] == lpszPath2[pos]); 1132 } 1133 return FALSE; 1134 } 1135 1136 /************************************************************************* 1137 * PathIsSameRootW [SHLWAPI.@] 1139 1138 */ 1140 1139 BOOL WINAPI PathIsSameRootW(LPCWSTR lpszPath1, LPCWSTR lpszPath2) 1141 1140 { 1142 TRACE("%s %s\n", debugstr_w(lpszPath1), debugstr_w(lpszPath2));1143 1144 if (PathIsRelativeW(lpszPath1) || PathIsRelativeW(lpszPath2)) return FALSE;1145 1146 /* usual path */1147 if ( toupperW(lpszPath1[0])==toupperW(lpszPath2[0]) &&1148 lpszPath1[1]==':' && lpszPath2[1]==':' &&1149 lpszPath1[2]=='\\' && lpszPath2[2]=='\\')1150 return TRUE;1151 1152 /* UNC */1153 if (lpszPath1[0]=='\\' && lpszPath2[0]=='\\' &&1154 lpszPath1[1]=='\\' && lpszPath2[1]=='\\')1155 {1156 int pos=2, bsfound=0;1157 while (lpszPath1[pos] && lpszPath2[pos] &&1158 (lpszPath1[pos] == lpszPath2[pos]))1159 {1160 if (lpszPath1[pos]=='\\') bsfound++;1161 if (bsfound == 2) return TRUE;1162 pos++;/* fixme: use CharNext*/1163 }1164 return (lpszPath1[pos] == lpszPath2[pos]);1165 }1166 return FALSE;1141 TRACE("%s %s\n", debugstr_w(lpszPath1), debugstr_w(lpszPath2)); 1142 1143 if (PathIsRelativeW(lpszPath1) || PathIsRelativeW(lpszPath2)) return FALSE; 1144 1145 /* usual path */ 1146 if ( toupperW(lpszPath1[0])==toupperW(lpszPath2[0]) && 1147 lpszPath1[1]==':' && lpszPath2[1]==':' && 1148 lpszPath1[2]=='\\' && lpszPath2[2]=='\\') 1149 return TRUE; 1150 1151 /* UNC */ 1152 if (lpszPath1[0]=='\\' && lpszPath2[0]=='\\' && 1153 lpszPath1[1]=='\\' && lpszPath2[1]=='\\') 1154 { 1155 int pos=2, bsfound=0; 1156 while (lpszPath1[pos] && lpszPath2[pos] && 1157 (lpszPath1[pos] == lpszPath2[pos])) 1158 { 1159 if (lpszPath1[pos]=='\\') bsfound++; 1160 if (bsfound == 2) return TRUE; 1161 pos++;/* fixme: use CharNext*/ 1162 } 1163 return (lpszPath1[pos] == lpszPath2[pos]); 1164 } 1165 return FALSE; 1167 1166 } 1168 1167 … … 1180 1179 // DWORD dwUnknown = SHREG_xxx; // 0x18 1181 1180 // return SHLWAPI_1(lpstrPath, &dwUnknown); 1182 1183 1184 LPSTR lpstrRes;1185 int iSize, i=0;1186 static LPSTR SupportedProtocol[] = 1187 {"http","https","ftp","gopher","file","mailto",NULL};1188 1189 if(!lpstrPath) return FALSE;1190 1191 /* get protocol */1192 lpstrRes = strchr(lpstrPath,':');1193 if(!lpstrRes) return FALSE;1194 iSize = lpstrRes - lpstrPath;1195 1196 while(SupportedProtocol[i])1197 {1198 if (iSize == strlen(SupportedProtocol[i]))1199 if(!strncasecmp(lpstrPath, SupportedProtocol[i], iSize))1200 return TRUE;1201 i++;1202 }1203 1204 return FALSE;1205 } 1181 1182 1183 LPSTR lpstrRes; 1184 int iSize, i=0; 1185 static LPSTR SupportedProtocol[] = 1186 {"http","https","ftp","gopher","file","mailto",NULL}; 1187 1188 if(!lpstrPath) return FALSE; 1189 1190 /* get protocol */ 1191 lpstrRes = strchr(lpstrPath,':'); 1192 if(!lpstrRes) return FALSE; 1193 iSize = lpstrRes - lpstrPath; 1194 1195 while(SupportedProtocol[i]) 1196 { 1197 if (iSize == strlen(SupportedProtocol[i])) 1198 if(!strncasecmp(lpstrPath, SupportedProtocol[i], iSize)) 1199 return TRUE; 1200 i++; 1201 } 1202 1203 return FALSE; 1204 } 1206 1205 1207 1206 /************************************************************************* … … 1210 1209 BOOL WINAPI PathIsURLW(LPCWSTR lpstrPath) 1211 1210 { 1212 LPWSTR lpstrRes;1213 int iSize, i=0;1214 static WCHAR SupportedProtocol[7][7] = 1215 {{'h','t','t','p','\0'},{'h','t','t','p','s','\0'},{'f','t','p','\0'},1216 {'g','o','p','h','e','r','\0'},{'f','i','l','e','\0'},1217 {'m','a','i','l','t','o','\0'},{0}};1218 1219 if(!lpstrPath) return FALSE;1220 1221 /* get protocol */1222 lpstrRes = strchrW(lpstrPath,':');1223 if(!lpstrRes) return FALSE;1224 iSize = lpstrRes - lpstrPath;1225 1226 while(SupportedProtocol[i])1227 {1228 if (iSize == strlenW(SupportedProtocol[i]))1229 if(!strncmpiW(lpstrPath, SupportedProtocol[i], iSize))1230 return TRUE;1231 i++;1232 }1233 1234 return FALSE;1235 } 1236 1237 1238 /************************************************************************* 1239 * PathIsContentTypeA [SHLWAPI.@]1211 LPWSTR lpstrRes; 1212 int iSize, i=0; 1213 static WCHAR SupportedProtocol[7][7] = 1214 {{'h','t','t','p','\0'},{'h','t','t','p','s','\0'},{'f','t','p','\0'}, 1215 {'g','o','p','h','e','r','\0'},{'f','i','l','e','\0'}, 1216 {'m','a','i','l','t','o','\0'},{0}}; 1217 1218 if(!lpstrPath) return FALSE; 1219 1220 /* get protocol */ 1221 lpstrRes = strchrW(lpstrPath,':'); 1222 if(!lpstrRes) return FALSE; 1223 iSize = lpstrRes - lpstrPath; 1224 1225 while(SupportedProtocol[i]) 1226 { 1227 if (iSize == strlenW(SupportedProtocol[i])) 1228 if(!strncmpiW(lpstrPath, SupportedProtocol[i], iSize)) 1229 return TRUE; 1230 i++; 1231 } 1232 1233 return FALSE; 1234 } 1235 1236 1237 /************************************************************************* 1238 * PathIsContentTypeA [SHLWAPI.@] 1240 1239 */ 1241 1240 BOOL WINAPI PathIsContentTypeA(LPCSTR pszPath, LPCSTR pszContentType) 1242 1241 { 1243 FIXME("%s %s\n", pszPath, pszContentType);1244 return FALSE;1245 } 1246 1247 /************************************************************************* 1248 * PathIsContentTypeW [SHLWAPI.@]1242 FIXME("%s %s\n", pszPath, pszContentType); 1243 return FALSE; 1244 } 1245 1246 /************************************************************************* 1247 * PathIsContentTypeW [SHLWAPI.@] 1249 1248 */ 1250 1249 BOOL WINAPI PathIsContentTypeW(LPCWSTR pszPath, LPCWSTR pszContentType) 1251 1250 { 1252 FIXME("%s %s\n", debugstr_w(pszPath), debugstr_w(pszContentType));1253 return FALSE;1254 } 1255 1256 /************************************************************************* 1257 * PathIsFileSpecA [SHLWAPI.@]1251 FIXME("%s %s\n", debugstr_w(pszPath), debugstr_w(pszContentType)); 1252 return FALSE; 1253 } 1254 1255 /************************************************************************* 1256 * PathIsFileSpecA [SHLWAPI.@] 1258 1257 */ 1259 1258 BOOL WINAPI PathIsFileSpecA(LPCSTR pszPath) 1260 1259 { 1261 FIXME("%s\n", pszPath);1262 return FALSE;1263 } 1264 1265 /************************************************************************* 1266 * PathIsFileSpecW [SHLWAPI.@]1260 FIXME("%s\n", pszPath); 1261 return FALSE; 1262 } 1263 1264 /************************************************************************* 1265 * PathIsFileSpecW [SHLWAPI.@] 1267 1266 */ 1268 1267 BOOL WINAPI PathIsFileSpecW(LPCWSTR pszPath) 1269 1268 { 1270 FIXME("%s\n", debugstr_w(pszPath));1271 return FALSE;1272 } 1273 1274 /************************************************************************* 1275 * PathIsPrefixA [SHLWAPI.@]1269 FIXME("%s\n", debugstr_w(pszPath)); 1270 return FALSE; 1271 } 1272 1273 /************************************************************************* 1274 * PathIsPrefixA [SHLWAPI.@] 1276 1275 */ 1277 1276 BOOL WINAPI PathIsPrefixA(LPCSTR pszPrefix, LPCSTR pszPath) 1278 1277 { 1279 FIXME("%s %s\n", pszPrefix, pszPath);1280 return FALSE;1281 } 1282 1283 /************************************************************************* 1284 * PathIsPrefixW [SHLWAPI.@]1278 FIXME("%s %s\n", pszPrefix, pszPath); 1279 return FALSE; 1280 } 1281 1282 /************************************************************************* 1283 * PathIsPrefixW [SHLWAPI.@] 1285 1284 */ 1286 1285 BOOL WINAPI PathIsPrefixW(LPCWSTR pszPrefix, LPCWSTR pszPath) 1287 1286 { 1288 FIXME("%s %s\n", debugstr_w(pszPrefix), debugstr_w(pszPath));1289 return FALSE;1290 } 1291 1292 /************************************************************************* 1293 * PathIsSystemFolderA [SHLWAPI.@]1287 FIXME("%s %s\n", debugstr_w(pszPrefix), debugstr_w(pszPath)); 1288 return FALSE; 1289 } 1290 1291 /************************************************************************* 1292 * PathIsSystemFolderA [SHLWAPI.@] 1294 1293 */ 1295 1294 BOOL WINAPI PathIsSystemFolderA(LPCSTR pszPath, DWORD dwAttrb) 1296 1295 { 1297 FIXME("%s 0x%08lx\n", pszPath, dwAttrb);1298 return FALSE;1299 } 1300 1301 /************************************************************************* 1302 * PathIsSystemFolderW [SHLWAPI.@]1296 FIXME("%s 0x%08lx\n", pszPath, dwAttrb); 1297 return FALSE; 1298 } 1299 1300 /************************************************************************* 1301 * PathIsSystemFolderW [SHLWAPI.@] 1303 1302 */ 1304 1303 BOOL WINAPI PathIsSystemFolderW(LPCWSTR pszPath, DWORD dwAttrb) 1305 1304 { 1306 FIXME("%s 0x%08lx\n", debugstr_w(pszPath), dwAttrb);1307 return FALSE;1308 } 1309 1310 /************************************************************************* 1311 * PathIsUNCServerA [SHLWAPI.@]1305 FIXME("%s 0x%08lx\n", debugstr_w(pszPath), dwAttrb); 1306 return FALSE; 1307 } 1308 1309 /************************************************************************* 1310 * PathIsUNCServerA [SHLWAPI.@] 1312 1311 */ 1313 1312 BOOL WINAPI PathIsUNCServerA( 1314 LPCSTR pszPath)1315 { 1316 FIXME("%s\n", pszPath);1317 return FALSE;1318 } 1319 1320 /************************************************************************* 1321 * PathIsUNCServerW [SHLWAPI.@]1313 LPCSTR pszPath) 1314 { 1315 FIXME("%s\n", pszPath); 1316 return FALSE; 1317 } 1318 1319 /************************************************************************* 1320 * PathIsUNCServerW [SHLWAPI.@] 1322 1321 */ 1323 1322 BOOL WINAPI PathIsUNCServerW( 1324 LPCWSTR pszPath)1325 { 1326 FIXME("%s\n", debugstr_w(pszPath));1327 return FALSE;1328 } 1329 1330 /************************************************************************* 1331 * PathIsUNCServerShareA [SHLWAPI.@]1323 LPCWSTR pszPath) 1324 { 1325 FIXME("%s\n", debugstr_w(pszPath)); 1326 return FALSE; 1327 } 1328 1329 /************************************************************************* 1330 * PathIsUNCServerShareA [SHLWAPI.@] 1332 1331 */ 1333 1332 BOOL WINAPI PathIsUNCServerShareA( 1334 LPCSTR pszPath)1335 { 1336 FIXME("%s\n", pszPath);1337 return FALSE;1338 } 1339 1340 /************************************************************************* 1341 * PathIsUNCServerShareW [SHLWAPI.@]1333 LPCSTR pszPath) 1334 { 1335 FIXME("%s\n", pszPath); 1336 return FALSE; 1337 } 1338 1339 /************************************************************************* 1340 * PathIsUNCServerShareW [SHLWAPI.@] 1342 1341 */ 1343 1342 BOOL WINAPI PathIsUNCServerShareW( 1344 LPCWSTR pszPath)1345 { 1346 FIXME("%s\n", debugstr_w(pszPath));1347 return FALSE;1343 LPCWSTR pszPath) 1344 { 1345 FIXME("%s\n", debugstr_w(pszPath)); 1346 return FALSE; 1348 1347 } 1349 1348 … … 1354 1353 * returnvalue, use CharNext 1355 1354 */ 1356 1355 1357 1356 BOOL WINAPI PathCanonicalizeA(LPSTR pszBuf, LPCSTR pszPath) 1358 1357 { 1359 int OffsetMin = 0, OffsetSrc = 0, OffsetDst = 0, LenSrc = strlen(pszPath);1360 BOOL bModifyed = FALSE;1361 1362 TRACE("%p %s\n", pszBuf, pszPath);1363 1364 pszBuf[OffsetDst]='\0';1365 1366 /* keep the root of the path */1367 if( LenSrc && (pszPath[OffsetSrc]=='\\'))1368 {1369 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--;1370 }1371 else if ( (LenSrc >= 2) && (pszPath[OffsetSrc+1] == ':'))1372 {1373 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--;1374 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--;1375 if (LenSrc && (pszPath[OffsetSrc] == '\\'))1376 {1377 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--;1378 if (LenSrc == 1 && pszPath[OffsetSrc]=='.')1379 {1380 /* C:\. */1381 OffsetSrc++; LenSrc--; bModifyed = TRUE;1382 } 1383 else if (LenSrc == 2 && pszPath[OffsetSrc]=='.' && pszPath[OffsetSrc+1]=='.')1384 {1385 /* C:\.. */1386 OffsetSrc+=2; LenSrc-=2; bModifyed = TRUE;1387 } 1358 int OffsetMin = 0, OffsetSrc = 0, OffsetDst = 0, LenSrc = strlen(pszPath); 1359 BOOL bModifyed = FALSE; 1360 1361 TRACE("%p %s\n", pszBuf, pszPath); 1362 1363 pszBuf[OffsetDst]='\0'; 1364 1365 /* keep the root of the path */ 1366 if( LenSrc && (pszPath[OffsetSrc]=='\\')) 1367 { 1368 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--; 1369 } 1370 else if ( (LenSrc >= 2) && (pszPath[OffsetSrc+1] == ':')) 1371 { 1372 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--; 1373 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--; 1374 if (LenSrc && (pszPath[OffsetSrc] == '\\')) 1375 { 1376 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--; 1377 if (LenSrc == 1 && pszPath[OffsetSrc]=='.') 1378 { 1379 /* C:\. */ 1380 OffsetSrc++; LenSrc--; bModifyed = TRUE; 1381 } 1382 else if (LenSrc == 2 && pszPath[OffsetSrc]=='.' && pszPath[OffsetSrc+1]=='.') 1383 { 1384 /* C:\.. */ 1385 OffsetSrc+=2; LenSrc-=2; bModifyed = TRUE; 1386 } 1388 1387 } 1389 }1390 1391 /* ".\" at the beginning of the path */1392 if (LenSrc >= 2 && pszPath[OffsetSrc]=='.' && pszPath[OffsetSrc+1]=='\\')1393 {1394 OffsetSrc+=2; LenSrc-=2; bModifyed = TRUE;1395 } 1396 1397 while ( LenSrc )1398 {1399 if((LenSrc>=3) && (pszPath[OffsetSrc]=='\\') && (pszPath[OffsetSrc+1]=='.') && (pszPath[OffsetSrc+2]=='.'))1400 {1401 /* "\.." found, go one deeper */1402 while((OffsetDst > OffsetMin) && (pszBuf[OffsetDst]!='\\')) OffsetDst--;1403 OffsetSrc += 3; LenSrc -= 3; bModifyed = TRUE;1404 if(OffsetDst == OffsetMin && pszPath[OffsetSrc]=='\\') OffsetSrc++;1405 pszBuf[OffsetDst] = '\0';/* important for \..\.. */1406 }1407 else if(LenSrc>=2 && pszPath[OffsetSrc]=='\\' && pszPath[OffsetSrc+1]=='.' )1408 {1409 /* "\." found, skip it */1410 OffsetSrc += 2; LenSrc-=2; bModifyed = TRUE;1411 }1412 else1413 {1414 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; LenSrc--;1415 }1416 }1417 pszBuf[OffsetDst] = '\0';1418 TRACE("-- %s %u\n", pszBuf, bModifyed);1419 return bModifyed;1388 } 1389 1390 /* ".\" at the beginning of the path */ 1391 if (LenSrc >= 2 && pszPath[OffsetSrc]=='.' && pszPath[OffsetSrc+1]=='\\') 1392 { 1393 OffsetSrc+=2; LenSrc-=2; bModifyed = TRUE; 1394 } 1395 1396 while ( LenSrc ) 1397 { 1398 if((LenSrc>=3) && (pszPath[OffsetSrc]=='\\') && (pszPath[OffsetSrc+1]=='.') && (pszPath[OffsetSrc+2]=='.')) 1399 { 1400 /* "\.." found, go one deeper */ 1401 while((OffsetDst > OffsetMin) && (pszBuf[OffsetDst]!='\\')) OffsetDst--; 1402 OffsetSrc += 3; LenSrc -= 3; bModifyed = TRUE; 1403 if(OffsetDst == OffsetMin && pszPath[OffsetSrc]=='\\') OffsetSrc++; 1404 pszBuf[OffsetDst] = '\0'; /* important for \..\.. */ 1405 } 1406 else if(LenSrc>=2 && pszPath[OffsetSrc]=='\\' && pszPath[OffsetSrc+1]=='.' ) 1407 { 1408 /* "\." found, skip it */ 1409 OffsetSrc += 2; LenSrc-=2; bModifyed = TRUE; 1410 } 1411 else 1412 { 1413 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; LenSrc--; 1414 } 1415 } 1416 pszBuf[OffsetDst] = '\0'; 1417 TRACE("-- %s %u\n", pszBuf, bModifyed); 1418 return bModifyed; 1420 1419 } 1421 1420 … … 1429 1428 BOOL WINAPI PathCanonicalizeW(LPWSTR pszBuf, LPCWSTR pszPath) 1430 1429 { 1431 int OffsetMin = 0, OffsetSrc = 0, OffsetDst = 0, LenSrc = strlenW(pszPath);1432 BOOL bModifyed = FALSE;1433 1434 TRACE("%p %s\n", pszBuf, debugstr_w(pszPath));1435 1436 pszBuf[OffsetDst]='\0';1437 1438 /* keep the root of the path */1439 if( LenSrc && (pszPath[OffsetSrc]=='\\'))1440 {1441 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--;1442 }1443 else if ( (LenSrc >= 2) && (pszPath[OffsetSrc+1] == ':'))1444 {1445 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--;1446 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--;1447 if (LenSrc && (pszPath[OffsetSrc] == '\\'))1448 {1449 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--;1450 if (LenSrc == 1 && pszPath[OffsetSrc]=='.')1451 {1452 /* C:\. */1453 OffsetSrc++; LenSrc--; bModifyed = TRUE;1454 } 1455 else if (LenSrc == 2 && pszPath[OffsetSrc]=='.' && pszPath[OffsetSrc+1]=='.')1456 {1457 /* C:\.. */1458 OffsetSrc+=2; LenSrc-=2; bModifyed = TRUE;1459 } 1430 int OffsetMin = 0, OffsetSrc = 0, OffsetDst = 0, LenSrc = strlenW(pszPath); 1431 BOOL bModifyed = FALSE; 1432 1433 TRACE("%p %s\n", pszBuf, debugstr_w(pszPath)); 1434 1435 pszBuf[OffsetDst]='\0'; 1436 1437 /* keep the root of the path */ 1438 if( LenSrc && (pszPath[OffsetSrc]=='\\')) 1439 { 1440 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--; 1441 } 1442 else if ( (LenSrc >= 2) && (pszPath[OffsetSrc+1] == ':')) 1443 { 1444 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--; 1445 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--; 1446 if (LenSrc && (pszPath[OffsetSrc] == '\\')) 1447 { 1448 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--; 1449 if (LenSrc == 1 && pszPath[OffsetSrc]=='.') 1450 { 1451 /* C:\. */ 1452 OffsetSrc++; LenSrc--; bModifyed = TRUE; 1453 } 1454 else if (LenSrc == 2 && pszPath[OffsetSrc]=='.' && pszPath[OffsetSrc+1]=='.') 1455 { 1456 /* C:\.. */ 1457 OffsetSrc+=2; LenSrc-=2; bModifyed = TRUE; 1458 } 1460 1459 } 1461 }1462 1463 /* ".\" at the beginning of the path */1464 if (LenSrc >= 2 && pszPath[OffsetSrc]=='.' && pszPath[OffsetSrc+1]=='\\')1465 {1466 OffsetSrc+=2; LenSrc-=2; bModifyed = TRUE;1467 } 1468 1469 while ( LenSrc )1470 {1471 if((LenSrc>=3) && (pszPath[OffsetSrc]=='\\') && (pszPath[OffsetSrc+1]=='.') && (pszPath[OffsetSrc+2]=='.'))1472 {1473 /* "\.." found, go one deeper */1474 while((OffsetDst > OffsetMin) && (pszBuf[OffsetDst]!='\\')) OffsetDst--;1475 OffsetSrc += 3; LenSrc -= 3; bModifyed = TRUE;1476 if(OffsetDst == OffsetMin && pszPath[OffsetSrc]=='\\') OffsetSrc++;1477 pszBuf[OffsetDst] = '\0';/* important for \..\.. */1478 }1479 else if(LenSrc>=2 && pszPath[OffsetSrc]=='\\' && pszPath[OffsetSrc+1]=='.' )1480 {1481 /* "\." found, skip it */1482 OffsetSrc += 2; LenSrc-=2; bModifyed = TRUE;1483 }1484 else1485 {1486 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; LenSrc--;1487 }1488 }1489 pszBuf[OffsetDst] = '\0';1490 TRACE("-- %s %u\n", debugstr_w(pszBuf), bModifyed);1491 return bModifyed;1460 } 1461 1462 /* ".\" at the beginning of the path */ 1463 if (LenSrc >= 2 && pszPath[OffsetSrc]=='.' && pszPath[OffsetSrc+1]=='\\') 1464 { 1465 OffsetSrc+=2; LenSrc-=2; bModifyed = TRUE; 1466 } 1467 1468 while ( LenSrc ) 1469 { 1470 if((LenSrc>=3) && (pszPath[OffsetSrc]=='\\') && (pszPath[OffsetSrc+1]=='.') && (pszPath[OffsetSrc+2]=='.')) 1471 { 1472 /* "\.." found, go one deeper */ 1473 while((OffsetDst > OffsetMin) && (pszBuf[OffsetDst]!='\\')) OffsetDst--; 1474 OffsetSrc += 3; LenSrc -= 3; bModifyed = TRUE; 1475 if(OffsetDst == OffsetMin && pszPath[OffsetSrc]=='\\') OffsetSrc++; 1476 pszBuf[OffsetDst] = '\0'; /* important for \..\.. */ 1477 } 1478 else if(LenSrc>=2 && pszPath[OffsetSrc]=='\\' && pszPath[OffsetSrc+1]=='.' ) 1479 { 1480 /* "\." found, skip it */ 1481 OffsetSrc += 2; LenSrc-=2; bModifyed = TRUE; 1482 } 1483 else 1484 { 1485 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; LenSrc--; 1486 } 1487 } 1488 pszBuf[OffsetDst] = '\0'; 1489 TRACE("-- %s %u\n", debugstr_w(pszBuf), bModifyed); 1490 return bModifyed; 1492 1491 } 1493 1492 … … 1497 1496 * NOTES 1498 1497 * special cases: 1499 * "" null1500 * aa "" (pointer to traling NULL)1501 * aa\ "" (pointer to traling NULL)1502 * aa\\ "" (pointer to traling NULL)1503 * aa\\bb bb1504 * aa\\\bb \bb1505 * c:\aa\ "aa\"1506 * \\aa aa1507 * \\aa\b aa\b1498 * "" null 1499 * aa "" (pointer to traling NULL) 1500 * aa\ "" (pointer to traling NULL) 1501 * aa\\ "" (pointer to traling NULL) 1502 * aa\\bb bb 1503 * aa\\\bb \bb 1504 * c:\aa\ "aa\" 1505 * \\aa aa 1506 * \\aa\b aa\b 1508 1507 */ 1509 1508 LPSTR WINAPI PathFindNextComponentA(LPCSTR pszPath) 1510 1509 { 1511 LPSTR pos;1512 1513 TRACE("%s\n", pszPath);1514 1515 if(!pszPath || !*pszPath) return NULL;1516 if(!(pos = StrChrA(pszPath, '\\')))1517 return (LPSTR) pszPath + strlen(pszPath);1518 pos++;1519 if(pos[0] == '\\') pos++;1520 return pos;1510 LPSTR pos; 1511 1512 TRACE("%s\n", pszPath); 1513 1514 if(!pszPath || !*pszPath) return NULL; 1515 if(!(pos = StrChrA(pszPath, '\\'))) 1516 return (LPSTR) pszPath + strlen(pszPath); 1517 pos++; 1518 if(pos[0] == '\\') pos++; 1519 return pos; 1521 1520 } 1522 1521 … … 1526 1525 LPWSTR WINAPI PathFindNextComponentW(LPCWSTR pszPath) 1527 1526 { 1528 LPWSTR pos;1529 1530 TRACE("%s\n", debugstr_w(pszPath));1531 1532 if(!pszPath || !*pszPath) return NULL;1533 if (!(pos = StrChrW(pszPath, '\\')))1534 return (LPWSTR) pszPath + strlenW(pszPath);1535 pos++;1536 if(pos[0] == '\\') pos++;1537 return pos;1527 LPWSTR pos; 1528 1529 TRACE("%s\n", debugstr_w(pszPath)); 1530 1531 if(!pszPath || !*pszPath) return NULL; 1532 if (!(pos = StrChrW(pszPath, '\\'))) 1533 return (LPWSTR) pszPath + strlenW(pszPath); 1534 pos++; 1535 if(pos[0] == '\\') pos++; 1536 return pos; 1538 1537 } 1539 1538 … … 1544 1543 * it adds never a dot 1545 1544 */ 1546 1545 1547 1546 BOOL WINAPI PathAddExtensionA( 1548 LPSTR pszPath,1549 LPCSTR pszExtension)1550 { 1551 if (*pszPath)1552 {1553 if (*(PathFindExtensionA(pszPath))) return FALSE;1554 1555 if (!pszExtension || *pszExtension=='\0')1556 strcat(pszPath, "exe");1557 else1558 strcat(pszPath, pszExtension);1559 }1560 1561 return TRUE;1562 } 1563 1564 /************************************************************************* 1565 * PathAddExtensionW [SHLWAPI.@]1547 LPSTR pszPath, 1548 LPCSTR pszExtension) 1549 { 1550 if (*pszPath) 1551 { 1552 if (*(PathFindExtensionA(pszPath))) return FALSE; 1553 1554 if (!pszExtension || *pszExtension=='\0') 1555 strcat(pszPath, "exe"); 1556 else 1557 strcat(pszPath, pszExtension); 1558 } 1559 1560 return TRUE; 1561 } 1562 1563 /************************************************************************* 1564 * PathAddExtensionW [SHLWAPI.@] 1566 1565 */ 1567 1566 BOOL WINAPI PathAddExtensionW( 1568 LPWSTR pszPath,1569 LPCWSTR pszExtension)1570 { 1571 static const WCHAR ext[] = { 'e','x','e',0 };1572 1573 if (*pszPath)1574 {1575 if (*(PathFindExtensionW(pszPath))) return FALSE;1576 1577 if (!pszExtension || *pszExtension=='\0')1578 strcatW(pszPath, ext);1579 else1580 strcatW(pszPath, pszExtension);1581 }1582 return TRUE;1583 1584 } 1585 1586 /************************************************************************* 1587 * PathMakePrettyA [SHLWAPI.@]1567 LPWSTR pszPath, 1568 LPCWSTR pszExtension) 1569 { 1570 static const WCHAR ext[] = { 'e','x','e',0 }; 1571 1572 if (*pszPath) 1573 { 1574 if (*(PathFindExtensionW(pszPath))) return FALSE; 1575 1576 if (!pszExtension || *pszExtension=='\0') 1577 strcatW(pszPath, ext); 1578 else 1579 strcatW(pszPath, pszExtension); 1580 } 1581 return TRUE; 1582 1583 } 1584 1585 /************************************************************************* 1586 * PathMakePrettyA [SHLWAPI.@] 1588 1587 */ 1589 1588 BOOL WINAPI PathMakePrettyA( 1590 LPSTR lpPath)1591 { 1592 FIXME("%s\n", lpPath);1593 return TRUE;1594 } 1595 1596 /************************************************************************* 1597 * PathMakePrettyW [SHLWAPI.@]1589 LPSTR lpPath) 1590 { 1591 FIXME("%s\n", lpPath); 1592 return TRUE; 1593 } 1594 1595 /************************************************************************* 1596 * PathMakePrettyW [SHLWAPI.@] 1598 1597 */ 1599 1598 BOOL WINAPI PathMakePrettyW( 1600 LPWSTR lpPath)1601 { 1602 FIXME("%s\n", debugstr_w(lpPath));1603 return TRUE;1604 1605 } 1606 1607 /************************************************************************* 1608 * PathCommonPrefixA [SHLWAPI.@]1599 LPWSTR lpPath) 1600 { 1601 FIXME("%s\n", debugstr_w(lpPath)); 1602 return TRUE; 1603 1604 } 1605 1606 /************************************************************************* 1607 * PathCommonPrefixA [SHLWAPI.@] 1609 1608 */ 1610 1609 int WINAPI PathCommonPrefixA( 1611 LPCSTR pszFile1,1612 LPCSTR pszFile2,1613 LPSTR achPath)1614 { 1615 FIXME("%s %s %p\n", pszFile1, pszFile2, achPath);1616 return 0;1617 } 1618 1619 /************************************************************************* 1620 * PathCommonPrefixW [SHLWAPI.@]1610 LPCSTR pszFile1, 1611 LPCSTR pszFile2, 1612 LPSTR achPath) 1613 { 1614 FIXME("%s %s %p\n", pszFile1, pszFile2, achPath); 1615 return 0; 1616 } 1617 1618 /************************************************************************* 1619 * PathCommonPrefixW [SHLWAPI.@] 1621 1620 */ 1622 1621 int WINAPI PathCommonPrefixW( 1623 LPCWSTR pszFile1,1624 LPCWSTR pszFile2,1625 LPWSTR achPath)1626 { 1627 FIXME("%s %s %p\n", debugstr_w(pszFile1), debugstr_w(pszFile2),achPath );1628 return 0;1629 } 1630 1631 /************************************************************************* 1632 * PathCompactPathA [SHLWAPI.@]1622 LPCWSTR pszFile1, 1623 LPCWSTR pszFile2, 1624 LPWSTR achPath) 1625 { 1626 FIXME("%s %s %p\n", debugstr_w(pszFile1), debugstr_w(pszFile2),achPath ); 1627 return 0; 1628 } 1629 1630 /************************************************************************* 1631 * PathCompactPathA [SHLWAPI.@] 1633 1632 */ 1634 1633 BOOL WINAPI PathCompactPathA(HDC hDC, LPSTR pszPath, UINT dx) 1635 1634 { 1636 FIXME("0x%08x %s 0x%08x\n", hDC, pszPath, dx);1637 return FALSE;1638 } 1639 1640 /************************************************************************* 1641 * PathCompactPathW [SHLWAPI.@]1635 FIXME("0x%08x %s 0x%08x\n", hDC, pszPath, dx); 1636 return FALSE; 1637 } 1638 1639 /************************************************************************* 1640 * PathCompactPathW [SHLWAPI.@] 1642 1641 */ 1643 1642 BOOL WINAPI PathCompactPathW(HDC hDC, LPWSTR pszPath, UINT dx) 1644 1643 { 1645 FIXME("0x%08x %s 0x%08x\n", hDC, debugstr_w(pszPath), dx);1646 return FALSE;1647 } 1648 1649 /************************************************************************* 1650 * PathGetCharTypeA [SHLWAPI.@]1644 FIXME("0x%08x %s 0x%08x\n", hDC, debugstr_w(pszPath), dx); 1645 return FALSE; 1646 } 1647 1648 /************************************************************************* 1649 * PathGetCharTypeA [SHLWAPI.@] 1651 1650 */ 1652 1651 UINT WINAPI PathGetCharTypeA(UCHAR ch) … … 1654 1653 UINT flags = 0; 1655 1654 1656 TRACE("%c\n", ch);1657 1658 /* We could use them in filenames, but this would confuse 'ls' */1659 if (iscntrl(ch))1660 return GCT_INVALID;1661 if ((ch == '*') || (ch=='?'))1662 return GCT_WILD;1663 if ((ch == '\\') || (ch=='/'))1664 return GCT_SEPARATOR;1665 flags = 0;1666 /* all normal characters, no lower case letters */1667 if ((ch > ' ') && (ch < 0x7f) && !islower(ch))1668 flags |= GCT_SHORTCHAR;1669 /* All other characters are valid in long filenames, even umlauts */1670 return flags | GCT_LFNCHAR;1671 } 1672 1673 /************************************************************************* 1674 * PathGetCharTypeW [SHLWAPI.@]1655 TRACE("%c\n", ch); 1656 1657 /* We could use them in filenames, but this would confuse 'ls' */ 1658 if (iscntrl(ch)) 1659 return GCT_INVALID; 1660 if ((ch == '*') || (ch=='?')) 1661 return GCT_WILD; 1662 if ((ch == '\\') || (ch=='/')) 1663 return GCT_SEPARATOR; 1664 flags = 0; 1665 /* all normal characters, no lower case letters */ 1666 if ((ch > ' ') && (ch < 0x7f) && !islower(ch)) 1667 flags |= GCT_SHORTCHAR; 1668 /* All other characters are valid in long filenames, even umlauts */ 1669 return flags | GCT_LFNCHAR; 1670 } 1671 1672 /************************************************************************* 1673 * PathGetCharTypeW [SHLWAPI.@] 1675 1674 */ 1676 1675 UINT WINAPI PathGetCharTypeW(WCHAR ch) 1677 1676 { 1678 FIXME("%c, using ascii version\n", ch);1679 return PathGetCharTypeA(ch);1680 } 1681 1682 /************************************************************************* 1683 * PathMakeSystemFolderA [SHLWAPI.@]1677 FIXME("%c, using ascii version\n", ch); 1678 return PathGetCharTypeA(ch); 1679 } 1680 1681 /************************************************************************* 1682 * PathMakeSystemFolderA [SHLWAPI.@] 1684 1683 */ 1685 1684 BOOL WINAPI PathMakeSystemFolderA(LPCSTR pszPath) 1686 1685 { 1687 FIXME("%s\n", pszPath);1688 return FALSE;1689 } 1690 1691 /************************************************************************* 1692 * PathMakeSystemFolderW [SHLWAPI.@]1686 FIXME("%s\n", pszPath); 1687 return FALSE; 1688 } 1689 1690 /************************************************************************* 1691 * PathMakeSystemFolderW [SHLWAPI.@] 1693 1692 */ 1694 1693 BOOL WINAPI PathMakeSystemFolderW(LPCWSTR pszPath) 1695 1694 { 1696 FIXME("%s\n", debugstr_w(pszPath));1697 return FALSE;1698 } 1699 1700 /************************************************************************* 1701 * PathRenameExtensionA [SHLWAPI.@]1695 FIXME("%s\n", debugstr_w(pszPath)); 1696 return FALSE; 1697 } 1698 1699 /************************************************************************* 1700 * PathRenameExtensionA [SHLWAPI.@] 1702 1701 */ 1703 1702 BOOL WINAPI PathRenameExtensionA(LPSTR pszPath, LPCSTR pszExt) 1704 1703 { 1705 FIXME("%s %s\n", pszPath, pszExt);1706 return FALSE;1707 } 1708 1709 /************************************************************************* 1710 * PathRenameExtensionW [SHLWAPI.@]1704 FIXME("%s %s\n", pszPath, pszExt); 1705 return FALSE; 1706 } 1707 1708 /************************************************************************* 1709 * PathRenameExtensionW [SHLWAPI.@] 1711 1710 */ 1712 1711 BOOL WINAPI PathRenameExtensionW(LPWSTR pszPath, LPCWSTR pszExt) 1713 1712 { 1714 FIXME("%s %s\n", debugstr_w(pszPath), debugstr_w(pszExt));1715 return FALSE;1716 } 1717 1718 /************************************************************************* 1719 * PathSearchAndQualifyA [SHLWAPI.@]1713 FIXME("%s %s\n", debugstr_w(pszPath), debugstr_w(pszExt)); 1714 return FALSE; 1715 } 1716 1717 /************************************************************************* 1718 * PathSearchAndQualifyA [SHLWAPI.@] 1720 1719 */ 1721 1720 BOOL WINAPI PathSearchAndQualifyA( 1722 LPCSTR pszPath,1723 LPSTR pszBuf,1724 UINT cchBuf)1725 { 1726 FIXME("%s %s 0x%08x\n", pszPath, pszBuf, cchBuf);1727 return FALSE;1728 } 1729 1730 /************************************************************************* 1731 * PathSearchAndQualifyW [SHLWAPI.@]1721 LPCSTR pszPath, 1722 LPSTR pszBuf, 1723 UINT cchBuf) 1724 { 1725 FIXME("%s %s 0x%08x\n", pszPath, pszBuf, cchBuf); 1726 return FALSE; 1727 } 1728 1729 /************************************************************************* 1730 * PathSearchAndQualifyW [SHLWAPI.@] 1732 1731 */ 1733 1732 BOOL WINAPI PathSearchAndQualifyW( 1734 LPCWSTR pszPath,1735 LPWSTR pszBuf,1736 UINT cchBuf)1737 { 1738 FIXME("%s %s 0x%08x\n", debugstr_w(pszPath), debugstr_w(pszBuf), cchBuf);1739 return FALSE;1733 LPCWSTR pszPath, 1734 LPWSTR pszBuf, 1735 UINT cchBuf) 1736 { 1737 FIXME("%s %s 0x%08x\n", debugstr_w(pszPath), debugstr_w(pszBuf), cchBuf); 1738 return FALSE; 1740 1739 } 1741 1740 1742 1741 #ifndef __WIN32OS2__ 1743 1742 /************************************************************************* 1744 * PathSkipRootA [SHLWAPI.@]1743 * PathSkipRootA [SHLWAPI.@] 1745 1744 */ 1746 1745 LPSTR WINAPI PathSkipRootA(LPCSTR pszPath) 1747 1746 { 1748 FIXME("%s\n", pszPath);1749 return (LPSTR)pszPath;1750 } 1751 1752 /************************************************************************* 1753 * PathSkipRootW [SHLWAPI.@]1747 FIXME("%s\n", pszPath); 1748 return (LPSTR)pszPath; 1749 } 1750 1751 /************************************************************************* 1752 * PathSkipRootW [SHLWAPI.@] 1754 1753 */ 1755 1754 LPWSTR WINAPI PathSkipRootW(LPCWSTR pszPath) 1756 1755 { 1757 FIXME("%s\n", debugstr_w(pszPath));1758 return (LPWSTR)pszPath;1756 FIXME("%s\n", debugstr_w(pszPath)); 1757 return (LPWSTR)pszPath; 1759 1758 } 1760 1759 #endif 1761 1760 1762 1761 /************************************************************************* 1763 * PathCreateFromUrlA [SHLWAPI.@]1762 * PathCreateFromUrlA [SHLWAPI.@] 1764 1763 */ 1765 1764 HRESULT WINAPI PathCreateFromUrlA( 1766 LPCSTR pszUrl,1767 LPSTR pszPath,1768 LPDWORD pcchPath,1769 DWORD dwFlags)1770 { 1771 FIXME("%s %p %p 0x%08lx\n",1772 pszUrl, pszPath, pcchPath, dwFlags);1773 return S_OK;1774 } 1775 1776 /************************************************************************* 1777 * PathCreateFromUrlW [SHLWAPI.@]1765 LPCSTR pszUrl, 1766 LPSTR pszPath, 1767 LPDWORD pcchPath, 1768 DWORD dwFlags) 1769 { 1770 FIXME("%s %p %p 0x%08lx\n", 1771 pszUrl, pszPath, pcchPath, dwFlags); 1772 return S_OK; 1773 } 1774 1775 /************************************************************************* 1776 * PathCreateFromUrlW [SHLWAPI.@] 1778 1777 */ 1779 1778 HRESULT WINAPI PathCreateFromUrlW( 1780 LPCWSTR pszUrl,1781 LPWSTR pszPath,1782 LPDWORD pcchPath,1783 DWORD dwFlags)1784 { 1785 FIXME("%s %p %p 0x%08lx\n",1786 debugstr_w(pszUrl), pszPath, pcchPath, dwFlags);1787 return S_OK;1788 } 1789 1790 /************************************************************************* 1791 * PathRelativePathToA [SHLWAPI.@]1779 LPCWSTR pszUrl, 1780 LPWSTR pszPath, 1781 LPDWORD pcchPath, 1782 DWORD dwFlags) 1783 { 1784 FIXME("%s %p %p 0x%08lx\n", 1785 debugstr_w(pszUrl), pszPath, pcchPath, dwFlags); 1786 return S_OK; 1787 } 1788 1789 /************************************************************************* 1790 * PathRelativePathToA [SHLWAPI.@] 1792 1791 */ 1793 1792 BOOL WINAPI PathRelativePathToA( 1794 LPSTR pszPath,1795 LPCSTR pszFrom,1796 DWORD dwAttrFrom,1797 LPCSTR pszTo,1798 DWORD dwAttrTo)1799 { 1800 FIXME("%s %s 0x%08lx %s 0x%08lx\n",1801 pszPath, pszFrom, dwAttrFrom, pszTo, dwAttrTo);1802 return FALSE;1803 } 1804 1805 /************************************************************************* 1806 * PathRelativePathToW [SHLWAPI.@]1793 LPSTR pszPath, 1794 LPCSTR pszFrom, 1795 DWORD dwAttrFrom, 1796 LPCSTR pszTo, 1797 DWORD dwAttrTo) 1798 { 1799 FIXME("%s %s 0x%08lx %s 0x%08lx\n", 1800 pszPath, pszFrom, dwAttrFrom, pszTo, dwAttrTo); 1801 return FALSE; 1802 } 1803 1804 /************************************************************************* 1805 * PathRelativePathToW [SHLWAPI.@] 1807 1806 */ 1808 1807 BOOL WINAPI PathRelativePathToW( 1809 LPWSTR pszPath,1810 LPCWSTR pszFrom,1811 DWORD dwAttrFrom,1812 LPCWSTR pszTo,1813 DWORD dwAttrTo)1814 { 1815 FIXME("%s %s 0x%08lx %s 0x%08lx\n",1816 debugstr_w(pszPath), debugstr_w(pszFrom), dwAttrFrom, debugstr_w(pszTo), dwAttrTo);1817 return FALSE;1818 } 1819 1820 /************************************************************************* 1821 * PathUnmakeSystemFolderA [SHLWAPI.@]1808 LPWSTR pszPath, 1809 LPCWSTR pszFrom, 1810 DWORD dwAttrFrom, 1811 LPCWSTR pszTo, 1812 DWORD dwAttrTo) 1813 { 1814 FIXME("%s %s 0x%08lx %s 0x%08lx\n", 1815 debugstr_w(pszPath), debugstr_w(pszFrom), dwAttrFrom, debugstr_w(pszTo), dwAttrTo); 1816 return FALSE; 1817 } 1818 1819 /************************************************************************* 1820 * PathUnmakeSystemFolderA [SHLWAPI.@] 1822 1821 */ 1823 1822 BOOL WINAPI PathUnmakeSystemFolderA(LPCSTR pszPath) 1824 1823 { 1825 FIXME("%s\n", pszPath);1826 return FALSE;1827 } 1828 1829 /************************************************************************* 1830 * PathUnmakeSystemFolderW [SHLWAPI.@]1824 FIXME("%s\n", pszPath); 1825 return FALSE; 1826 } 1827 1828 /************************************************************************* 1829 * PathUnmakeSystemFolderW [SHLWAPI.@] 1831 1830 */ 1832 1831 BOOL WINAPI PathUnmakeSystemFolderW(LPCWSTR pszPath) 1833 1832 { 1834 FIXME("%s\n", debugstr_w(pszPath));1835 return FALSE;1833 FIXME("%s\n", debugstr_w(pszPath)); 1834 return FALSE; 1836 1835 } 1837 1836 1838 1837 /* 1839 ########## special ##########1838 ########## special ########## 1840 1839 */ 1841 1840 … … 1846 1845 * use PathCompactPath to make sure, the path fits into the control 1847 1846 */ 1848 BOOL WINAPI PathSetDlgItemPathA(HWND hDlg, int id, LPCSTR pszPath) 1849 { TRACE("%x %x %s\n",hDlg, id, pszPath);1850 return SetDlgItemTextA(hDlg, id, pszPath);1847 BOOL WINAPI PathSetDlgItemPathA(HWND hDlg, int id, LPCSTR pszPath) 1848 { TRACE("%x %x %s\n",hDlg, id, pszPath); 1849 return SetDlgItemTextA(hDlg, id, pszPath); 1851 1850 } 1852 1851 … … 1854 1853 * PathSetDlgItemPathW [SHLWAPI.@] 1855 1854 */ 1856 BOOL WINAPI PathSetDlgItemPathW(HWND hDlg, int id, LPCWSTR pszPath) 1857 { TRACE("%x %x %s\n",hDlg, id, debugstr_w(pszPath));1858 return SetDlgItemTextW(hDlg, id, pszPath);1859 } 1855 BOOL WINAPI PathSetDlgItemPathW(HWND hDlg, int id, LPCWSTR pszPath) 1856 { TRACE("%x %x %s\n",hDlg, id, debugstr_w(pszPath)); 1857 return SetDlgItemTextW(hDlg, id, pszPath); 1858 } -
trunk/src/shlwapi/reg.c
r6650 r6712 1 /* $Id: reg.c,v 1.5 2001-09-05 13:48:38 bird Exp $ */2 1 /* 3 2 * SHLWAPI registry functions … … 33 32 34 33 /************************************************************************* 35 * SHRegGetUSValueA [SHLWAPI.@]34 * SHRegGetUSValueA [SHLWAPI.@] 36 35 * 37 36 * Gets a user-specific registry value 38 37 */ 39 38 LONG WINAPI SHRegGetUSValueA( 40 LPCSTR pSubKey,41 LPCSTR pValue,42 LPDWORD pwType,43 LPVOID pvData,44 LPDWORD pbData,45 BOOL fIgnoreHKCU,46 LPVOID pDefaultData,47 DWORD wDefaultDataSize)48 { 49 FIXME("(%p),stub!\n", pSubKey);50 return ERROR_SUCCESS; /* return success */51 } 52 53 /************************************************************************* 54 * SHRegGetUSValueW [SHLWAPI.@]39 LPCSTR pSubKey, 40 LPCSTR pValue, 41 LPDWORD pwType, 42 LPVOID pvData, 43 LPDWORD pbData, 44 BOOL fIgnoreHKCU, 45 LPVOID pDefaultData, 46 DWORD wDefaultDataSize) 47 { 48 FIXME("(%p),stub!\n", pSubKey); 49 return ERROR_SUCCESS; /* return success */ 50 } 51 52 /************************************************************************* 53 * SHRegGetUSValueW [SHLWAPI.@] 55 54 * 56 55 * Gets a user-specific registry value 57 56 */ 58 57 LONG WINAPI SHRegGetUSValueW( 59 LPCWSTR pSubKey,60 LPCWSTR pValue,61 LPDWORD pwType,62 LPVOID pvData,63 LPDWORD pbData,64 BOOL flagIgnoreHKCU,65 LPVOID pDefaultData,66 DWORD wDefaultDataSize)67 { 68 FIXME("(%p),stub!\n", pSubKey);69 return ERROR_SUCCESS; /* return success */70 } 71 72 /************************************************************************* 73 * SHRegOpenUSKeyA [SHLWAPI.@]58 LPCWSTR pSubKey, 59 LPCWSTR pValue, 60 LPDWORD pwType, 61 LPVOID pvData, 62 LPDWORD pbData, 63 BOOL flagIgnoreHKCU, 64 LPVOID pDefaultData, 65 DWORD wDefaultDataSize) 66 { 67 FIXME("(%p),stub!\n", pSubKey); 68 return ERROR_SUCCESS; /* return success */ 69 } 70 71 /************************************************************************* 72 * SHRegOpenUSKeyA [SHLWAPI.@] 74 73 * 75 74 * Openss a user-specific registry key … … 82 81 BOOL fIgnoreHKCU) 83 82 { 84 FIXME("stub!\n");85 return ERROR_SUCCESS; /* return success */86 } 87 88 /************************************************************************* 89 * SHRegOpenUSKeyW [SHLWAPI.@]83 FIXME("stub!\n"); 84 return ERROR_SUCCESS; /* return success */ 85 } 86 87 /************************************************************************* 88 * SHRegOpenUSKeyW [SHLWAPI.@] 90 89 * 91 90 * Openss a user-specific registry key … … 98 97 BOOL fIgnoreHKCU) 99 98 { 100 FIXME("stub!\n");101 return ERROR_SUCCESS; /* return success */99 FIXME("stub!\n"); 100 return ERROR_SUCCESS; /* return success */ 102 101 } 103 102 … … 107 106 */ 108 107 BOOL WINAPI SHRegGetBoolUSValueA( 109 LPCSTR pszSubKey,110 LPCSTR pszValue,111 BOOL fIgnoreHKCU,112 BOOL fDefault)113 { 114 FIXME("%s %s\n", pszSubKey,pszValue);115 return fDefault;116 } 117 118 /************************************************************************* 119 * SHRegGetBoolUSValueW [SHLWAPI.@]108 LPCSTR pszSubKey, 109 LPCSTR pszValue, 110 BOOL fIgnoreHKCU, 111 BOOL fDefault) 112 { 113 FIXME("%s %s\n", pszSubKey,pszValue); 114 return fDefault; 115 } 116 117 /************************************************************************* 118 * SHRegGetBoolUSValueW [SHLWAPI.@] 120 119 */ 121 120 BOOL WINAPI SHRegGetBoolUSValueW( 122 LPCWSTR pszSubKey,123 LPCWSTR pszValue,124 BOOL fIgnoreHKCU,125 BOOL fDefault)126 { 127 FIXME("%s %s\n", debugstr_w(pszSubKey),debugstr_w(pszValue));128 return fDefault;121 LPCWSTR pszSubKey, 122 LPCWSTR pszValue, 123 BOOL fIgnoreHKCU, 124 BOOL fDefault) 125 { 126 FIXME("%s %s\n", debugstr_w(pszSubKey),debugstr_w(pszValue)); 127 return fDefault; 129 128 } 130 129 #endif 131 130 132 131 /************************************************************************* 133 * SHRegQueryUSValueA [SHLWAPI]132 * SHRegQueryUSValueA [SHLWAPI] 134 133 */ 135 134 LONG WINAPI SHRegQueryUSValueA( 136 HUSKEY hUSKey, /* [in] FIXME: HUSKEY */137 LPCSTR pszValue,138 LPDWORD pdwType,139 LPVOID pvData,140 LPDWORD pcbData,141 BOOL fIgnoreHKCU,142 LPVOID pvDefaultData,143 DWORD dwDefaultDataSize)144 { 145 FIXME("%s stub\n",pszValue);146 return 1;147 } 148 149 /************************************************************************* 150 * SHRegQueryUSValueA [SHLWAPI]135 HUSKEY hUSKey, /* [in] FIXME: HUSKEY */ 136 LPCSTR pszValue, 137 LPDWORD pdwType, 138 LPVOID pvData, 139 LPDWORD pcbData, 140 BOOL fIgnoreHKCU, 141 LPVOID pvDefaultData, 142 DWORD dwDefaultDataSize) 143 { 144 FIXME("%s stub\n",pszValue); 145 return 1; 146 } 147 148 /************************************************************************* 149 * SHRegQueryUSValueA [SHLWAPI] 151 150 */ 152 151 LONG WINAPI SHRegQueryUSValueW( 153 HUSKEY hUSKey, /* [in] FIXME: HUSKEY */154 LPCSTR pszValue,155 LPDWORD pdwType,156 void *pvData,157 LPDWORD pcbData,158 BOOL fIgnoreHKCU,159 void *pvDefaultData,160 DWORD dwDefaultDataSize)161 { 162 FIXME("%s stub\n",pszValue);163 return 1;152 HUSKEY hUSKey, /* [in] FIXME: HUSKEY */ 153 LPCSTR pszValue, 154 LPDWORD pdwType, 155 void *pvData, 156 LPDWORD pcbData, 157 BOOL fIgnoreHKCU, 158 void *pvDefaultData, 159 DWORD dwDefaultDataSize) 160 { 161 FIXME("%s stub\n",pszValue); 162 return 1; 164 163 } 165 164 … … 168 167 */ 169 168 DWORD WINAPI SHRegGetPathA( 170 HKEY hKey,171 LPCSTR pcszSubKey,172 LPCSTR pcszValue,173 LPSTR pszPath,174 DWORD dwFlags)175 { 176 FIXME("%s %s\n", pcszSubKey, pcszValue);177 return 0;169 HKEY hKey, 170 LPCSTR pcszSubKey, 171 LPCSTR pcszValue, 172 LPSTR pszPath, 173 DWORD dwFlags) 174 { 175 FIXME("%s %s\n", pcszSubKey, pcszValue); 176 return 0; 178 177 } 179 178 … … 182 181 */ 183 182 DWORD WINAPI SHRegGetPathW( 184 HKEY hKey,185 LPCWSTR pcszSubKey,186 LPCWSTR pcszValue,187 LPWSTR pszPath,188 DWORD dwFlags)189 { 190 FIXME("%s %s\n", debugstr_w(pcszSubKey), debugstr_w(pcszValue));191 return 0;183 HKEY hKey, 184 LPCWSTR pcszSubKey, 185 LPCWSTR pcszValue, 186 LPWSTR pszPath, 187 DWORD dwFlags) 188 { 189 FIXME("%s %s\n", debugstr_w(pcszSubKey), debugstr_w(pcszValue)); 190 return 0; 192 191 } 193 192 … … 198 197 */ 199 198 DWORD WINAPI SHGetValueA( 200 HKEY hkey,201 LPCSTR pSubKey,202 LPCSTR pValue,203 LPDWORD pwType,204 LPVOID pvData,205 LPDWORD pbData)206 { 207 HKEY hSubKey;208 DWORD res;209 210 TRACE("(%s %s)\n", pSubKey, pValue);211 212 if((res = RegOpenKeyA(hkey, pSubKey, &hSubKey))) return res;213 res = RegQueryValueExA(hSubKey, pValue, 0, pwType, pvData, pbData);214 RegCloseKey( hSubKey );215 216 return res;199 HKEY hkey, 200 LPCSTR pSubKey, 201 LPCSTR pValue, 202 LPDWORD pwType, 203 LPVOID pvData, 204 LPDWORD pbData) 205 { 206 HKEY hSubKey; 207 DWORD res; 208 209 TRACE("(%s %s)\n", pSubKey, pValue); 210 211 if((res = RegOpenKeyA(hkey, pSubKey, &hSubKey))) return res; 212 res = RegQueryValueExA(hSubKey, pValue, 0, pwType, pvData, pbData); 213 RegCloseKey( hSubKey ); 214 215 return res; 217 216 } 218 217 … … 223 222 */ 224 223 DWORD WINAPI SHGetValueW( 225 HKEY hkey,226 LPCWSTR pSubKey,227 LPCWSTR pValue,228 LPDWORD pwType,229 LPVOID pvData,230 LPDWORD pbData)231 { 232 HKEY hSubKey;233 DWORD res;234 235 TRACE("(%s %s)\n", debugstr_w(pSubKey), debugstr_w(pValue));236 237 if((res = RegOpenKeyW(hkey, pSubKey, &hSubKey))) return res;238 res = RegQueryValueExW(hSubKey, pValue, 0, pwType, pvData, pbData);239 RegCloseKey( hSubKey );240 241 return res;224 HKEY hkey, 225 LPCWSTR pSubKey, 226 LPCWSTR pValue, 227 LPDWORD pwType, 228 LPVOID pvData, 229 LPDWORD pbData) 230 { 231 HKEY hSubKey; 232 DWORD res; 233 234 TRACE("(%s %s)\n", debugstr_w(pSubKey), debugstr_w(pValue)); 235 236 if((res = RegOpenKeyW(hkey, pSubKey, &hSubKey))) return res; 237 res = RegQueryValueExW(hSubKey, pValue, 0, pwType, pvData, pbData); 238 RegCloseKey( hSubKey ); 239 240 return res; 242 241 } 243 242 … … 246 245 */ 247 246 HRESULT WINAPI SHSetValueA( 248 HKEY hkey,249 LPCSTR pszSubKey,250 LPCSTR pszValue,251 DWORD dwType,252 LPCVOID pvData,253 DWORD cbData)254 { 255 HKEY subkey;256 HRESULT hres;247 HKEY hkey, 248 LPCSTR pszSubKey, 249 LPCSTR pszValue, 250 DWORD dwType, 251 LPCVOID pvData, 252 DWORD cbData) 253 { 254 HKEY subkey; 255 HRESULT hres; 257 256 258 257 hres = RegCreateKeyA(hkey,pszSubKey,&subkey); 259 258 if (!hres) 260 return hres;259 return hres; 261 260 hres = RegSetValueExA(subkey,pszValue,0,dwType,pvData,cbData); 262 261 RegCloseKey(subkey); … … 268 267 */ 269 268 HRESULT WINAPI SHSetValueW( 270 HKEY hkey,271 LPCWSTR pszSubKey,272 LPCWSTR pszValue,273 DWORD dwType,274 LPCVOID pvData,275 DWORD cbData)276 { 277 HKEY subkey;278 HRESULT hres;269 HKEY hkey, 270 LPCWSTR pszSubKey, 271 LPCWSTR pszValue, 272 DWORD dwType, 273 LPCVOID pvData, 274 DWORD cbData) 275 { 276 HKEY subkey; 277 HRESULT hres; 279 278 280 279 hres = RegCreateKeyW(hkey,pszSubKey,&subkey); 281 280 if (!hres) 282 return hres;281 return hres; 283 282 hres = RegSetValueExW(subkey,pszValue,0,dwType,pvData,cbData); 284 283 RegCloseKey(subkey); … … 287 286 288 287 /************************************************************************* 289 * SHQueryValueExA [SHLWAPI.@]288 * SHQueryValueExA [SHLWAPI.@] 290 289 * 291 290 */ 292 291 HRESULT WINAPI SHQueryValueExA( 293 HKEY hkey,294 LPSTR lpValueName,295 LPDWORD lpReserved,296 LPDWORD lpType,297 LPBYTE lpData,298 LPDWORD lpcbData)299 { 300 TRACE("0x%04x %s %p %p %p %p\n", hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);301 return RegQueryValueExA (hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);292 HKEY hkey, 293 LPSTR lpValueName, 294 LPDWORD lpReserved, 295 LPDWORD lpType, 296 LPBYTE lpData, 297 LPDWORD lpcbData) 298 { 299 TRACE("0x%04x %s %p %p %p %p\n", hkey, lpValueName, lpReserved, lpType, lpData, lpcbData); 300 return RegQueryValueExA (hkey, lpValueName, lpReserved, lpType, lpData, lpcbData); 302 301 } 303 302 … … 306 305 * SHQueryValueExW [SHLWAPI.@] 307 306 * 308 * FIXME 307 * FIXME 309 308 * if the datatype REG_EXPAND_SZ then expand the string and change 310 309 * *pdwType to REG_SZ. 311 310 */ 312 311 HRESULT WINAPI SHQueryValueExW ( 313 HKEY hkey,314 LPWSTR pszValue,315 LPDWORD pdwReserved,316 LPDWORD pdwType,317 LPVOID pvData,318 LPDWORD pcbData)319 { 320 WARN("0x%04x %s %p %p %p %p semi-stub\n",312 HKEY hkey, 313 LPWSTR pszValue, 314 LPDWORD pdwReserved, 315 LPDWORD pdwType, 316 LPVOID pvData, 317 LPDWORD pcbData) 318 { 319 WARN("0x%04x %s %p %p %p %p semi-stub\n", 321 320 hkey, debugstr_w(pszValue), pdwReserved, pdwType, pvData, pcbData); 322 return RegQueryValueExW ( hkey, pszValue, pdwReserved, pdwType, pvData, pcbData);321 return RegQueryValueExW ( hkey, pszValue, pdwReserved, pdwType, pvData, pcbData); 323 322 } 324 323 … … 333 332 */ 334 333 HRESULT WINAPI SHDeleteKeyA( 335 HKEY hKey,336 LPCSTR lpszSubKey)334 HKEY hKey, 335 LPCSTR lpszSubKey) 337 336 { 338 337 DWORD r, dwKeyCount, dwSize, i, dwMaxSubkeyLen; … … 399 398 */ 400 399 HRESULT WINAPI SHDeleteKeyW( 401 HKEY hkey,402 LPCWSTR pszSubKey)403 { 404 FIXME("hkey=0x%08x, %s\n", hkey, debugstr_w(pszSubKey));405 return 0;400 HKEY hkey, 401 LPCWSTR pszSubKey) 402 { 403 FIXME("hkey=0x%08x, %s\n", hkey, debugstr_w(pszSubKey)); 404 return 0; 406 405 } 407 406 … … 412 411 */ 413 412 HRESULT WINAPI SHDeleteValueA(HKEY hkey, LPCSTR pszSubKey, LPCSTR pszValue) { 414 HKEY subkey;415 HRESULT hres;413 HKEY subkey; 414 HRESULT hres; 416 415 417 416 hres = RegOpenKeyA(hkey,pszSubKey,&subkey); 418 417 if (hres) 419 return hres;418 return hres; 420 419 hres = RegDeleteValueA(subkey,pszValue); 421 420 RegCloseKey(subkey); … … 429 428 */ 430 429 HRESULT WINAPI SHDeleteValueW(HKEY hkey, LPCWSTR pszSubKey, LPCWSTR pszValue) { 431 HKEY subkey;432 HRESULT hres;430 HKEY subkey; 431 HRESULT hres; 433 432 434 433 hres = RegOpenKeyW(hkey,pszSubKey,&subkey); 435 434 if (hres) 436 return hres;435 return hres; 437 436 hres = RegDeleteValueW(subkey,pszValue); 438 437 RegCloseKey(subkey); -
trunk/src/shlwapi/regstream.c
r6650 r6712 1 /* $Id: regstream.c,v 1.3 2001-09-05 13:48:38 bird Exp $ */2 1 /* 3 * SHRegOpenStream2 * SHRegOpenStream 4 3 */ 5 4 #ifdef __WIN32OS2__ … … 29 28 DEFAULT_DEBUG_CHANNEL(shell); 30 29 31 typedef struct 32 { ICOM_VFIELD(IStream);33 DWORDref;34 HKEYhKey;35 LPBYTEpbBuffer;36 DWORDdwLength;37 DWORDdwPos;30 typedef struct 31 { ICOM_VFIELD(IStream); 32 DWORD ref; 33 HKEY hKey; 34 LPBYTE pbBuffer; 35 DWORD dwLength; 36 DWORD dwPos; 38 37 } ISHRegStream; 39 38 … … 41 40 42 41 /************************************************************************** 43 * IStream_ConstructorA [internal]42 * IStream_ConstructorA [internal] 44 43 */ 45 44 static IStream *IStream_ConstructorA(HKEY hKey, LPCSTR pszSubKey, LPCSTR pszValue, DWORD grfMode) 46 45 { 47 ISHRegStream*rstr;48 DWORDdwType;49 50 rstr = (ISHRegStream*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(ISHRegStream));51 52 ICOM_VTBL(rstr)=&rstvt;53 rstr->ref = 1;54 55 if (!(RegOpenKeyExA (hKey, pszSubKey, 0, KEY_READ, &(rstr->hKey))))56 {57 if (!(RegQueryValueExA(rstr->hKey, pszValue,0,0,0,&(rstr->dwLength))))58 { 59 /* read the binary data into the buffer */60 if((rstr->pbBuffer = HeapAlloc(GetProcessHeap(),0,rstr->dwLength)))61 {62 if (!(RegQueryValueExA(rstr->hKey, pszValue,0,&dwType,rstr->pbBuffer,&(rstr->dwLength))))63 {64 if (dwType == REG_BINARY )65 {66 TRACE ("%p\n", rstr);67 return (IStream*)rstr;68 }69 }70 HeapFree (GetProcessHeap(),0,rstr->pbBuffer);71 }72 }73 RegCloseKey(rstr->hKey);74 }75 HeapFree (GetProcessHeap(),0,rstr);76 return NULL;77 } 78 79 /************************************************************************** 80 * IStream_ConstructorW [internal]46 ISHRegStream* rstr; 47 DWORD dwType; 48 49 rstr = (ISHRegStream*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(ISHRegStream)); 50 51 ICOM_VTBL(rstr)=&rstvt; 52 rstr->ref = 1; 53 54 if (!(RegOpenKeyExA (hKey, pszSubKey, 0, KEY_READ, &(rstr->hKey)))) 55 { 56 if (!(RegQueryValueExA(rstr->hKey, pszValue,0,0,0,&(rstr->dwLength)))) 57 { 58 /* read the binary data into the buffer */ 59 if((rstr->pbBuffer = HeapAlloc(GetProcessHeap(),0,rstr->dwLength))) 60 { 61 if (!(RegQueryValueExA(rstr->hKey, pszValue,0,&dwType,rstr->pbBuffer,&(rstr->dwLength)))) 62 { 63 if (dwType == REG_BINARY ) 64 { 65 TRACE ("%p\n", rstr); 66 return (IStream*)rstr; 67 } 68 } 69 HeapFree (GetProcessHeap(),0,rstr->pbBuffer); 70 } 71 } 72 RegCloseKey(rstr->hKey); 73 } 74 HeapFree (GetProcessHeap(),0,rstr); 75 return NULL; 76 } 77 78 /************************************************************************** 79 * IStream_ConstructorW [internal] 81 80 */ 82 81 static IStream *IStream_ConstructorW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD grfMode) 83 82 { 84 ISHRegStream*rstr;85 DWORDdwType;86 87 rstr = (ISHRegStream*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(ISHRegStream));88 89 ICOM_VTBL(rstr)=&rstvt;90 rstr->ref = 1;91 92 if (!(RegOpenKeyExW (hKey, pszSubKey, 0, KEY_READ, &(rstr->hKey))))93 {94 if (!(RegQueryValueExW(rstr->hKey, pszValue,0,0,0,&(rstr->dwLength))))95 { 96 /* read the binary data into the buffer */97 if((rstr->pbBuffer = HeapAlloc(GetProcessHeap(),0,rstr->dwLength)))98 {99 if (!(RegQueryValueExW(rstr->hKey, pszValue,0,&dwType,rstr->pbBuffer,&(rstr->dwLength))))100 {101 if (dwType == REG_BINARY )102 {103 TRACE ("%p\n", rstr);104 return (IStream*)rstr;105 }106 }107 HeapFree (GetProcessHeap(),0,rstr->pbBuffer);108 }109 }110 RegCloseKey(rstr->hKey);111 }112 HeapFree (GetProcessHeap(),0,rstr);113 return NULL;83 ISHRegStream* rstr; 84 DWORD dwType; 85 86 rstr = (ISHRegStream*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(ISHRegStream)); 87 88 ICOM_VTBL(rstr)=&rstvt; 89 rstr->ref = 1; 90 91 if (!(RegOpenKeyExW (hKey, pszSubKey, 0, KEY_READ, &(rstr->hKey)))) 92 { 93 if (!(RegQueryValueExW(rstr->hKey, pszValue,0,0,0,&(rstr->dwLength)))) 94 { 95 /* read the binary data into the buffer */ 96 if((rstr->pbBuffer = HeapAlloc(GetProcessHeap(),0,rstr->dwLength))) 97 { 98 if (!(RegQueryValueExW(rstr->hKey, pszValue,0,&dwType,rstr->pbBuffer,&(rstr->dwLength)))) 99 { 100 if (dwType == REG_BINARY ) 101 { 102 TRACE ("%p\n", rstr); 103 return (IStream*)rstr; 104 } 105 } 106 HeapFree (GetProcessHeap(),0,rstr->pbBuffer); 107 } 108 } 109 RegCloseKey(rstr->hKey); 110 } 111 HeapFree (GetProcessHeap(),0,rstr); 112 return NULL; 114 113 } 115 114 … … 119 118 static HRESULT WINAPI IStream_fnQueryInterface(IStream *iface, REFIID riid, LPVOID *ppvObj) 120 119 { 121 ICOM_THIS(ISHRegStream, iface);122 123 //// TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj);124 125 *ppvObj = NULL;126 127 if(IsEqualIID(riid, &IID_IUnknown))/*IUnknown*/128 { *ppvObj = This; 129 }130 else if(IsEqualIID(riid, &IID_IStream))/*IStream*/131 { *ppvObj = This;132 } 133 134 if(*ppvObj)135 { 136 IStream_AddRef((IStream*)*ppvObj); 137 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);138 return S_OK;139 }140 TRACE("-- Interface: E_NOINTERFACE\n");141 return E_NOINTERFACE;120 ICOM_THIS(ISHRegStream, iface); 121 122 //// TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj); 123 124 *ppvObj = NULL; 125 126 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/ 127 { *ppvObj = This; 128 } 129 else if(IsEqualIID(riid, &IID_IStream)) /*IStream*/ 130 { *ppvObj = This; 131 } 132 133 if(*ppvObj) 134 { 135 IStream_AddRef((IStream*)*ppvObj); 136 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj); 137 return S_OK; 138 } 139 TRACE("-- Interface: E_NOINTERFACE\n"); 140 return E_NOINTERFACE; 142 141 } 143 142 … … 147 146 static ULONG WINAPI IStream_fnAddRef(IStream *iface) 148 147 { 149 ICOM_THIS(ISHRegStream, iface);150 151 TRACE("(%p)->(count=%lu)\n",This, This->ref);152 153 return ++(This->ref);148 ICOM_THIS(ISHRegStream, iface); 149 150 TRACE("(%p)->(count=%lu)\n",This, This->ref); 151 152 return ++(This->ref); 154 153 } 155 154 … … 159 158 static ULONG WINAPI IStream_fnRelease(IStream *iface) 160 159 { 161 ICOM_THIS(ISHRegStream, iface);162 163 TRACE("(%p)->()\n",This);164 165 if (!--(This->ref)) 166 { TRACE(" destroying SHReg IStream (%p)\n",This);167 168 if (This->pbBuffer)169 HeapFree(GetProcessHeap(),0,This->pbBuffer);170 171 if (This->hKey)172 RegCloseKey(This->hKey);173 174 HeapFree(GetProcessHeap(),0,This);175 return 0;176 }177 return This->ref;160 ICOM_THIS(ISHRegStream, iface); 161 162 TRACE("(%p)->()\n",This); 163 164 if (!--(This->ref)) 165 { TRACE(" destroying SHReg IStream (%p)\n",This); 166 167 if (This->pbBuffer) 168 HeapFree(GetProcessHeap(),0,This->pbBuffer); 169 170 if (This->hKey) 171 RegCloseKey(This->hKey); 172 173 HeapFree(GetProcessHeap(),0,This); 174 return 0; 175 } 176 return This->ref; 178 177 } 179 178 180 179 static HRESULT WINAPI IStream_fnRead (IStream * iface, void* pv, ULONG cb, ULONG* pcbRead) 181 180 { 182 ICOM_THIS(ISHRegStream, iface);183 184 DWORD dwBytesToRead, dwBytesLeft;185 186 TRACE("(%p)->(%p,0x%08lx,%p)\n",This, pv, cb, pcbRead);187 188 if ( !pv )189 return STG_E_INVALIDPOINTER;190 191 dwBytesLeft = This->dwLength - This->dwPos;192 193 if ( 0 >= dwBytesLeft )/* end of buffer */194 return S_FALSE;195 196 dwBytesToRead = ( cb > dwBytesLeft) ? dwBytesLeft : cb;197 198 memmove ( pv, (This->pbBuffer) + (This->dwPos), dwBytesToRead);199 200 This->dwPos += dwBytesToRead;/* adjust pointer */201 202 if (pcbRead)203 *pcbRead = dwBytesToRead;204 205 return S_OK;181 ICOM_THIS(ISHRegStream, iface); 182 183 DWORD dwBytesToRead, dwBytesLeft; 184 185 TRACE("(%p)->(%p,0x%08lx,%p)\n",This, pv, cb, pcbRead); 186 187 if ( !pv ) 188 return STG_E_INVALIDPOINTER; 189 190 dwBytesLeft = This->dwLength - This->dwPos; 191 192 if ( 0 >= dwBytesLeft ) /* end of buffer */ 193 return S_FALSE; 194 195 dwBytesToRead = ( cb > dwBytesLeft) ? dwBytesLeft : cb; 196 197 memmove ( pv, (This->pbBuffer) + (This->dwPos), dwBytesToRead); 198 199 This->dwPos += dwBytesToRead; /* adjust pointer */ 200 201 if (pcbRead) 202 *pcbRead = dwBytesToRead; 203 204 return S_OK; 206 205 } 207 206 static HRESULT WINAPI IStream_fnWrite (IStream * iface, const void* pv, ULONG cb, ULONG* pcbWritten) 208 207 { 209 ICOM_THIS(ISHRegStream, iface);210 211 TRACE("(%p)\n",This);212 213 return E_NOTIMPL;208 ICOM_THIS(ISHRegStream, iface); 209 210 TRACE("(%p)\n",This); 211 212 return E_NOTIMPL; 214 213 } 215 214 static HRESULT WINAPI IStream_fnSeek (IStream * iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER* plibNewPosition) 216 215 { 217 ICOM_THIS(ISHRegStream, iface);218 219 TRACE("(%p)\n",This);220 221 return E_NOTIMPL;216 ICOM_THIS(ISHRegStream, iface); 217 218 TRACE("(%p)\n",This); 219 220 return E_NOTIMPL; 222 221 } 223 222 static HRESULT WINAPI IStream_fnSetSize (IStream * iface, ULARGE_INTEGER libNewSize) 224 223 { 225 ICOM_THIS(ISHRegStream, iface);226 227 TRACE("(%p)\n",This);228 229 return E_NOTIMPL;224 ICOM_THIS(ISHRegStream, iface); 225 226 TRACE("(%p)\n",This); 227 228 return E_NOTIMPL; 230 229 } 231 230 static HRESULT WINAPI IStream_fnCopyTo (IStream * iface, IStream* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead, ULARGE_INTEGER* pcbWritten) 232 231 { 233 ICOM_THIS(ISHRegStream, iface);234 235 TRACE("(%p)\n",This);236 237 return E_NOTIMPL;232 ICOM_THIS(ISHRegStream, iface); 233 234 TRACE("(%p)\n",This); 235 236 return E_NOTIMPL; 238 237 } 239 238 static HRESULT WINAPI IStream_fnCommit (IStream * iface, DWORD grfCommitFlags) 240 239 { 241 ICOM_THIS(ISHRegStream, iface);242 243 TRACE("(%p)\n",This);244 245 return E_NOTIMPL;240 ICOM_THIS(ISHRegStream, iface); 241 242 TRACE("(%p)\n",This); 243 244 return E_NOTIMPL; 246 245 } 247 246 static HRESULT WINAPI IStream_fnRevert (IStream * iface) 248 247 { 249 ICOM_THIS(ISHRegStream, iface);250 251 TRACE("(%p)\n",This);252 253 return E_NOTIMPL;248 ICOM_THIS(ISHRegStream, iface); 249 250 TRACE("(%p)\n",This); 251 252 return E_NOTIMPL; 254 253 } 255 254 static HRESULT WINAPI IStream_fnLockRegion (IStream * iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) 256 255 { 257 ICOM_THIS(ISHRegStream, iface);258 259 TRACE("(%p)\n",This);260 261 return E_NOTIMPL;256 ICOM_THIS(ISHRegStream, iface); 257 258 TRACE("(%p)\n",This); 259 260 return E_NOTIMPL; 262 261 } 263 262 static HRESULT WINAPI IStream_fnUnlockRegion (IStream * iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) 264 263 { 265 ICOM_THIS(ISHRegStream, iface);266 267 TRACE("(%p)\n",This);268 269 return E_NOTIMPL;264 ICOM_THIS(ISHRegStream, iface); 265 266 TRACE("(%p)\n",This); 267 268 return E_NOTIMPL; 270 269 } 271 270 static HRESULT WINAPI IStream_fnStat (IStream * iface, STATSTG* pstatstg, DWORD grfStatFlag) 272 271 { 273 ICOM_THIS(ISHRegStream, iface);274 275 TRACE("(%p)\n",This);276 277 return E_NOTIMPL;272 ICOM_THIS(ISHRegStream, iface); 273 274 TRACE("(%p)\n",This); 275 276 return E_NOTIMPL; 278 277 } 279 278 static HRESULT WINAPI IStream_fnClone (IStream * iface, IStream** ppstm) 280 279 { 281 ICOM_THIS(ISHRegStream, iface);282 283 TRACE("(%p)\n",This);284 285 return E_NOTIMPL;286 } 287 288 static struct ICOM_VTABLE(IStream) rstvt = 289 { 290 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE291 IStream_fnQueryInterface,292 IStream_fnAddRef,293 IStream_fnRelease,294 IStream_fnRead,295 IStream_fnWrite,296 IStream_fnSeek,297 IStream_fnSetSize,298 IStream_fnCopyTo,299 IStream_fnCommit,300 IStream_fnRevert,301 IStream_fnLockRegion,302 IStream_fnUnlockRegion,303 IStream_fnStat,304 IStream_fnClone305 280 ICOM_THIS(ISHRegStream, iface); 281 282 TRACE("(%p)\n",This); 283 284 return E_NOTIMPL; 285 } 286 287 static struct ICOM_VTABLE(IStream) rstvt = 288 { 289 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 290 IStream_fnQueryInterface, 291 IStream_fnAddRef, 292 IStream_fnRelease, 293 IStream_fnRead, 294 IStream_fnWrite, 295 IStream_fnSeek, 296 IStream_fnSetSize, 297 IStream_fnCopyTo, 298 IStream_fnCommit, 299 IStream_fnRevert, 300 IStream_fnLockRegion, 301 IStream_fnUnlockRegion, 302 IStream_fnStat, 303 IStream_fnClone 304 306 305 }; 307 306 308 307 /************************************************************************* 309 * SHOpenRegStreamA [SHLWAPI.@]308 * SHOpenRegStreamA [SHLWAPI.@] 310 309 */ 311 310 IStream * WINAPI SHOpenRegStreamA( 312 HKEY hkey,313 LPCSTR pszSubkey,314 LPCSTR pszValue,315 DWORD grfMode)316 { 317 TRACE("(0x%08x,%s,%s,0x%08lx)\n",318 hkey, pszSubkey, pszValue, grfMode);319 320 return IStream_ConstructorA(hkey, pszSubkey, pszValue, grfMode);311 HKEY hkey, 312 LPCSTR pszSubkey, 313 LPCSTR pszValue, 314 DWORD grfMode) 315 { 316 TRACE("(0x%08x,%s,%s,0x%08lx)\n", 317 hkey, pszSubkey, pszValue, grfMode); 318 319 return IStream_ConstructorA(hkey, pszSubkey, pszValue, grfMode); 321 320 } 322 321 323 322 /************************************************************************* 324 * SHOpenRegStreamW [SHLWAPI.@]323 * SHOpenRegStreamW [SHLWAPI.@] 325 324 */ 326 325 IStream * WINAPI SHOpenRegStreamW( 327 HKEY hkey,328 LPCWSTR pszSubkey,329 LPCWSTR pszValue,330 DWORD grfMode)331 { 332 TRACE("(0x%08x,%s,%s,0x%08lx)\n",333 hkey, debugstr_w(pszSubkey), debugstr_w(pszValue), grfMode);334 335 return IStream_ConstructorW(hkey, pszSubkey, pszValue, grfMode);336 } 326 HKEY hkey, 327 LPCWSTR pszSubkey, 328 LPCWSTR pszValue, 329 DWORD grfMode) 330 { 331 TRACE("(0x%08x,%s,%s,0x%08lx)\n", 332 hkey, debugstr_w(pszSubkey), debugstr_w(pszValue), grfMode); 333 334 return IStream_ConstructorW(hkey, pszSubkey, pszValue, grfMode); 335 } -
trunk/src/shlwapi/shlwapiguid.c
r6650 r6712 1 /* $Id: shlwapiguid.c,v 1.2 2001-09-05 13:48:38 bird Exp $ */2 1 /* 3 * SHRegOpenStream2 * SHRegOpenStream 4 3 */ 5 4 #ifdef __WIN32OS2__ -
trunk/src/shlwapi/string.c
r6650 r6712 1 /* $Id: string.c,v 1.5 2001-09-05 13:48:39 bird Exp $ */2 1 //Note: Odin changes marked by #ifdef __WIN32OS2__! 3 2 #ifdef __WIN32OS2__ … … 16 15 #endif 17 16 #include <ctype.h> 18 #include <stdlib.h> 17 #include <stdlib.h> 19 18 #include <stdio.h> 20 19 #include <string.h> … … 42 41 43 42 /************************************************************************* 44 * StrChrA [SHLWAPI]43 * StrChrA [SHLWAPI] 45 44 */ 46 45 LPSTR WINAPI StrChrA (LPCSTR str, WORD c) 47 46 { 48 TRACE("%s %i\n", str,c);49 return strchr(str, c);50 } 51 52 /************************************************************************* 53 * StrChrW [SHLWAPI]47 TRACE("%s %i\n", str,c); 48 return strchr(str, c); 49 } 50 51 /************************************************************************* 52 * StrChrW [SHLWAPI] 54 53 * 55 54 */ 56 55 LPWSTR WINAPI StrChrW (LPCWSTR str, WCHAR x ) 57 56 { 58 TRACE("%s 0x%04x\n",debugstr_w(str),x);59 return strchrW(str, x);57 TRACE("%s 0x%04x\n",debugstr_w(str),x); 58 return strchrW(str, x); 60 59 } 61 60 #ifndef __WIN32OS2__ 62 61 /************************************************************************* 63 * StrCmpIW [SHLWAPI]62 * StrCmpIW [SHLWAPI] 64 63 */ 65 64 int WINAPI StrCmpIW ( LPCWSTR wstr1, LPCWSTR wstr2 ) … … 71 70 72 71 /************************************************************************* 73 * StrCmpNA [SHLWAPI]72 * StrCmpNA [SHLWAPI] 74 73 */ 75 74 INT WINAPI StrCmpNA ( LPCSTR str1, LPCSTR str2, INT len) 76 75 { 77 TRACE("%s %s %i stub\n", str1,str2,len);78 return strncmp(str1, str2, len);79 } 80 81 /************************************************************************* 82 * StrCmpNW [SHLWAPI]76 TRACE("%s %s %i stub\n", str1,str2,len); 77 return strncmp(str1, str2, len); 78 } 79 80 /************************************************************************* 81 * StrCmpNW [SHLWAPI] 83 82 */ 84 83 INT WINAPI StrCmpNW ( LPCWSTR wstr1, LPCWSTR wstr2, INT len) 85 84 { 86 TRACE("%s %s %i stub\n", debugstr_w(wstr1),debugstr_w(wstr2),len);87 return strncmpW(wstr1, wstr2, len);88 } 89 90 /************************************************************************* 91 * StrCmpNIA [SHLWAPI]85 TRACE("%s %s %i stub\n", debugstr_w(wstr1),debugstr_w(wstr2),len); 86 return strncmpW(wstr1, wstr2, len); 87 } 88 89 /************************************************************************* 90 * StrCmpNIA [SHLWAPI] 92 91 */ 93 92 int WINAPI StrCmpNIA ( LPCSTR str1, LPCSTR str2, int len) 94 93 { 95 TRACE("%s %s %i stub\n", str1,str2,len);96 return strncasecmp(str1, str2, len);97 } 98 99 /************************************************************************* 100 * StrCmpNIW [SHLWAPI]94 TRACE("%s %s %i stub\n", str1,str2,len); 95 return strncasecmp(str1, str2, len); 96 } 97 98 /************************************************************************* 99 * StrCmpNIW [SHLWAPI] 101 100 */ 102 101 int WINAPI StrCmpNIW ( LPCWSTR wstr1, LPCWSTR wstr2, int len) 103 102 { 104 TRACE("%s %s %i stub\n", debugstr_w(wstr1),debugstr_w(wstr2),len);105 return strncmpiW(wstr1, wstr2, len);106 } 107 108 /************************************************************************* 109 * StrCmpW [SHLWAPI]103 TRACE("%s %s %i stub\n", debugstr_w(wstr1),debugstr_w(wstr2),len); 104 return strncmpiW(wstr1, wstr2, len); 105 } 106 107 /************************************************************************* 108 * StrCmpW [SHLWAPI] 110 109 */ 111 110 int WINAPI StrCmpW ( LPCWSTR wstr1, LPCWSTR wstr2 ) … … 116 115 117 116 /************************************************************************* 118 * StrCatW [SHLWAPI]117 * StrCatW [SHLWAPI] 119 118 */ 120 119 LPWSTR WINAPI StrCatW( LPWSTR wstr1, LPCWSTR wstr2 ) … … 125 124 126 125 /************************************************************************* 127 * StrCpyW [SHLWAPI]126 * StrCpyW [SHLWAPI] 128 127 */ 129 128 LPWSTR WINAPI StrCpyW( LPWSTR wstr1, LPCWSTR wstr2 ) … … 134 133 135 134 /************************************************************************* 136 * StrCpyNW [SHLWAPI]135 * StrCpyNW [SHLWAPI] 137 136 */ 138 137 LPWSTR WINAPI StrCpyNW( LPWSTR wstr1, LPCWSTR wstr2, int n ) … … 143 142 144 143 /************************************************************************* 145 * StrStrA [SHLWAPI]144 * StrStrA [SHLWAPI] 146 145 */ 147 146 LPSTR WINAPI StrStrA(LPCSTR lpFirst, LPCSTR lpSrch) … … 158 157 159 158 /************************************************************************* 160 * StrStrW [SHLWAPI]159 * StrStrW [SHLWAPI] 161 160 */ 162 161 LPWSTR WINAPI StrStrW(LPCWSTR lpFirst, LPCWSTR lpSrch) … … 173 172 174 173 /************************************************************************* 175 * StrStrIA [SHLWAPI]174 * StrStrIA [SHLWAPI] 176 175 */ 177 176 LPSTR WINAPI StrStrIA(LPCSTR lpFirst, LPCSTR lpSrch) … … 188 187 189 188 /************************************************************************* 190 * StrStrIW [SHLWAPI]189 * StrStrIW [SHLWAPI] 191 190 */ 192 191 LPWSTR WINAPI StrStrIW(LPCWSTR lpFirst, LPCWSTR lpSrch) … … 203 202 204 203 /************************************************************************* 205 * StrToIntA[SHLWAPI]204 * StrToIntA [SHLWAPI] 206 205 */ 207 206 int WINAPI StrToIntA(LPCSTR lpSrc) 208 207 { 209 TRACE("%s\n", lpSrc);210 return atol(lpSrc);211 } 212 213 /************************************************************************* 214 * StrToIntW[SHLWAPI]208 TRACE("%s\n", lpSrc); 209 return atol(lpSrc); 210 } 211 212 /************************************************************************* 213 * StrToIntW [SHLWAPI] 215 214 */ 216 215 int WINAPI StrToIntW(LPCWSTR lpSrc) … … 225 224 226 225 /************************************************************************* 227 * StrToIntExA[SHLWAPI]226 * StrToIntExA [SHLWAPI] 228 227 */ 229 228 BOOL WINAPI StrToIntExA( LPCSTR pszString, DWORD dwFlags, LPINT piRet) 230 229 { 231 TRACE("%s %ld stub !\n", debugstr_a(pszString), dwFlags);232 piRet = (LPINT) StrToIntA(pszString);233 return TRUE;234 } 235 236 /************************************************************************* 237 * StrToIntExW[SHLWAPI]230 TRACE("%s %ld stub !\n", debugstr_a(pszString), dwFlags); 231 piRet = (LPINT) StrToIntA(pszString); 232 return TRUE; 233 } 234 235 /************************************************************************* 236 * StrToIntExW [SHLWAPI] 238 237 */ 239 238 BOOL WINAPI StrToIntExW( LPCWSTR pszString, DWORD dwFlags, LPINT piRet) 240 239 { 241 TRACE("%s %ld stub !\n", debugstr_w(pszString), dwFlags);242 piRet = (LPINT) StrToIntW(pszString);243 return TRUE;244 } 245 246 /************************************************************************* 247 * StrDupA[SHLWAPI]240 TRACE("%s %ld stub !\n", debugstr_w(pszString), dwFlags); 241 piRet = (LPINT) StrToIntW(pszString); 242 return TRUE; 243 } 244 245 /************************************************************************* 246 * StrDupA [SHLWAPI] 248 247 */ 249 248 LPSTR WINAPI StrDupA (LPCSTR lpSrc) 250 249 { 251 int len = strlen(lpSrc);252 LPSTR lpDest = (LPSTR) LocalAlloc(LMEM_FIXED, len+1);253 254 TRACE("%s\n", lpSrc);255 256 if (lpDest) strcpy(lpDest, lpSrc);257 return lpDest;258 } 259 260 /************************************************************************* 261 * StrDupW[SHLWAPI]250 int len = strlen(lpSrc); 251 LPSTR lpDest = (LPSTR) LocalAlloc(LMEM_FIXED, len+1); 252 253 TRACE("%s\n", lpSrc); 254 255 if (lpDest) strcpy(lpDest, lpSrc); 256 return lpDest; 257 } 258 259 /************************************************************************* 260 * StrDupW [SHLWAPI] 262 261 */ 263 262 LPWSTR WINAPI StrDupW (LPCWSTR lpSrc) 264 263 { 265 int len = strlenW(lpSrc);266 LPWSTR lpDest = (LPWSTR) LocalAlloc(LMEM_FIXED, sizeof(WCHAR) * (len+1));267 268 TRACE("%s\n", debugstr_w(lpSrc));269 270 if (lpDest) strcpyW(lpDest, lpSrc);271 return lpDest;272 } 273 274 /************************************************************************* 275 * StrCSpnA[SHLWAPI]264 int len = strlenW(lpSrc); 265 LPWSTR lpDest = (LPWSTR) LocalAlloc(LMEM_FIXED, sizeof(WCHAR) * (len+1)); 266 267 TRACE("%s\n", debugstr_w(lpSrc)); 268 269 if (lpDest) strcpyW(lpDest, lpSrc); 270 return lpDest; 271 } 272 273 /************************************************************************* 274 * StrCSpnA [SHLWAPI] 276 275 */ 277 276 int WINAPI StrCSpnA (LPCSTR lpStr, LPCSTR lpSet) 278 277 { 279 int i,j, pos = strlen(lpStr);280 281 TRACE("(%p %s %p %s)\n",282 lpStr, debugstr_a(lpStr), lpSet, debugstr_a(lpSet));283 284 for (i=0; i < strlen(lpSet) ; i++ )285 {286 for (j = 0; j < pos;j++)287 {288 if (lpStr[j] == lpSet[i])289 {290 pos = j;291 }292 }293 } 294 TRACE("-- %u\n", pos);295 return pos; 296 } 297 298 /************************************************************************* 299 * StrCSpnW[SHLWAPI]278 int i,j, pos = strlen(lpStr); 279 280 TRACE("(%p %s %p %s)\n", 281 lpStr, debugstr_a(lpStr), lpSet, debugstr_a(lpSet)); 282 283 for (i=0; i < strlen(lpSet) ; i++ ) 284 { 285 for (j = 0; j < pos;j++) 286 { 287 if (lpStr[j] == lpSet[i]) 288 { 289 pos = j; 290 } 291 } 292 } 293 TRACE("-- %u\n", pos); 294 return pos; 295 } 296 297 /************************************************************************* 298 * StrCSpnW [SHLWAPI] 300 299 */ 301 300 int WINAPI StrCSpnW (LPCWSTR lpStr, LPCWSTR lpSet) 302 301 { 303 int i,j, pos = strlenW(lpStr);304 305 TRACE("(%p %s %p %s)\n",306 lpStr, debugstr_w(lpStr), lpSet, debugstr_w(lpSet));307 308 for (i=0; i < strlenW(lpSet) ; i++ )309 {310 for (j = 0; j < pos;j++)311 {312 if (lpStr[j] == lpSet[i])313 {314 pos = j;315 }316 }317 } 318 TRACE("-- %u\n", pos);319 return pos; 302 int i,j, pos = strlenW(lpStr); 303 304 TRACE("(%p %s %p %s)\n", 305 lpStr, debugstr_w(lpStr), lpSet, debugstr_w(lpSet)); 306 307 for (i=0; i < strlenW(lpSet) ; i++ ) 308 { 309 for (j = 0; j < pos;j++) 310 { 311 if (lpStr[j] == lpSet[i]) 312 { 313 pos = j; 314 } 315 } 316 } 317 TRACE("-- %u\n", pos); 318 return pos; 320 319 } 321 320 … … 338 337 if (dbcs && lpStart[1] != HIBYTE(wMatch)) continue; 339 338 lpGotIt = lpStart; 340 } 339 } 341 340 return (LPSTR)lpGotIt; 342 341 } … … 362 361 363 362 /************************************************************************* 364 * StrCatBuffA[SHLWAPI]363 * StrCatBuffA [SHLWAPI] 365 364 * 366 365 * Appends back onto front, stopping when front is size-1 characters long. … … 380 379 381 380 /************************************************************************* 382 * StrCatBuffW[SHLWAPI]381 * StrCatBuffW [SHLWAPI] 383 382 * 384 383 * Appends back onto front, stopping when front is size-1 characters long. … … 398 397 399 398 /************************************************************************* 400 * StrRetToBufA [SHLWAPI.@]401 * 399 * StrRetToBufA [SHLWAPI.@] 400 * 402 401 * converts a STRRET to a normal string 403 402 * … … 407 406 HRESULT WINAPI StrRetToBufA (LPSTRRET src, const ITEMIDLIST *pidl, LPSTR dest, DWORD len) 408 407 { 409 TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl);410 411 switch (src->uType)412 {413 case STRRET_WSTR:414 WideCharToMultiByte(CP_ACP, 0, src->u.pOleStr, -1, (LPSTR)dest, len, NULL, NULL);415 /* SHFree(src->u.pOleStr); FIXME: is this right? */416 break;417 418 case STRRET_CSTRA:419 lstrcpynA((LPSTR)dest, src->u.cStr, len);420 break;421 422 case STRRET_OFFSETA:423 lstrcpynA((LPSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len);424 break;425 426 default:427 FIXME("unknown type!\n");428 if (len)429 {430 *(LPSTR)dest = '\0';431 }432 return(FALSE);433 }434 return S_OK;435 } 436 437 /************************************************************************* 438 * StrRetToBufW [SHLWAPI.@]439 * 408 TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl); 409 410 switch (src->uType) 411 { 412 case STRRET_WSTR: 413 WideCharToMultiByte(CP_ACP, 0, src->u.pOleStr, -1, (LPSTR)dest, len, NULL, NULL); 414 /* SHFree(src->u.pOleStr); FIXME: is this right? */ 415 break; 416 417 case STRRET_CSTRA: 418 lstrcpynA((LPSTR)dest, src->u.cStr, len); 419 break; 420 421 case STRRET_OFFSETA: 422 lstrcpynA((LPSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len); 423 break; 424 425 default: 426 FIXME("unknown type!\n"); 427 if (len) 428 { 429 *(LPSTR)dest = '\0'; 430 } 431 return(FALSE); 432 } 433 return S_OK; 434 } 435 436 /************************************************************************* 437 * StrRetToBufW [SHLWAPI.@] 438 * 440 439 * converts a STRRET to a normal string 441 440 * … … 445 444 HRESULT WINAPI StrRetToBufW (LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, DWORD len) 446 445 { 447 TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl);448 449 switch (src->uType)450 {451 case STRRET_WSTR:452 lstrcpynW((LPWSTR)dest, src->u.pOleStr, len);453 /* SHFree(src->u.pOleStr); FIXME: is this right? */454 break;455 456 case STRRET_CSTRA:446 TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl); 447 448 switch (src->uType) 449 { 450 case STRRET_WSTR: 451 lstrcpynW((LPWSTR)dest, src->u.pOleStr, len); 452 /* SHFree(src->u.pOleStr); FIXME: is this right? */ 453 break; 454 455 case STRRET_CSTRA: 457 456 if (!MultiByteToWideChar( CP_ACP, 0, src->u.cStr, -1, dest, len ) && len) 458 457 dest[len-1] = 0; 459 break;460 461 case STRRET_OFFSETA:462 if (pidl)463 {458 break; 459 460 case STRRET_OFFSETA: 461 if (pidl) 462 { 464 463 if (!MultiByteToWideChar( CP_ACP, 0, ((LPCSTR)&pidl->mkid)+src->u.uOffset, -1, 465 464 dest, len ) && len) 466 465 dest[len-1] = 0; 467 }468 break;469 470 default:471 FIXME("unknown type!\n");472 if (len)473 { *(LPSTR)dest = '\0';474 }475 return(FALSE);476 }477 return S_OK;478 } 479 480 /************************************************************************* 481 * StrFormatByteSizeA [SHLWAPI]466 } 467 break; 468 469 default: 470 FIXME("unknown type!\n"); 471 if (len) 472 { *(LPSTR)dest = '\0'; 473 } 474 return(FALSE); 475 } 476 return S_OK; 477 } 478 479 /************************************************************************* 480 * StrFormatByteSizeA [SHLWAPI] 482 481 */ 483 482 LPSTR WINAPI StrFormatByteSizeA ( DWORD dw, LPSTR pszBuf, UINT cchBuf ) 484 { char buf[64];485 TRACE("%lx %p %i\n", dw, pszBuf, cchBuf);486 if ( dw<1024L )487 { sprintf (buf,"%ld bytes", dw);488 }489 else if ( dw<1048576L)490 { sprintf (buf,"%3.1f KB", (FLOAT)dw/1024);491 }492 else if ( dw < 1073741824L)493 { sprintf (buf,"%3.1f MB", (FLOAT)dw/1048576L);494 }495 else496 { sprintf (buf,"%3.1f GB", (FLOAT)dw/1073741824L);497 }498 lstrcpynA (pszBuf, buf, cchBuf);499 return pszBuf; 500 } 501 502 /************************************************************************* 503 * StrFormatByteSizeW [SHLWAPI]483 { char buf[64]; 484 TRACE("%lx %p %i\n", dw, pszBuf, cchBuf); 485 if ( dw<1024L ) 486 { sprintf (buf,"%ld bytes", dw); 487 } 488 else if ( dw<1048576L) 489 { sprintf (buf,"%3.1f KB", (FLOAT)dw/1024); 490 } 491 else if ( dw < 1073741824L) 492 { sprintf (buf,"%3.1f MB", (FLOAT)dw/1048576L); 493 } 494 else 495 { sprintf (buf,"%3.1f GB", (FLOAT)dw/1073741824L); 496 } 497 lstrcpynA (pszBuf, buf, cchBuf); 498 return pszBuf; 499 } 500 501 /************************************************************************* 502 * StrFormatByteSizeW [SHLWAPI] 504 503 */ 505 504 LPWSTR WINAPI StrFormatByteSizeW ( DWORD dw, LPWSTR pszBuf, UINT cchBuf ) … … 513 512 514 513 /************************************************************************* 515 * StrNCatA [SHLWAPI]514 * StrNCatA [SHLWAPI] 516 515 */ 517 516 LPSTR WINAPI StrNCatA(LPSTR front, LPCSTR back, INT cchMax) 518 517 { 519 TRACE("%s %s %i stub\n", debugstr_a(front),debugstr_a(back),cchMax);520 return (front);521 } 522 523 /************************************************************************* 524 * StrNCatW [SHLWAPI]518 TRACE("%s %s %i stub\n", debugstr_a(front),debugstr_a(back),cchMax); 519 return (front); 520 } 521 522 /************************************************************************* 523 * StrNCatW [SHLWAPI] 525 524 */ 526 525 LPWSTR WINAPI StrNCatW(LPWSTR front, LPCWSTR back, INT cchMax) 527 526 { 528 TRACE("%s %s %i stub\n", debugstr_w(front),debugstr_w(back),cchMax);529 return (front);530 } 531 532 /************************************************************************* 533 * StrTrimA [SHLWAPI.@]527 TRACE("%s %s %i stub\n", debugstr_w(front),debugstr_w(back),cchMax); 528 return (front); 529 } 530 531 /************************************************************************* 532 * StrTrimA [SHLWAPI.@] 534 533 */ 535 534 BOOL WINAPI StrTrimA(LPSTR pszSource, LPCSTR pszTrimChars) … … 542 541 for (pTrim = pszTrimChars; *pTrim; pTrim++) 543 542 { 544 for (pSrc = pszSource; *pSrc; pSrc++)545 if (*pSrc == *pTrim)546 {547 /* match -> remove this char.548 * strlen(pSrc) equiv. to the correct strlen(pSrc+1)+1 */549 memmove(pSrc, pSrc+1, strlen(pSrc));550 trimmed = TRUE;551 }543 for (pSrc = pszSource; *pSrc; pSrc++) 544 if (*pSrc == *pTrim) 545 { 546 /* match -> remove this char. 547 * strlen(pSrc) equiv. to the correct strlen(pSrc+1)+1 */ 548 memmove(pSrc, pSrc+1, strlen(pSrc)); 549 trimmed = TRUE; 550 } 552 551 } 553 552 TRACE("<- '%s'\n", pszSource); … … 556 555 557 556 /************************************************************************* 558 * wnsprintfA [SHLWAPI]557 * wnsprintfA [SHLWAPI] 559 558 */ 560 559 int WINAPIV wnsprintfA(LPSTR lpOut, int cchLimitIn, LPCSTR lpFmt, ...) … … 570 569 571 570 /************************************************************************* 572 * wnsprintfW [SHLWAPI]571 * wnsprintfW [SHLWAPI] 573 572 */ 574 573 int WINAPIV wnsprintfW(LPWSTR lpOut, int cchLimitIn, LPCWSTR lpFmt, ...) -
trunk/src/shlwapi/url.c
r6650 r6712 1 /* $Id: url.c,v 1.4 2001-09-05 13:48:39 bird Exp $ */2 1 /* 3 2 * Url functions … … 54 53 if(dwFlags & URL_ESCAPE_SPACES_ONLY) { 55 54 if(ch == ' ') 56 return TRUE;57 else58 return FALSE;55 return TRUE; 56 else 57 return FALSE; 59 58 } 60 59 61 60 if (ch <= 31 || ch >= 127) 62 return TRUE;61 return TRUE; 63 62 64 63 else { 65 64 switch (ch) { 66 case ' ':67 case '<':68 case '>':69 case '\"':70 case '{':71 case '}':72 case '|':73 case '\\':74 case '^':75 case ']':76 case '[':77 case '`':78 case '&':79 return TRUE;80 81 default:82 return FALSE;83 }65 case ' ': 66 case '<': 67 case '>': 68 case '\"': 69 case '{': 70 case '}': 71 case '|': 72 case '\\': 73 case '^': 74 case ']': 75 case '[': 76 case '`': 77 case '&': 78 return TRUE; 79 80 default: 81 return FALSE; 82 } 84 83 } 85 84 } … … 89 88 */ 90 89 HRESULT WINAPI UrlCanonicalizeA(LPCSTR pszUrl, LPSTR pszCanonicalized, 91 LPDWORD pcchCanonicalized, DWORD dwFlags)90 LPDWORD pcchCanonicalized, DWORD dwFlags) 92 91 { 93 92 HRESULT hr = S_OK; … … 97 96 98 97 TRACE("(%s %p %p 0x%08lx)\n", debugstr_a(pszUrl), pszCanonicalized, 99 pcchCanonicalized, dwFlags);98 pcchCanonicalized, dwFlags); 100 99 101 100 nLen = strlen(pszUrl); … … 114 113 if(dwFlags & (URL_ESCAPE_UNSAFE | URL_ESCAPE_SPACES_ONLY)) { 115 114 DWORD EscapeFlags = dwFlags & (URL_ESCAPE_SPACES_ONLY 116 /* | URL_ESCAPE_PERCENT */);117 hr = UrlEscapeA(lpszUrlCpy, pszCanonicalized, pcchCanonicalized,118 EscapeFlags);115 /* | URL_ESCAPE_PERCENT */); 116 hr = UrlEscapeA(lpszUrlCpy, pszCanonicalized, pcchCanonicalized, 117 EscapeFlags); 119 118 } else { /* No escapping needed, just copy the string */ 120 119 nLen = strlen(lpszUrlCpy); 121 if(nLen < *pcchCanonicalized)122 memcpy(pszCanonicalized, lpszUrlCpy, nLen + 1);123 else {124 hr = E_POINTER;125 nLen++;126 }127 *pcchCanonicalized = nLen;120 if(nLen < *pcchCanonicalized) 121 memcpy(pszCanonicalized, lpszUrlCpy, nLen + 1); 122 else { 123 hr = E_POINTER; 124 nLen++; 125 } 126 *pcchCanonicalized = nLen; 128 127 } 129 128 130 129 HeapFree(GetProcessHeap(), 0, lpszUrlCpy); 131 130 132 131 return hr; 133 132 } … … 136 135 * UrlCanonicalizeW [SHLWAPI] 137 136 */ 138 HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized, 139 LPDWORD pcchCanonicalized, DWORD dwFlags)137 HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized, 138 LPDWORD pcchCanonicalized, DWORD dwFlags) 140 139 { 141 140 FIXME("(%s %p %p 0x%08lx): stub\n",debugstr_w(pszUrl), 142 pszCanonicalized, pcchCanonicalized, dwFlags);141 pszCanonicalized, pcchCanonicalized, dwFlags); 143 142 return E_NOTIMPL; 144 143 } 145 144 146 145 /************************************************************************* 147 * UrlEscapeA [SHLWAPI]146 * UrlEscapeA [SHLWAPI] 148 147 * 149 148 * Converts unsafe characters into their escape sequences. … … 173 172 */ 174 173 HRESULT WINAPI UrlEscapeA( 175 LPCSTR pszUrl,176 LPSTR pszEscaped,177 LPDWORD pcchEscaped,178 DWORD dwFlags)174 LPCSTR pszUrl, 175 LPSTR pszEscaped, 176 LPDWORD pcchEscaped, 177 DWORD dwFlags) 179 178 { 180 179 LPCSTR src; … … 186 185 187 186 TRACE("(%s %p %p 0x%08lx)\n", debugstr_a(pszUrl), pszEscaped, 188 pcchEscaped, dwFlags);187 pcchEscaped, dwFlags); 189 188 190 189 if(dwFlags & ~URL_ESCAPE_SPACES_ONLY) … … 193 192 for(src = pszUrl; *src; src++) { 194 193 if(!(dwFlags & URL_ESCAPE_SPACES_ONLY) && 195 (*src == '#' || *src == '?'))196 stop_escapping = TRUE;197 198 if(URL_NeedEscape(*src, dwFlags) && stop_escapping == FALSE) {199 next[0] = '%';200 next[1] = hex[(*src >> 4) & 0xf];201 next[2] = hex[*src & 0xf];202 len = 3;203 } else {204 next[0] = *src;205 len = 1;206 }207 208 if(needed + len <= *pcchEscaped) {209 memcpy(dst, next, len);210 dst += len;211 }212 needed += len;194 (*src == '#' || *src == '?')) 195 stop_escapping = TRUE; 196 197 if(URL_NeedEscape(*src, dwFlags) && stop_escapping == FALSE) { 198 next[0] = '%'; 199 next[1] = hex[(*src >> 4) & 0xf]; 200 next[2] = hex[*src & 0xf]; 201 len = 3; 202 } else { 203 next[0] = *src; 204 len = 1; 205 } 206 207 if(needed + len <= *pcchEscaped) { 208 memcpy(dst, next, len); 209 dst += len; 210 } 211 needed += len; 213 212 } 214 213 215 214 if(needed < *pcchEscaped) { 216 215 *dst = '\0'; 217 ret = S_OK;216 ret = S_OK; 218 217 } else { 219 218 needed++; /* add one for the '\0' */ 220 ret = E_POINTER;219 ret = E_POINTER; 221 220 } 222 221 *pcchEscaped = needed; 223 222 return ret; 224 } 225 226 /************************************************************************* 227 * UrlEscapeW [SHLWAPI]223 } 224 225 /************************************************************************* 226 * UrlEscapeW [SHLWAPI] 228 227 */ 229 228 HRESULT WINAPI UrlEscapeW( 230 LPCWSTR pszUrl,231 LPWSTR pszEscaped,232 LPDWORD pcchEscaped,233 DWORD dwFlags)229 LPCWSTR pszUrl, 230 LPWSTR pszEscaped, 231 LPDWORD pcchEscaped, 232 DWORD dwFlags) 234 233 { 235 234 FIXME("(%s %p %p 0x%08lx): stub\n",debugstr_w(pszUrl), 236 pszEscaped, pcchEscaped, dwFlags);235 pszEscaped, pcchEscaped, dwFlags); 237 236 return E_NOTIMPL; 238 237 } … … 240 239 241 240 /************************************************************************* 242 * UrlUnescapeA [SHLWAPI]241 * UrlUnescapeA [SHLWAPI] 243 242 * 244 243 * Converts escape sequences back to ordinary characters. 245 * 244 * 246 245 * If URL_ESCAPE_INPLACE is set in dwFlags then pszUnescaped and 247 246 * pcchUnescaped are ignored and the converted string is returned in … … 257 256 */ 258 257 HRESULT WINAPI UrlUnescapeA( 259 LPCSTR pszUrl,260 LPSTR pszUnescaped,261 LPDWORD pcchUnescaped,262 DWORD dwFlags)258 LPCSTR pszUrl, 259 LPSTR pszUnescaped, 260 LPDWORD pcchUnescaped, 261 DWORD dwFlags) 263 262 { 264 263 char *dst, next; … … 269 268 270 269 TRACE("(%s, %p, %p, %08lx): stub\n", debugstr_a(pszUrl), pszUnescaped, 271 pcchUnescaped, dwFlags);270 pcchUnescaped, dwFlags); 272 271 273 272 if(dwFlags & URL_UNESCAPE_INPLACE) … … 278 277 for(src = pszUrl, needed = 0; *src; src++, needed++) { 279 278 if(dwFlags & URL_DONT_UNESCAPE_EXTRA_INFO && 280 (*src == '#' || *src == '?')) {281 stop_unescapping = TRUE;282 next = *src;283 } else if(*src == '%' && isxdigit(*(src + 1)) && isxdigit(*(src + 2))284 && stop_unescapping == FALSE) {285 INT ih;286 char buf[3];287 memcpy(buf, src + 1, 2);288 buf[2] = '\0';289 ih = strtol(buf, NULL, 16);290 next = (CHAR) ih;291 src += 2; /* Advance to end of escape */292 } else293 next = *src;294 295 if(dwFlags & URL_UNESCAPE_INPLACE || needed < *pcchUnescaped)296 *dst++ = next;279 (*src == '#' || *src == '?')) { 280 stop_unescapping = TRUE; 281 next = *src; 282 } else if(*src == '%' && isxdigit(*(src + 1)) && isxdigit(*(src + 2)) 283 && stop_unescapping == FALSE) { 284 INT ih; 285 char buf[3]; 286 memcpy(buf, src + 1, 2); 287 buf[2] = '\0'; 288 ih = strtol(buf, NULL, 16); 289 next = (CHAR) ih; 290 src += 2; /* Advance to end of escape */ 291 } else 292 next = *src; 293 294 if(dwFlags & URL_UNESCAPE_INPLACE || needed < *pcchUnescaped) 295 *dst++ = next; 297 296 } 298 297 299 298 if(dwFlags & URL_UNESCAPE_INPLACE || needed < *pcchUnescaped) { 300 299 *dst = '\0'; 301 ret = S_OK;300 ret = S_OK; 302 301 } else { 303 302 needed++; /* add one for the '\0' */ 304 ret = E_POINTER;303 ret = E_POINTER; 305 304 } 306 305 if(!(dwFlags & URL_UNESCAPE_INPLACE)) … … 311 310 312 311 /************************************************************************* 313 * UrlUnescapeW [SHLWAPI]312 * UrlUnescapeW [SHLWAPI] 314 313 */ 315 314 HRESULT WINAPI UrlUnescapeW( 316 LPCWSTR pszUrl,317 LPWSTR pszUnescaped,318 LPDWORD pcchUnescaped,319 DWORD dwFlags)315 LPCWSTR pszUrl, 316 LPWSTR pszUnescaped, 317 LPDWORD pcchUnescaped, 318 DWORD dwFlags) 320 319 { 321 320 FIXME("(%s, %p, %p, %08lx): stub\n", debugstr_w(pszUrl), pszUnescaped, 322 pcchUnescaped, dwFlags);321 pcchUnescaped, dwFlags); 323 322 return E_NOTIMPL; 324 323 } 325 324 326 325 /************************************************************************* 327 * HashData [SHLWAPI]326 * HashData [SHLWAPI] 328 327 * 329 328 * Hash an input block into a variable sized digest. … … 358 357 359 358 /************************************************************************* 360 * UrlHashA [SHLWAPI]359 * UrlHashA [SHLWAPI] 361 360 * 362 361 * Hash an ASCII URL. … … 372 371 373 372 /************************************************************************* 374 * UrlApplySchemeW [SHLWAPI.@]373 * UrlApplySchemeW [SHLWAPI.@] 375 374 */ 376 375 HRESULT WINAPI UrlApplySchemeW(LPCWSTR pszIn, LPWSTR pszOut, LPDWORD pcchOut, DWORD dwFlags) -
trunk/src/wininet/http.c
r6640 r6712 1 /* $Id: http.c,v 1.3 2001-09-05 10:31:45 bird Exp $ 2 * 1 /* 3 2 * Wininet - Http Implementation 4 3 * -
trunk/src/wininet/wininet_main.c
r6640 r6712 1 /* $Id: wininet_main.c,v 1.2 2001-09-05 10:31:47 bird Exp $ 2 * 1 /* 3 2 * WinInet 4 3 * … … 15 14 16 15 /*********************************************************************** 17 * WININET_DllInstall (WININET.@)16 * WININET_DllInstall (WININET.@) 18 17 */ 19 18 HRESULT WINAPI WININET_DllInstall(BOOL bInstall, LPCWSTR cmdline) 20 19 { 21 FIXME("(%s, %s): stub\n", bInstall?"TRUE":"FALSE", 22 debugstr_w(cmdline));20 FIXME("(%s, %s): stub\n", bInstall?"TRUE":"FALSE", 21 debugstr_w(cmdline)); 23 22 24 23 return S_OK; -
trunk/src/winmm/driver.c
r6639 r6712 1 1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */ 2 2 3 /* $Id: driver.c,v 1.2 2001-09-05 10:30:21 bird Exp $ 4 * 3 /* 5 4 * WINE Drivers functions 6 5 * … … 33 32 DEFAULT_DEBUG_CHANNEL(driver); 34 33 35 static LPWINE_DRIVER lpDrvItemList = NULL;34 static LPWINE_DRIVER lpDrvItemList = NULL; 36 35 37 36 /* TODO list : 38 * - LoadModule count and clean up is not handled correctly (it's not a39 * problem as long as FreeLibrary is not working correctly)40 */ 41 42 /************************************************************************** 43 * DRIVER_GetNumberOfModuleRefs[internal]37 * - LoadModule count and clean up is not handled correctly (it's not a 38 * problem as long as FreeLibrary is not working correctly) 39 */ 40 41 /************************************************************************** 42 * DRIVER_GetNumberOfModuleRefs [internal] 44 43 * 45 44 * Returns the number of open drivers which share the same module. 46 45 */ 47 static WORDDRIVER_GetNumberOfModuleRefs(LPWINE_DRIVER lpNewDrv)48 { 49 LPWINE_DRIVER lpDrv;50 WORD count = 0;46 static WORD DRIVER_GetNumberOfModuleRefs(LPWINE_DRIVER lpNewDrv) 47 { 48 LPWINE_DRIVER lpDrv; 49 WORD count = 0; 51 50 52 51 if (lpNewDrv->dwFlags & WINE_GDF_16BIT) ERR("OOOch"); 53 52 for (lpDrv = lpDrvItemList; lpDrv; lpDrv = lpDrv->lpNextItem) { 54 if (!(lpDrv->dwFlags & WINE_GDF_16BIT) &&55 lpDrv->d.d32.hModule == lpNewDrv->d.d32.hModule) {56 count++;57 }53 if (!(lpDrv->dwFlags & WINE_GDF_16BIT) && 54 lpDrv->d.d32.hModule == lpNewDrv->d.d32.hModule) { 55 count++; 56 } 58 57 } 59 58 return count; … … 61 60 62 61 /************************************************************************** 63 * DRIVER_FindFromHDrvr[internal]64 * 62 * DRIVER_FindFromHDrvr [internal] 63 * 65 64 * From a hDrvr being 32 bits, returns the WINE internal structure. 66 65 */ 67 LPWINE_DRIVER DRIVER_FindFromHDrvr(HDRVR hDrvr)68 { 69 LPWINE_DRIVER d = (LPWINE_DRIVER)hDrvr;66 LPWINE_DRIVER DRIVER_FindFromHDrvr(HDRVR hDrvr) 67 { 68 LPWINE_DRIVER d = (LPWINE_DRIVER)hDrvr; 70 69 71 70 if (hDrvr && HeapValidate(GetProcessHeap(), 0, d) && d->dwMagic == WINE_DI_MAGIC) { 72 return d;71 return d; 73 72 } 74 73 return NULL; … … 77 76 #ifndef __WIN32OS2__ 78 77 /************************************************************************** 79 * DRIVER_MapMsg32To16[internal]78 * DRIVER_MapMsg32To16 [internal] 80 79 * 81 80 * Map a 32 bit driver message to a 16 bit driver message. … … 87 86 static int DRIVER_MapMsg32To16(WORD wMsg, DWORD* lParam1, DWORD* lParam2) 88 87 { 89 int ret = -1;90 88 int ret = -1; 89 91 90 switch (wMsg) { 92 91 case DRV_LOAD: … … 97 96 case DRV_REMOVE: 98 97 case DRV_EXITSESSION: 99 case DRV_EXITAPPLICATION: 98 case DRV_EXITAPPLICATION: 100 99 case DRV_POWER: 101 case DRV_CLOSE: /* should be 0/0 */102 case DRV_OPEN: /* pass thru */103 /* lParam1 and lParam2 are not used */104 ret = 0;105 break;106 break;100 case DRV_CLOSE: /* should be 0/0 */ 101 case DRV_OPEN: /* pass thru */ 102 /* lParam1 and lParam2 are not used */ 103 ret = 0; 104 break; 105 break; 107 106 case DRV_CONFIGURE: 108 107 case DRV_INSTALL: 109 /* lParam1 is a handle to a window (conf) or to a driver (inst) or not used, 110 * lParam2 is a pointer to DRVCONFIGINFO 111 */112 if (*lParam2) {113 LPDRVCONFIGINFO16 dci16 = (LPDRVCONFIGINFO16)SEGPTR_ALLOC(sizeof(DRVCONFIGINFO16));114 LPDRVCONFIGINFO dci32 = (LPDRVCONFIGINFO)(*lParam2);115 116 if (dci16) {117 LPSTRstr1, str2;118 119 dci16->dwDCISize = sizeof(DRVCONFIGINFO16);120 121 if ((str1 = HEAP_strdupWtoA(GetProcessHeap(), 0, dci32->lpszDCISectionName)) != NULL &&122 (str2 = SEGPTR_STRDUP(str1)) != NULL) {123 dci16->lpszDCISectionName = SEGPTR_GET(str2);124 if (!HeapFree(GetProcessHeap(), 0, str1))125 FIXME("bad free line=%d\n", __LINE__);126 } else {127 return -2;128 }129 if ((str1 = HEAP_strdupWtoA(GetProcessHeap(), 0, dci32->lpszDCIAliasName)) != NULL &&130 (str2 = SEGPTR_STRDUP(str1)) != NULL) {131 dci16->lpszDCIAliasName = SEGPTR_GET(str2);132 if (!HeapFree(GetProcessHeap(), 0, str1))133 FIXME("bad free line=%d\n", __LINE__);134 } else {135 return -2;136 }137 } else {138 return -2;139 }140 *lParam2 = (LPARAM)SEGPTR_GET(dci16);141 ret = 1;142 } else {143 ret = 0;144 }145 break;108 /* lParam1 is a handle to a window (conf) or to a driver (inst) or not used, 109 * lParam2 is a pointer to DRVCONFIGINFO 110 */ 111 if (*lParam2) { 112 LPDRVCONFIGINFO16 dci16 = (LPDRVCONFIGINFO16)SEGPTR_ALLOC(sizeof(DRVCONFIGINFO16)); 113 LPDRVCONFIGINFO dci32 = (LPDRVCONFIGINFO)(*lParam2); 114 115 if (dci16) { 116 LPSTR str1, str2; 117 118 dci16->dwDCISize = sizeof(DRVCONFIGINFO16); 119 120 if ((str1 = HEAP_strdupWtoA(GetProcessHeap(), 0, dci32->lpszDCISectionName)) != NULL && 121 (str2 = SEGPTR_STRDUP(str1)) != NULL) { 122 dci16->lpszDCISectionName = SEGPTR_GET(str2); 123 if (!HeapFree(GetProcessHeap(), 0, str1)) 124 FIXME("bad free line=%d\n", __LINE__); 125 } else { 126 return -2; 127 } 128 if ((str1 = HEAP_strdupWtoA(GetProcessHeap(), 0, dci32->lpszDCIAliasName)) != NULL && 129 (str2 = SEGPTR_STRDUP(str1)) != NULL) { 130 dci16->lpszDCIAliasName = SEGPTR_GET(str2); 131 if (!HeapFree(GetProcessHeap(), 0, str1)) 132 FIXME("bad free line=%d\n", __LINE__); 133 } else { 134 return -2; 135 } 136 } else { 137 return -2; 138 } 139 *lParam2 = (LPARAM)SEGPTR_GET(dci16); 140 ret = 1; 141 } else { 142 ret = 0; 143 } 144 break; 146 145 default: 147 if (!((wMsg >= 0x800 && wMsg < 0x900) || (wMsg >= 0x4000 && wMsg < 0x4100))) {148 FIXME("Unknown message 0x%04x\n", wMsg);149 }150 ret = 0;146 if (!((wMsg >= 0x800 && wMsg < 0x900) || (wMsg >= 0x4000 && wMsg < 0x4100))) { 147 FIXME("Unknown message 0x%04x\n", wMsg); 148 } 149 ret = 0; 151 150 } 152 151 return ret; … … 154 153 155 154 /************************************************************************** 156 * DRIVER_UnMapMsg32To16[internal]155 * DRIVER_UnMapMsg32To16 [internal] 157 156 * 158 157 * UnMap a 32 bit driver message to a 16 bit driver message. … … 163 162 static int DRIVER_UnMapMsg32To16(WORD wMsg, DWORD lParam1, DWORD lParam2) 164 163 { 165 int ret = -1;166 164 int ret = -1; 165 167 166 switch (wMsg) { 168 167 case DRV_LOAD: … … 177 176 case DRV_OPEN: 178 177 case DRV_CLOSE: 179 /* lParam1 and lParam2 are not used */180 break;181 case DRV_CONFIGURE: 178 /* lParam1 and lParam2 are not used */ 179 break; 180 case DRV_CONFIGURE: 182 181 case DRV_INSTALL: 183 /* lParam1 is a handle to a window (or not used), lParam2 is a pointer to DRVCONFIGINFO, lParam2 */184 if (lParam2) {185 LPDRVCONFIGINFO16dci16 = MapSL(lParam2);186 187 if (!SEGPTR_FREE(MapSL(dci16->lpszDCISectionName)))188 FIXME("bad free line=%d\n", __LINE__);189 if (!SEGPTR_FREE(MapSL(dci16->lpszDCIAliasName)))190 FIXME("bad free line=%d\n", __LINE__);191 if (!SEGPTR_FREE(dci16))192 FIXME("bad free line=%d\n", __LINE__);193 }194 ret = 0;195 break;182 /* lParam1 is a handle to a window (or not used), lParam2 is a pointer to DRVCONFIGINFO, lParam2 */ 183 if (lParam2) { 184 LPDRVCONFIGINFO16 dci16 = MapSL(lParam2); 185 186 if (!SEGPTR_FREE(MapSL(dci16->lpszDCISectionName))) 187 FIXME("bad free line=%d\n", __LINE__); 188 if (!SEGPTR_FREE(MapSL(dci16->lpszDCIAliasName))) 189 FIXME("bad free line=%d\n", __LINE__); 190 if (!SEGPTR_FREE(dci16)) 191 FIXME("bad free line=%d\n", __LINE__); 192 } 193 ret = 0; 194 break; 196 195 default: 197 if (!((wMsg >= 0x800 && wMsg < 0x900) || (wMsg >= 0x4000 && wMsg < 0x4100))) {198 FIXME("Unknown message 0x%04x\n", wMsg);199 }200 ret = 0;196 if (!((wMsg >= 0x800 && wMsg < 0x900) || (wMsg >= 0x4000 && wMsg < 0x4100))) { 197 FIXME("Unknown message 0x%04x\n", wMsg); 198 } 199 ret = 0; 201 200 } 202 201 return ret; … … 205 204 206 205 /************************************************************************** 207 * DRIVER_SendMessage[internal]208 */ 209 static LRESULT inline DRIVER_SendMessage(LPWINE_DRIVER lpDrv, UINT msg, 210 LPARAM lParam1, LPARAM lParam2)206 * DRIVER_SendMessage [internal] 207 */ 208 static LRESULT inline DRIVER_SendMessage(LPWINE_DRIVER lpDrv, UINT msg, 209 LPARAM lParam1, LPARAM lParam2) 211 210 { 212 211 #ifndef __WIN32OS2__ 213 212 if (lpDrv->dwFlags & WINE_GDF_16BIT) { 214 LRESULT ret; 215 int map = 0; 216 TRACE("Before sdm16 call hDrv=%04x wMsg=%04x p1=%08lx p2=%08lx\n", 217 lpDrv->d.d16.hDriver16, msg, lParam1, lParam2); 218 219 if ((map = DRIVER_MapMsg32To16(msg, &lParam1, &lParam2)) >= 0) { 220 ret = SendDriverMessage16(lpDrv->d.d16.hDriver16, msg, lParam1, lParam2); 221 if (map == 1) 222 DRIVER_UnMapMsg32To16(msg, lParam1, lParam2); 213 LRESULT ret; 214 int map = 0; 215 TRACE("Before sdm16 call hDrv=%04x wMsg=%04x p1=%08lx p2=%08lx\n", 216 lpDrv->d.d16.hDriver16, msg, lParam1, lParam2); 217 218 if ((map = DRIVER_MapMsg32To16(msg, &lParam1, &lParam2)) >= 0) { 219 ret = SendDriverMessage16(lpDrv->d.d16.hDriver16, msg, lParam1, lParam2); 220 if (map == 1) 221 DRIVER_UnMapMsg32To16(msg, lParam1, lParam2); 222 } else { 223 ret = 0; 224 } 225 return ret; 226 } 227 #endif 228 TRACE("Before func32 call proc=%p driverID=%08lx hDrv=%08x wMsg=%04x p1=%08lx p2=%08lx\n", 229 lpDrv->d.d32.lpDrvProc, lpDrv->d.d32.dwDriverID, (HDRVR)lpDrv, msg, lParam1, lParam2); 230 return lpDrv->d.d32.lpDrvProc(lpDrv->d.d32.dwDriverID, (HDRVR)lpDrv, msg, lParam1, lParam2); 231 } 232 233 /************************************************************************** 234 * SendDriverMessage [WINMM.19] 235 */ 236 LRESULT WINAPI SendDriverMessage(HDRVR hDriver, UINT msg, LPARAM lParam1, 237 LPARAM lParam2) 238 { 239 LPWINE_DRIVER lpDrv; 240 LRESULT retval = 0; 241 242 TRACE("(%04x, %04X, %08lX, %08lX)\n", hDriver, msg, lParam1, lParam2); 243 244 if ((lpDrv = DRIVER_FindFromHDrvr(hDriver)) != NULL) { 245 retval = DRIVER_SendMessage(lpDrv, msg, lParam1, lParam2); 223 246 } else { 224 ret = 0; 225 } 226 return ret; 227 } 228 #endif 229 TRACE("Before func32 call proc=%p driverID=%08lx hDrv=%08x wMsg=%04x p1=%08lx p2=%08lx\n", 230 lpDrv->d.d32.lpDrvProc, lpDrv->d.d32.dwDriverID, (HDRVR)lpDrv, msg, lParam1, lParam2); 231 return lpDrv->d.d32.lpDrvProc(lpDrv->d.d32.dwDriverID, (HDRVR)lpDrv, msg, lParam1, lParam2); 232 } 233 234 /************************************************************************** 235 * SendDriverMessage [WINMM.19] 236 */ 237 LRESULT WINAPI SendDriverMessage(HDRVR hDriver, UINT msg, LPARAM lParam1, 238 LPARAM lParam2) 239 { 240 LPWINE_DRIVER lpDrv; 241 LRESULT retval = 0; 242 243 TRACE("(%04x, %04X, %08lX, %08lX)\n", hDriver, msg, lParam1, lParam2); 244 245 if ((lpDrv = DRIVER_FindFromHDrvr(hDriver)) != NULL) { 246 retval = DRIVER_SendMessage(lpDrv, msg, lParam1, lParam2); 247 } else { 248 WARN("Bad driver handle %u\n", hDriver); 247 WARN("Bad driver handle %u\n", hDriver); 249 248 } 250 249 TRACE("retval = %ld\n", retval); 251 250 252 251 return retval; 253 252 } 254 253 255 254 /************************************************************************** 256 * DRIVER_RemoveFromList[internal]255 * DRIVER_RemoveFromList [internal] 257 256 * 258 257 * Generates all the logic to handle driver closure / deletion 259 258 * Removes a driver struct to the list of open drivers. 260 259 */ 261 static BOOLDRIVER_RemoveFromList(LPWINE_DRIVER lpDrv)260 static BOOL DRIVER_RemoveFromList(LPWINE_DRIVER lpDrv) 262 261 { 263 262 if (!(lpDrv->dwFlags & WINE_GDF_16BIT)) { 264 if (DRIVER_GetNumberOfModuleRefs(lpDrv) == 1) {265 DRIVER_SendMessage(lpDrv, DRV_DISABLE, 0L, 0L);266 DRIVER_SendMessage(lpDrv, DRV_FREE, 0L, 0L);267 }268 } 269 263 if (DRIVER_GetNumberOfModuleRefs(lpDrv) == 1) { 264 DRIVER_SendMessage(lpDrv, DRV_DISABLE, 0L, 0L); 265 DRIVER_SendMessage(lpDrv, DRV_FREE, 0L, 0L); 266 } 267 } 268 270 269 if (lpDrv->lpPrevItem) 271 lpDrv->lpPrevItem->lpNextItem = lpDrv->lpNextItem;270 lpDrv->lpPrevItem->lpNextItem = lpDrv->lpNextItem; 272 271 else 273 lpDrvItemList = lpDrv->lpNextItem;272 lpDrvItemList = lpDrv->lpNextItem; 274 273 if (lpDrv->lpNextItem) 275 lpDrv->lpNextItem->lpPrevItem = lpDrv->lpPrevItem;274 lpDrv->lpNextItem->lpPrevItem = lpDrv->lpPrevItem; 276 275 277 276 return TRUE; … … 279 278 280 279 /************************************************************************** 281 * DRIVER_AddToList[internal]280 * DRIVER_AddToList [internal] 282 281 * 283 282 * Adds a driver struct to the list of open drivers. 284 283 * Generates all the logic to handle driver creation / open. 285 284 */ 286 static BOOLDRIVER_AddToList(LPWINE_DRIVER lpNewDrv, LPARAM lParam1, LPARAM lParam2)285 static BOOL DRIVER_AddToList(LPWINE_DRIVER lpNewDrv, LPARAM lParam1, LPARAM lParam2) 287 286 { 288 287 lpNewDrv->dwMagic = WINE_DI_MAGIC; 289 288 /* First driver to be loaded for this module, need to load correctly the module */ 290 289 if (!(lpNewDrv->dwFlags & WINE_GDF_16BIT)) { 291 if (DRIVER_GetNumberOfModuleRefs(lpNewDrv) == 0) {292 if (DRIVER_SendMessage(lpNewDrv, DRV_LOAD, 0L, 0L) != DRV_SUCCESS) {293 TRACE("DRV_LOAD failed on driver 0x%08lx\n", (DWORD)lpNewDrv);294 return FALSE;295 }296 /* returned value is not checked */297 DRIVER_SendMessage(lpNewDrv, DRV_ENABLE, 0L, 0L);298 }290 if (DRIVER_GetNumberOfModuleRefs(lpNewDrv) == 0) { 291 if (DRIVER_SendMessage(lpNewDrv, DRV_LOAD, 0L, 0L) != DRV_SUCCESS) { 292 TRACE("DRV_LOAD failed on driver 0x%08lx\n", (DWORD)lpNewDrv); 293 return FALSE; 294 } 295 /* returned value is not checked */ 296 DRIVER_SendMessage(lpNewDrv, DRV_ENABLE, 0L, 0L); 297 } 299 298 } 300 299 301 300 lpNewDrv->lpNextItem = NULL; 302 301 if (lpDrvItemList == NULL) { 303 lpDrvItemList = lpNewDrv;304 lpNewDrv->lpPrevItem = NULL;302 lpDrvItemList = lpNewDrv; 303 lpNewDrv->lpPrevItem = NULL; 305 304 } else { 306 LPWINE_DRIVER lpDrv = lpDrvItemList;/* find end of list */307 while (lpDrv->lpNextItem != NULL)308 lpDrv = lpDrv->lpNextItem;309 310 lpDrv->lpNextItem = lpNewDrv;311 lpNewDrv->lpPrevItem = lpDrv;305 LPWINE_DRIVER lpDrv = lpDrvItemList; /* find end of list */ 306 while (lpDrv->lpNextItem != NULL) 307 lpDrv = lpDrv->lpNextItem; 308 309 lpDrv->lpNextItem = lpNewDrv; 310 lpNewDrv->lpPrevItem = lpDrv; 312 311 } 313 312 314 313 if (!(lpNewDrv->dwFlags & WINE_GDF_16BIT)) { 315 /* Now just open a new instance of a driver on this module */316 lpNewDrv->d.d32.dwDriverID = DRIVER_SendMessage(lpNewDrv, DRV_OPEN, lParam1, lParam2);317 318 if (lpNewDrv->d.d32.dwDriverID == 0) {319 TRACE("DRV_OPEN failed on driver 0x%08lx\n", (DWORD)lpNewDrv);320 DRIVER_RemoveFromList(lpNewDrv);321 return FALSE;322 }314 /* Now just open a new instance of a driver on this module */ 315 lpNewDrv->d.d32.dwDriverID = DRIVER_SendMessage(lpNewDrv, DRV_OPEN, lParam1, lParam2); 316 317 if (lpNewDrv->d.d32.dwDriverID == 0) { 318 TRACE("DRV_OPEN failed on driver 0x%08lx\n", (DWORD)lpNewDrv); 319 DRIVER_RemoveFromList(lpNewDrv); 320 return FALSE; 321 } 323 322 } 324 323 return TRUE; … … 326 325 327 326 /************************************************************************** 328 * DRIVER_GetLibName[internal]329 * 330 */ 331 BOOL DRIVER_GetLibName(LPCSTR keyName, LPCSTR sectName, LPSTR buf, int sz)327 * DRIVER_GetLibName [internal] 328 * 329 */ 330 BOOL DRIVER_GetLibName(LPCSTR keyName, LPCSTR sectName, LPSTR buf, int sz) 332 331 { 333 332 /* should also do some registry diving */ … … 336 335 337 336 /************************************************************************** 338 * DRIVER_TryOpenDriver32[internal]337 * DRIVER_TryOpenDriver32 [internal] 339 338 * 340 339 * Tries to load a 32 bit driver whose DLL's (module) name is fn 341 340 */ 342 LPWINE_DRIVER DRIVER_TryOpenDriver32(LPCSTR fn, LPARAM lParam2)343 { 344 LPWINE_DRIVER lpDrv = NULL;345 HMODULE hModule = 0;346 LPSTR ptr;347 LPCSTR cause = 0;341 LPWINE_DRIVER DRIVER_TryOpenDriver32(LPCSTR fn, LPARAM lParam2) 342 { 343 LPWINE_DRIVER lpDrv = NULL; 344 HMODULE hModule = 0; 345 LPSTR ptr; 346 LPCSTR cause = 0; 348 347 349 348 TRACE("('%s', %08lX);\n", fn, lParam2); 350 349 351 350 if ((ptr = strchr(fn, ' ')) != NULL) { 352 *ptr++ = '\0';353 while (*ptr == ' ') ptr++;354 if (*ptr == '\0') ptr = NULL;351 *ptr++ = '\0'; 352 while (*ptr == ' ') ptr++; 353 if (*ptr == '\0') ptr = NULL; 355 354 } 356 355 … … 379 378 #ifdef __WIN32OS2__ 380 379 /************************************************************************** 381 * DRIVER_OpenDriverA[internal]380 * DRIVER_OpenDriverA [internal] 382 381 * (0,1,DRV_LOAD ,0 ,0) 383 382 * (0,1,DRV_ENABLE,0 ,0) … … 385 384 * 386 385 */ 387 static LPWINE_DRIVERDRIVER_TryOpenDriver16(LPCSTR lpDriverName, LPCSTR lpSectionName, LPARAM lParam)386 static LPWINE_DRIVER DRIVER_TryOpenDriver16(LPCSTR lpDriverName, LPCSTR lpSectionName, LPARAM lParam) 388 387 { 389 388 LPWINE_DRIVER lpDrv = NULL; 390 char drvName[128];389 char drvName[128]; 391 390 LPCSTR cause = 0; 392 391 393 392 TRACE("Entering DRIVER_OpenDriverA: lpDriverName: %s lpSectionName: %s\n",lpDriverName,lpSectionName); 394 393 … … 397 396 398 397 if (lpSectionName == NULL) { 399 lstrcpynA(drvName, lpDriverName, sizeof(drvName));400 lpDrv = DRIVER_TryOpenDriver32(lpDriverName, lParam);401 if (!lpDrv) {398 lstrcpynA(drvName, lpDriverName, sizeof(drvName)); 399 lpDrv = DRIVER_TryOpenDriver32(lpDriverName, lParam); 400 if (!lpDrv) { 402 401 if (GetPrivateProfileStringA("Drivers32", lpDriverName, "", drvName, 403 402 sizeof(drvName), "SYSTEM.INI")) { 404 403 405 lpDrv = DRIVER_TryOpenDriver32(drvName, lParam); 404 lpDrv = DRIVER_TryOpenDriver32(drvName, lParam); 406 405 } 407 }406 } 408 407 } else {/* of if (lpSectionName == NULL) */ 409 408 //dprintf(("driver name %x '%s'\n",drvName,drvName)); 410 drvName[0]=0; 411 412 if (GetPrivateProfileStringA(lpSectionName, lpDriverName, "", drvName,409 drvName[0]=0; 410 411 if (GetPrivateProfileStringA(lpSectionName, lpDriverName, "", drvName, 413 412 sizeof(drvName)-1, "SYSTEM.INI")) { 414 413 #if 0 415 414 dprintf(("driver name %x '%s'\n",drvName,drvName)); 416 #endif 415 #endif 417 416 lpDrv = DRIVER_TryOpenDriver32(drvName, lParam); 418 }/* GetPrivate... */417 }/* GetPrivate... */ 419 418 } 420 419 if (!lpDrv) 421 TRACE("OpenDriverA: Failed to open driver %s from section %s\n", lpDriverName, lpSectionName);422 423 else 424 TRACE("OpenDriverA success: Driver handle => %08x\n", lpDrv);420 TRACE("OpenDriverA: Failed to open driver %s from section %s\n", lpDriverName, lpSectionName); 421 422 else 423 TRACE("OpenDriverA success: Driver handle => %08x\n", lpDrv); 425 424 426 425 return lpDrv; … … 433 432 #else 434 433 /************************************************************************** 435 * DRIVER_TryOpenDriver16[internal]434 * DRIVER_TryOpenDriver16 [internal] 436 435 * 437 436 * Tries to load a 16 bit driver whose DLL's (module) name is lpFileName. 438 437 */ 439 static LPWINE_DRIVERDRIVER_TryOpenDriver16(LPCSTR fn, LPCSTR sn, LPARAM lParam2)440 { 441 LPWINE_DRIVER lpDrv = NULL;442 LPCSTR cause = 0;438 static LPWINE_DRIVER DRIVER_TryOpenDriver16(LPCSTR fn, LPCSTR sn, LPARAM lParam2) 439 { 440 LPWINE_DRIVER lpDrv = NULL; 441 LPCSTR cause = 0; 443 442 444 443 TRACE("('%s', %08lX);\n", sn, lParam2); 445 444 446 445 lpDrv = HeapAlloc(GetProcessHeap(), 0, sizeof(WINE_DRIVER)); 447 446 if (lpDrv == NULL) {cause = "OOM"; goto exit;} 448 447 449 448 /* FIXME: shall we do some black magic here on sn ? 450 * drivers32 => drivers451 * mci32 => mci449 * drivers32 => drivers 450 * mci32 => mci 452 451 * ... 453 452 */ … … 468 467 469 468 /************************************************************************** 470 * OpenDriverA[WINMM.15]469 * OpenDriverA [WINMM.15] 471 470 * (0,1,DRV_LOAD ,0 ,0) 472 471 * (0,1,DRV_ENABLE,0 ,0) 473 472 * (0,1,DRV_OPEN ,buf[256],0) 474 473 */ 475 HDRVR WINAPI OpenDriverA(LPCSTR lpDriverName, LPCSTR lpSectionName, LPARAM lParam2) 476 { 477 LPWINE_DRIVER lpDrv = NULL;478 char libName[128];479 LPCSTR lsn = lpSectionName;474 HDRVR WINAPI OpenDriverA(LPCSTR lpDriverName, LPCSTR lpSectionName, LPARAM lParam2) 475 { 476 LPWINE_DRIVER lpDrv = NULL; 477 char libName[128]; 478 LPCSTR lsn = lpSectionName; 480 479 481 480 TRACE("(%s, %s, 0x%08lx);\n", debugstr_a(lpDriverName), debugstr_a(lpSectionName), lParam2); 482 481 483 482 if (lsn == NULL) { 484 lstrcpynA(libName, lpDriverName, sizeof(libName));485 486 if ((lpDrv = DRIVER_TryOpenDriver32(libName, lParam2)))487 goto the_end;488 lsn = "Drivers32";483 lstrcpynA(libName, lpDriverName, sizeof(libName)); 484 485 if ((lpDrv = DRIVER_TryOpenDriver32(libName, lParam2))) 486 goto the_end; 487 lsn = "Drivers32"; 489 488 } 490 489 if (DRIVER_GetLibName(lpDriverName, lsn, libName, sizeof(libName)) && 491 (lpDrv = DRIVER_TryOpenDriver32(libName, lParam2)))492 goto the_end;490 (lpDrv = DRIVER_TryOpenDriver32(libName, lParam2))) 491 goto the_end; 493 492 494 493 if (!(lpDrv = DRIVER_TryOpenDriver16(lpDriverName, lpSectionName, lParam2))) 495 TRACE("Failed to open driver %s from system.ini file, section %s\n", lpDriverName, lpSectionName);494 TRACE("Failed to open driver %s from system.ini file, section %s\n", lpDriverName, lpSectionName); 496 495 497 496 the_end: 498 if (lpDrv) TRACE("=> %08lx\n", (DWORD)lpDrv);497 if (lpDrv) TRACE("=> %08lx\n", (DWORD)lpDrv); 499 498 return (DWORD)lpDrv; 500 499 } 501 500 502 501 /************************************************************************** 503 * OpenDriverW[WINMM.15]502 * OpenDriverW [WINMM.15] 504 503 */ 505 504 HDRVR WINAPI OpenDriverW(LPCWSTR lpDriverName, LPCWSTR lpSectionName, LPARAM lParam) 506 505 { 507 LPSTR dn = HEAP_strdupWtoA(GetProcessHeap(), 0, lpDriverName);508 LPSTR sn = HEAP_strdupWtoA(GetProcessHeap(), 0, lpSectionName);509 HDRVR ret = OpenDriverA(dn, sn, lParam);510 506 LPSTR dn = HEAP_strdupWtoA(GetProcessHeap(), 0, lpDriverName); 507 LPSTR sn = HEAP_strdupWtoA(GetProcessHeap(), 0, lpSectionName); 508 HDRVR ret = OpenDriverA(dn, sn, lParam); 509 511 510 if (dn) HeapFree(GetProcessHeap(), 0, dn); 512 511 if (sn) HeapFree(GetProcessHeap(), 0, sn); … … 515 514 516 515 /************************************************************************** 517 * CloseDriver[WINMM.4]516 * CloseDriver [WINMM.4] 518 517 */ 519 518 LRESULT WINAPI CloseDriver(HDRVR hDrvr, LPARAM lParam1, LPARAM lParam2) 520 519 { 521 LPWINE_DRIVER lpDrv;520 LPWINE_DRIVER lpDrv; 522 521 523 522 TRACE("(%04x, %08lX, %08lX);\n", hDrvr, lParam1, lParam2); 524 523 525 524 if ((lpDrv = DRIVER_FindFromHDrvr(hDrvr)) != NULL) { 526 525 #ifndef __WIN32OS2__ 527 if (lpDrv->dwFlags & WINE_GDF_16BIT)528 CloseDriver16(lpDrv->d.d16.hDriver16, lParam1, lParam2);529 else526 if (lpDrv->dwFlags & WINE_GDF_16BIT) 527 CloseDriver16(lpDrv->d.d16.hDriver16, lParam1, lParam2); 528 else 530 529 #endif 531 DRIVER_SendMessage(lpDrv, DRV_CLOSE, lParam1, lParam2);532 if (DRIVER_RemoveFromList(lpDrv)) {533 HeapFree(GetProcessHeap(), 0, lpDrv);534 return TRUE;535 }530 DRIVER_SendMessage(lpDrv, DRV_CLOSE, lParam1, lParam2); 531 if (DRIVER_RemoveFromList(lpDrv)) { 532 HeapFree(GetProcessHeap(), 0, lpDrv); 533 return TRUE; 534 } 536 535 } 537 536 WARN("Failed to close driver\n"); … … 540 539 541 540 /************************************************************************** 542 * GetDriverFlags[WINMM.13]541 * GetDriverFlags [WINMM.13] 543 542 * [in] hDrvr handle to the driver 544 543 * 545 544 * Returns: 546 * 0x00000000 if hDrvr is an invalid handle547 * 0x80000000 if hDrvr is a valid 32 bit driver548 * 0x90000000 if hDrvr is a valid 16 bit driver545 * 0x00000000 if hDrvr is an invalid handle 546 * 0x80000000 if hDrvr is a valid 32 bit driver 547 * 0x90000000 if hDrvr is a valid 16 bit driver 549 548 * 550 549 * native WINMM doesn't return those flags 551 * 0x80000000 for a valid 32 bit driver and that's it552 * (I may have mixed up the two flags :-(553 */ 554 DWORD WINAPI GetDriverFlags(HDRVR hDrvr)555 { 556 LPWINE_DRIVER lpDrv;557 DWORD ret = 0;550 * 0x80000000 for a valid 32 bit driver and that's it 551 * (I may have mixed up the two flags :-( 552 */ 553 DWORD WINAPI GetDriverFlags(HDRVR hDrvr) 554 { 555 LPWINE_DRIVER lpDrv; 556 DWORD ret = 0; 558 557 559 558 TRACE("(%04x)\n", hDrvr); 560 559 561 560 if ((lpDrv = DRIVER_FindFromHDrvr(hDrvr)) != NULL) { 562 ret = WINE_GDF_EXIST | lpDrv->dwFlags;561 ret = WINE_GDF_EXIST | lpDrv->dwFlags; 563 562 } 564 563 return ret; … … 566 565 567 566 /************************************************************************** 568 * GetDriverModuleHandle[WINMM.14]567 * GetDriverModuleHandle [WINMM.14] 569 568 */ 570 569 HMODULE WINAPI GetDriverModuleHandle(HDRVR hDrvr) 571 570 { 572 LPWINE_DRIVER lpDrv;573 HMODULE hModule = 0;574 571 LPWINE_DRIVER lpDrv; 572 HMODULE hModule = 0; 573 575 574 TRACE("(%04x);\n", hDrvr); 576 575 577 576 if ((lpDrv = DRIVER_FindFromHDrvr(hDrvr)) != NULL) { 578 if (!(lpDrv->dwFlags & WINE_GDF_16BIT))579 hModule = lpDrv->d.d32.hModule;577 if (!(lpDrv->dwFlags & WINE_GDF_16BIT)) 578 hModule = lpDrv->d.d32.hModule; 580 579 } 581 580 TRACE("=> %04x\n", hModule); … … 585 584 #ifndef __WIN32OS2__ 586 585 /************************************************************************** 587 * DrvOpen[MMSYSTEM.1100]586 * DrvOpen [MMSYSTEM.1100] 588 587 */ 589 588 HDRVR16 WINAPI DrvOpen16(LPSTR lpDriverName, LPSTR lpSectionName, LPARAM lParam) … … 593 592 594 593 /************************************************************************** 595 * DrvClose[MMSYSTEM.1101]594 * DrvClose [MMSYSTEM.1101] 596 595 */ 597 596 LRESULT WINAPI DrvClose16(HDRVR16 hDrv, LPARAM lParam1, LPARAM lParam2) … … 601 600 602 601 /************************************************************************** 603 * DrvSendMessage[MMSYSTEM.1102]602 * DrvSendMessage [MMSYSTEM.1102] 604 603 */ 605 604 LRESULT WINAPI DrvSendMessage16(HDRVR16 hDrv, WORD msg, LPARAM lParam1, 606 LPARAM lParam2)605 LPARAM lParam2) 607 606 { 608 607 return SendDriverMessage16(hDrv, msg, lParam1, lParam2); … … 610 609 611 610 /************************************************************************** 612 * DrvGetModuleHandle[MMSYSTEM.1103]611 * DrvGetModuleHandle [MMSYSTEM.1103] 613 612 */ 614 613 HANDLE16 WINAPI DrvGetModuleHandle16(HDRVR16 hDrv) … … 618 617 619 618 /************************************************************************** 620 * DrvDefDriverProc[MMSYSTEM.1104]621 */ 622 LRESULT WINAPI DrvDefDriverProc16(DWORD dwDriverID, HDRVR16 hDrv, WORD wMsg, 623 DWORD dwParam1, DWORD dwParam2)619 * DrvDefDriverProc [MMSYSTEM.1104] 620 */ 621 LRESULT WINAPI DrvDefDriverProc16(DWORD dwDriverID, HDRVR16 hDrv, WORD wMsg, 622 DWORD dwParam1, DWORD dwParam2) 624 623 { 625 624 return DefDriverProc16(dwDriverID, hDrv, wMsg, dwParam1, dwParam2); … … 628 627 629 628 /************************************************************************** 630 * DefDriverProc[WINMM.5]629 * DefDriverProc [WINMM.5] 631 630 */ 632 631 LRESULT WINAPI DefDriverProc(DWORD dwDriverIdentifier, HDRVR hDrv, 633 UINT Msg, LPARAM lParam1, LPARAM lParam2)632 UINT Msg, LPARAM lParam1, LPARAM lParam2) 634 633 { 635 634 switch (Msg) { … … 649 648 #ifndef __WIN32OS2__ 650 649 /************************************************************************** 651 * DriverProc[MMSYSTEM.6]652 */ 653 LRESULT WINAPI DriverProc16(DWORD dwDevID, HDRVR16 hDrv, WORD wMsg, 654 DWORD dwParam1, DWORD dwParam2)650 * DriverProc [MMSYSTEM.6] 651 */ 652 LRESULT WINAPI DriverProc16(DWORD dwDevID, HDRVR16 hDrv, WORD wMsg, 653 DWORD dwParam1, DWORD dwParam2) 655 654 { 656 655 TRACE("dwDevID=%08lx hDrv=%04x wMsg=%04x dwParam1=%08lx dwParam2=%08lx\n", 657 dwDevID, hDrv, wMsg, dwParam1, dwParam2);656 dwDevID, hDrv, wMsg, dwParam1, dwParam2); 658 657 659 658 return DrvDefDriverProc16(dwDevID, hDrv, wMsg, dwParam1, dwParam2); … … 663 662 #ifdef __WIN32OS2__ 664 663 /************************************************************************** 665 * DriverCallback[MMSYSTEM.31]666 */ 667 BOOL WINAPI DriverCallback(DWORD dwCallBack, UINT uFlags, HDRVR hDev, 668 UINT wMsg, DWORD dwUser, DWORD dwParam1, 669 DWORD dwParam2)664 * DriverCallback [MMSYSTEM.31] 665 */ 666 BOOL WINAPI DriverCallback(DWORD dwCallBack, UINT uFlags, HDRVR hDev, 667 UINT wMsg, DWORD dwUser, DWORD dwParam1, 668 DWORD dwParam2) 670 669 { 671 670 TRACE("DriverCallback (%08lX, %04X, %04X, %04X, %08lX, %08lX, %08lX); !\n", 672 dwCallBack, uFlags, hDev, wMsg, dwUser, dwParam1, dwParam2);671 dwCallBack, uFlags, hDev, wMsg, dwUser, dwParam1, dwParam2); 673 672 674 673 switch (uFlags & DCB_TYPEMASK) { 675 674 case DCB_NULL: 676 TRACE("Null !\n");677 if (dwCallBack)678 WARN("uFlags=%04X has null DCB value, but dwCallBack=%08lX is not null !\n", uFlags, dwCallBack);679 break;675 TRACE("Null !\n"); 676 if (dwCallBack) 677 WARN("uFlags=%04X has null DCB value, but dwCallBack=%08lX is not null !\n", uFlags, dwCallBack); 678 break; 680 679 case DCB_WINDOW: 681 TRACE("Window(%04lX) handle=%04X!\n", dwCallBack, hDev);682 if (!IsWindow(dwCallBack))683 return FALSE;684 PostMessageA((HWND)dwCallBack, wMsg, hDev, dwParam1);685 break;680 TRACE("Window(%04lX) handle=%04X!\n", dwCallBack, hDev); 681 if (!IsWindow(dwCallBack)) 682 return FALSE; 683 PostMessageA((HWND)dwCallBack, wMsg, hDev, dwParam1); 684 break; 686 685 case DCB_TASK: /* aka DCB_THREAD */ 687 TRACE("Task(%04lx) !\n", dwCallBack);688 PostThreadMessageA(dwCallBack, wMsg, hDev, dwParam1);689 break;686 TRACE("Task(%04lx) !\n", dwCallBack); 687 PostThreadMessageA(dwCallBack, wMsg, hDev, dwParam1); 688 break; 690 689 case DCB_FUNCTION: 691 TRACE("Function (32 bit) !\n");692 ((LPDRVCALLBACK)dwCallBack)(hDev, wMsg, dwUser, dwParam1, dwParam2);693 break;690 TRACE("Function (32 bit) !\n"); 691 ((LPDRVCALLBACK)dwCallBack)(hDev, wMsg, dwUser, dwParam1, dwParam2); 692 break; 694 693 case DCB_EVENT: 695 TRACE("Event(%08lx) !\n", dwCallBack);696 SetEvent((HANDLE)dwCallBack);697 break;694 TRACE("Event(%08lx) !\n", dwCallBack); 695 SetEvent((HANDLE)dwCallBack); 696 break; 698 697 case 6: /* I would dub it DCB_MMTHREADSIGNAL */ 699 /* this is an undocumented DCB_ value used for mmThreads700 * loword of dwCallBack contains the handle of the lpMMThd block701 * which dwSignalCount has to be incremented702 */703 {698 /* this is an undocumented DCB_ value used for mmThreads 699 * loword of dwCallBack contains the handle of the lpMMThd block 700 * which dwSignalCount has to be incremented 701 */ 702 { 704 703 #ifdef __WIN32OS2__ 705 WINE_MMTHREAD*lpMMThd = (WINE_MMTHREAD*)dwCallBack;704 WINE_MMTHREAD* lpMMThd = (WINE_MMTHREAD*)dwCallBack; 706 705 #else 707 WINE_MMTHREAD*lpMMThd = MapSL( MAKESEGPTR(LOWORD(dwCallBack), 0) );706 WINE_MMTHREAD* lpMMThd = MapSL( MAKESEGPTR(LOWORD(dwCallBack), 0) ); 708 707 #endif 709 708 710 TRACE("mmThread (%04x, %p) !\n", LOWORD(dwCallBack), lpMMThd);711 /* same as mmThreadSignal16 */712 InterlockedIncrement(&lpMMThd->dwSignalCount);713 SetEvent(lpMMThd->hEvent);714 /* some other stuff on lpMMThd->hVxD */715 }716 break; 709 TRACE("mmThread (%04x, %p) !\n", LOWORD(dwCallBack), lpMMThd); 710 /* same as mmThreadSignal16 */ 711 InterlockedIncrement(&lpMMThd->dwSignalCount); 712 SetEvent(lpMMThd->hEvent); 713 /* some other stuff on lpMMThd->hVxD */ 714 } 715 break; 717 716 #if 0 718 717 case 4: 719 /* this is an undocumented DCB_ value for... I don't know */720 break;718 /* this is an undocumented DCB_ value for... I don't know */ 719 break; 721 720 #endif 722 721 default: 723 WARN("Unknown callback type %d\n", uFlags & DCB_TYPEMASK);724 return FALSE;722 WARN("Unknown callback type %d\n", uFlags & DCB_TYPEMASK); 723 return FALSE; 725 724 } 726 725 TRACE("Done\n");
Note:
See TracChangeset
for help on using the changeset viewer.
