mirror of
https://github.com/reactos/reactos.git
synced 2025-05-19 00:54:18 +00:00
sync with trunk r46493
svn path=/branches/reactos-yarotows/; revision=46494
This commit is contained in:
commit
b6edb50eb1
332 changed files with 14268 additions and 9807 deletions
|
@ -42,6 +42,9 @@
|
|||
<linkerflag>-section-alignment=0x1000</linkerflag>
|
||||
<linkerflag>--unique=.eh_frame</linkerflag>
|
||||
<linkerflag>-static</linkerflag>
|
||||
<linkerflag>-fno-leading-underscore</linkerflag>
|
||||
<linkerflag>-shared</linkerflag>
|
||||
<linkerflag>--exclude-all-symbols</linkerflag>
|
||||
</group>
|
||||
|
||||
<if property="USERMODE" value="1">
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
<compilerflag>-mpreferred-stack-boundary=2</compilerflag>
|
||||
<compilerflag compiler="midl">-m32 --win32</compilerflag>
|
||||
<compilerflag compiler="cc,cxx">-gstabs+</compilerflag>
|
||||
<compilerflag compiler="cc,cxx">-fno-set-stack-executable</compilerflag>
|
||||
<compilerflag compiler="cc,cxx">-fno-optimize-sibling-calls</compilerflag>
|
||||
<compilerflag compiler="as">-gstabs+</compilerflag>
|
||||
</group>
|
||||
|
||||
|
|
|
@ -42,4 +42,9 @@
|
|||
// THIS WILL MAKE THE PROGRAM USE THE COMMON CONTROLS
|
||||
// LIBRARY VERSION 6.0 (IF IT IS AVAILABLE)
|
||||
//
|
||||
#ifdef _AMD64_
|
||||
1 24 "paint.exe.amd64.manifest"
|
||||
#elif _X86_
|
||||
1 24 "paint.exe.manifest"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
[Section]
|
||||
Name = Mozilla Firefox 3.0
|
||||
Version = 3.0.17
|
||||
Version = 3.0.18
|
||||
Licence = MPL/GPL/LGPL
|
||||
Description = The most popular and one of the best free Web Browsers out there.
|
||||
Size = 7.1M
|
||||
Size = 7.2M
|
||||
Category = 5
|
||||
URLSite = http://www.mozilla.com/en-US/
|
||||
URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/latest-3.0/win32/en-US/Firefox%20Setup%203.0.18.exe
|
||||
|
@ -13,7 +13,7 @@ CDPath = none
|
|||
|
||||
[Section.0407]
|
||||
Description = Der populärste und einer der besten freien Webbrowser.
|
||||
Size = 6.9M
|
||||
Size = 7.0M
|
||||
URLSite = http://www.mozilla-europe.org/de/
|
||||
URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/latest-3.0/win32/de/Firefox%20Setup%203.0.18.exe
|
||||
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
[Section]
|
||||
Name = Miranda IM
|
||||
Version = 0.8.13
|
||||
Version = 0.8.18
|
||||
Licence = GPL
|
||||
Description = Open source multiprotocol instant messaging application - May not work completely.
|
||||
Size = 1.6MB
|
||||
Category = 5
|
||||
URLSite = http://www.miranda-im.org/
|
||||
URLDownload = http://miranda.googlecode.com/files/miranda-im-v0.8.13-unicode.exe
|
||||
URLDownload = http://miranda.googlecode.com/files/miranda-im-v0.8.18-unicode.exe
|
||||
CDPath = none
|
||||
|
||||
[Section.0407]
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
[Section]
|
||||
Name = OpenTTD
|
||||
Version = 0.7.3
|
||||
Version = 0.7.5
|
||||
Licence = GPL v2
|
||||
Description = Open Source clone of the "Transport Tycoon Deluxe" game engine. You need a copy of Transport Tycoon.
|
||||
Size = 2.9MB
|
||||
Category = 4
|
||||
URLSite = http://www.openttd.org/
|
||||
URLDownload = http://ovh.dl.sourceforge.net/sourceforge/openttd/openttd-0.7.3-windows-win32.exe
|
||||
URLDownload = http://binaries.openttd.org/releases/0.7.5/openttd-0.7.5-windows-win32.exe
|
||||
CDPath = none
|
||||
|
||||
[Section.0407]
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
[Section]
|
||||
Name = Opera
|
||||
Version = 10.10
|
||||
Version = 10.51
|
||||
Licence = Freeware
|
||||
Description = The popular Opera Browser with many advanced features and including a Mail and BitTorrent client.
|
||||
Size = 11.0M
|
||||
Category = 5
|
||||
URLSite = http://www.opera.com/
|
||||
URLDownload = http://ftp.opera.com/pub/opera/win/1010/int/Opera_1010_in_Setup.exe
|
||||
URLDownload = http://get4.opera.com/pub/opera/win/1051/int/Opera_1051_int_Setup.exe
|
||||
CDPath = none
|
||||
|
||||
[Section.0407]
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
[Section]
|
||||
Name = Samba TNG
|
||||
Version = 0.4.99cvs
|
||||
Version = 0.5-RC1
|
||||
Licence = GPL
|
||||
Description = This tool allows you to access your Windows shared folders/printers with ReactOS.
|
||||
Size = 1MB
|
||||
Size = 2.1MB
|
||||
Category = 5
|
||||
URLSite = http://samba-tng.org/
|
||||
URLDownload = http://svn.reactos.org/packages/samba-tng.exe
|
||||
|
|
|
@ -2,31 +2,31 @@
|
|||
|
||||
[Section]
|
||||
Name = Mozilla SeaMonkey
|
||||
Version = 2.0.2
|
||||
Version = 2.0.3
|
||||
Licence = MPL/GPL/LGPL
|
||||
Description = Mozilla Suite is alive. This is the one and only Browser, Mail, Chat, and Composer bundle you will ever need.
|
||||
Size = 10.1MB
|
||||
Size = 10.0MB
|
||||
Category = 5
|
||||
URLSite = http://www.seamonkey-project.org/
|
||||
URLDownload = http://ftp.df.lth.se/mozilla/seamonkey/releases/2.0.2/win32/en-US/SeaMonkey%20Setup%202.0.2.exe
|
||||
URLDownload = http://ftp.df.lth.se/mozilla/seamonkey/releases/2.0.3/win32/en-US/SeaMonkey%20Setup%202.0.3.exe
|
||||
CDPath = none
|
||||
|
||||
[Section.0407]
|
||||
Description = Mozilla Suite lebt. Dies ist das einzige Browser-, Mail-, Chat- and Composerwerkzeug-Bundle welches Sie benötigen.
|
||||
Size = 10.0MB
|
||||
URLDownload = http://ftp.df.lth.se/mozilla/seamonkey/releases/2.0.2/win32/de/SeaMonkey%20Setup%202.0.2.exe
|
||||
Size = 10.1MB
|
||||
URLDownload = http://ftp.df.lth.se/mozilla/seamonkey/releases/2.0.3/win32/de/SeaMonkey%20Setup%202.0.3.exe
|
||||
|
||||
[Section.040a]
|
||||
Description = La suite de Mozilla está viva. Es el primero y único navegador web, gestor de correo, lector de noticias, Chat y editor HTML que necesitarás.
|
||||
Size = 10.0MB
|
||||
URLDownload = http://ftp.df.lth.se/mozilla/seamonkey/releases/2.0.2/win32/es-ES/SeaMonkey%20Setup%202.0.2.exe
|
||||
URLDownload = http://ftp.df.lth.se/mozilla/seamonkey/releases/2.0.3/win32/es-ES/SeaMonkey%20Setup%202.0.3.exe
|
||||
|
||||
[Section.0415]
|
||||
Description = Pakiet Mozilla żyje. W zestawie: przeglądarka, klient poczty, IRC oraz Edytor HTML - wszystko, czego potrzebujesz.
|
||||
Size = 10.8MB
|
||||
URLDownload = http://ftp.df.lth.se/mozilla/seamonkey/releases/2.0.2/win32/pl/SeaMonkey%20Setup%202.0.2.exe
|
||||
URLDownload = http://ftp.df.lth.se/mozilla/seamonkey/releases/2.0.3/win32/pl/SeaMonkey%20Setup%202.0.3.exe
|
||||
|
||||
[Section.0419]
|
||||
Description = Продолжение Mozilla Suite. Включает браузер, почтовый клиент, IRC-клиент и HTML-редактор.
|
||||
Size = 10.4MB
|
||||
URLDownload = http://ftp.df.lth.se/mozilla/seamonkey/releases/2.0.2/win32/ru/SeaMonkey%20Setup%202.0.2.exe
|
||||
URLDownload = http://ftp.df.lth.se/mozilla/seamonkey/releases/2.0.3/win32/ru/SeaMonkey%20Setup%202.0.3.exe
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
[Section]
|
||||
Name = SMPlayer
|
||||
Version = 0.6.8
|
||||
Version = 0.6.9
|
||||
Licence = GPL
|
||||
Description = SMPlayer.
|
||||
Size = 13.38MB
|
||||
Size = 14.2MB
|
||||
Category = 1
|
||||
URLSite = http://smplayer.sourceforge.net/
|
||||
URLDownload = http://downloads.sourceforge.net/project/smplayer/SMPlayer/0.6.8/smplayer-0.6.8-win32.exe
|
||||
URLDownload = http://downloads.sourceforge.net/project/smplayer/SMPlayer/0.6.9/smplayer-0.6.9-win32.exe
|
||||
CDPath = none
|
||||
|
||||
[Section.0407]
|
||||
|
|
|
@ -2,35 +2,35 @@
|
|||
|
||||
[Section]
|
||||
Name = Mozilla Thunderbird
|
||||
Version = 3.0.1
|
||||
Version = 3.0.3
|
||||
Licence = MPL/GPL/LGPL
|
||||
Description = The most popular and one of the best free Mail Clients out there.
|
||||
Size = 8.6M
|
||||
Category = 5
|
||||
URLSite = http://www.mozilla-europe.org/en/products/thunderbird/
|
||||
URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.0.1/win32/en-US/Thunderbird%20Setup%203.0.1.exe
|
||||
URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.0.3/win32/en-US/Thunderbird%20Setup%203.0.3.exe
|
||||
CDPath = none
|
||||
|
||||
[Section.0407]
|
||||
Description = Der populärste und einer der besten freien Mail-Clients.
|
||||
Size = 8.4M
|
||||
URLSite = http://www.mozilla-europe.org/de/products/thunderbird/
|
||||
URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.0.1/win32/de/Thunderbird%20Setup%203.0.1.exe
|
||||
URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.0.3/win32/de/Thunderbird%20Setup%203.0.3.exe
|
||||
|
||||
[Section.040a]
|
||||
Description = El más popular y uno de los mejores clientes mail que hay.
|
||||
Size = 8.4M
|
||||
URLSite = http://www.mozilla-europe.org/es/products/thunderbird/
|
||||
URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.0.1/win32/es-ES/Thunderbird%20Setup%203.0.1.exe
|
||||
URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.0.3/win32/es-ES/Thunderbird%20Setup%203.0.3.exe
|
||||
|
||||
[Section.0415]
|
||||
Description = Najpopularniejszy i jeden z najlepszych darmowych klientów poczty.
|
||||
Size = 9.2M
|
||||
Size = 9.3M
|
||||
URLSite = http://www.mozilla-europe.org/pl/products/thunderbird/
|
||||
URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.0.1/win32/pl/Thunderbird%20Setup%203.0.1.exe
|
||||
URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.0.3/win32/pl/Thunderbird%20Setup%203.0.3.exe
|
||||
|
||||
[Section.0419]
|
||||
Description = Один из самых популярных и лучших бесплатных почтовых клиентов.
|
||||
Size = 8.8M
|
||||
URLSite = http://www.mozilla-europe.org/ru/products/thunderbird/
|
||||
URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.0.1/win32/ru/Thunderbird%20Setup%203.0.1.exe
|
||||
URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.0.3/win32/ru/Thunderbird%20Setup%203.0.3.exe
|
||||
|
|
|
@ -305,7 +305,7 @@ class audio_wavein
|
|||
if ( aud_info.bits() == 16 )
|
||||
svalue = ( unsigned int ) abs( *(( short * ) (main_buffer + aud_info.bytes_in_samples( nsamp ))));
|
||||
else if ( aud_info.bits() == 8 )
|
||||
svalue = (unsigned int)(( unsigned char * ) *(main_buffer + aud_info.bytes_in_samples( nsamp )));
|
||||
svalue = (unsigned int)(( ptrdiff_t ) *(main_buffer + aud_info.bytes_in_samples( nsamp )));
|
||||
|
||||
else
|
||||
svalue = 0;
|
||||
|
|
|
@ -229,7 +229,7 @@ class audio_waveout
|
|||
if ( aud_info.bits() == 16 )
|
||||
svalue = ( unsigned int ) abs( *(( short * ) (main_buffer + aud_info.bytes_in_samples( nsamp ))));
|
||||
else if ( aud_info.bits() == 8 )
|
||||
svalue = (unsigned int)(( unsigned char * ) *(main_buffer + aud_info.bytes_in_samples( nsamp )));
|
||||
svalue = (unsigned int)(( ptrdiff_t ) *(main_buffer + aud_info.bytes_in_samples( nsamp )));
|
||||
|
||||
else
|
||||
svalue = 0;
|
||||
|
|
|
@ -846,10 +846,10 @@ AddDiskToList (HANDLE FileHandle,
|
|||
DiskEntry->SectorsPerTrack = DiskGeometry.SectorsPerTrack;
|
||||
DiskEntry->BytesPerSector = DiskGeometry.BytesPerSector;
|
||||
|
||||
DPRINT ("Cylinders %d\n", DiskEntry->Cylinders);
|
||||
DPRINT ("TracksPerCylinder %d\n", DiskEntry->TracksPerCylinder);
|
||||
DPRINT ("SectorsPerTrack %d\n", DiskEntry->SectorsPerTrack);
|
||||
DPRINT ("BytesPerSector %d\n", DiskEntry->BytesPerSector);
|
||||
DPRINT ("Cylinders %I64u\n", DiskEntry->Cylinders);
|
||||
DPRINT ("TracksPerCylinder %I64u\n", DiskEntry->TracksPerCylinder);
|
||||
DPRINT ("SectorsPerTrack %I64u\n", DiskEntry->SectorsPerTrack);
|
||||
DPRINT ("BytesPerSector %I64u\n", DiskEntry->BytesPerSector);
|
||||
|
||||
DiskEntry->TrackSize =
|
||||
(ULONGLONG)DiskGeometry.SectorsPerTrack *
|
||||
|
|
|
@ -244,7 +244,7 @@ static BOOL IsConsoleProcess(HANDLE Process)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
return IMAGE_SUBSYSTEM_WINDOWS_CUI == ProcessPeb.ImageSubSystem;
|
||||
return IMAGE_SUBSYSTEM_WINDOWS_CUI == ProcessPeb.ImageSubsystem;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -118,6 +118,7 @@
|
|||
<property name="BASEADDRESS_CARDS" value="0x701a0000" />
|
||||
<property name="BASEADDRESS_WININET" value="0x70200000" />
|
||||
<property name="BASEADDRESS_WINHTTP" value="0x70c60000" />
|
||||
<property name="BASEADDRESS_BATT" value="0x70cb0000" />
|
||||
<property name="BASEADDRESS_AMSTREAM" value="0x71030000" />
|
||||
<property name="BASEADDRESS_ACLUI" value="0x71550000" />
|
||||
<property name="BASEADDRESS_DHCPCSVC" value="0x71650000" />
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
|
||||
<module name="bootcd" type="iso" output="ReactOS.iso">
|
||||
<bootsector>isoboot</bootsector>
|
||||
</module>
|
||||
<if property="ARCH" value="i386>
|
||||
<module name="bootcd" type="iso" output="ReactOS.iso">
|
||||
<bootsector>isoboot</bootsector>
|
||||
</module>
|
||||
</if>
|
||||
<ifnot property="ARCH" value="i386>
|
||||
<module name="bootcd" type="iso" output="ReactOS-$(ARCH).iso">
|
||||
<bootsector>isoboot</bootsector>
|
||||
</module>
|
||||
</ifnot>
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
|
||||
<module name="livecd" type="liveiso" output="ReactOS-LiveCD.iso">
|
||||
<bootsector>isoboot</bootsector>
|
||||
</module>
|
||||
<if property="ARCH" value="i386>
|
||||
<module name="livecd" type="liveiso" output="ReactOS-LiveCD.iso">
|
||||
<bootsector>isoboot</bootsector>
|
||||
</module>
|
||||
</if>
|
||||
<ifnot property="ARCH" value="i386>
|
||||
<module name="livecd" type="liveiso" output="ReactOS-LiveCD-$(ARCH).iso">
|
||||
<bootsector>isoboot</bootsector>
|
||||
</module>
|
||||
</ifnot>
|
||||
|
|
|
@ -262,6 +262,7 @@ dll\win32\atl\atl.dll 1
|
|||
dll\win32\authz\authz.dll 1
|
||||
dll\win32\avicap32\avicap32.dll 1
|
||||
dll\win32\avifil32\avifil32.dll 1
|
||||
dll\win32\batt\batt.dll 1
|
||||
dll\win32\bcrypt\bcrypt.dll 1
|
||||
dll\win32\beepmidi\beepmidi.dll 1
|
||||
dll\win32\browseui\browseui.dll 1
|
||||
|
|
|
@ -351,7 +351,7 @@ KeBugCheckEx(
|
|||
IN ULONG_PTR BugCheckParameter3,
|
||||
IN ULONG_PTR BugCheckParameter4)
|
||||
{
|
||||
char Buffer[64];
|
||||
char Buffer[70];
|
||||
sprintf(Buffer, "*** STOP: 0x%08lX (0x%08lX, 0x%08lX, 0x%08lX, 0x%08lX)",
|
||||
BugCheckCode, BugCheckParameter1, BugCheckParameter2,
|
||||
BugCheckParameter3, BugCheckParameter4);
|
||||
|
|
|
@ -96,7 +96,16 @@ LRESULT CALLBACK RosImageProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
// build new bitmap
|
||||
GetObject(pImgInfo->hBitmap, sizeof(BITMAP), &bitmap);
|
||||
dc = CreateCompatibleDC(GetDC(NULL));
|
||||
if (dc == NULL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
sdc = CreateCompatibleDC(dc);
|
||||
if (sdc == NULL)
|
||||
{
|
||||
DeleteDC(dc);
|
||||
break;
|
||||
}
|
||||
ncm.cbSize = sizeof(NONCLIENTMETRICS);
|
||||
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0);
|
||||
|
||||
|
|
|
@ -46,9 +46,9 @@ BEGIN
|
|||
EDITTEXT IDC_USER_GENERAL_FULL_NAME,77,43,168,13,ES_AUTOHSCROLL
|
||||
LTEXT "Beschreibung:", -1, 7, 64, 63, 8
|
||||
EDITTEXT IDC_USER_GENERAL_DESCRIPTION,77,61,168,13,ES_AUTOHSCROLL
|
||||
AUTOCHECKBOX "Benutzer muss das Passwort bei der ersten Anmeldung ändern",IDC_USER_GENERAL_FORCE_CHANGE,7,82,210,10
|
||||
AUTOCHECKBOX "Benutzer kann das Passwort nicht ändern",IDC_USER_GENERAL_CANNOT_CHANGE,7,95,210,10
|
||||
AUTOCHECKBOX "Passwort läuft nie ab",IDC_USER_GENERAL_NEVER_EXPIRES,7,108,210,10
|
||||
AUTOCHECKBOX "Benutzer muss das Passwort bei der ersten Anmeldung ändern",IDC_USER_GENERAL_FORCE_CHANGE,7,82,230,10
|
||||
AUTOCHECKBOX "Benutzer kann das Passwort nicht ändern",IDC_USER_GENERAL_CANNOT_CHANGE,7,95,210,10
|
||||
AUTOCHECKBOX "Passwort läuft nie ab",IDC_USER_GENERAL_NEVER_EXPIRES,7,108,210,10
|
||||
AUTOCHECKBOX "Konto ist deativiert",IDC_USER_GENERAL_DISABLED,7,121,210,10
|
||||
AUTOCHECKBOX "Konto ist gesperrt",IDC_USER_GENERAL_LOCKED,7,134,210,10
|
||||
END
|
||||
|
@ -106,7 +106,7 @@ END
|
|||
|
||||
IDD_CHANGE_PASSWORD DIALOGEX DISCARDABLE 0, 0, 267, 74
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT
|
||||
CAPTION "Passwort ändern"
|
||||
CAPTION "Passwort ändern"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
EDITTEXT IDC_EDIT_PASSWORD1,107,7,153,14,ES_AUTOHSCROLL | ES_PASSWORD
|
||||
|
@ -126,16 +126,16 @@ BEGIN
|
|||
EDITTEXT IDC_USER_NEW_NAME,107,7,153,14,ES_AUTOHSCROLL
|
||||
RTEXT "Benutzername:", -1,7,10,96,8
|
||||
EDITTEXT IDC_USER_NEW_FULL_NAME,107,25,153,14,ES_AUTOHSCROLL
|
||||
RTEXT "Vollständiger Name:", -1,7,28,96,8
|
||||
RTEXT "Vollständiger Name:", -1,7,28,96,8
|
||||
EDITTEXT IDC_USER_NEW_DESCRIPTION,107,43,153,14,ES_AUTOHSCROLL
|
||||
RTEXT "Beschreibung:", -1,7,46,96,8
|
||||
EDITTEXT IDC_USER_NEW_PASSWORD1,107,67,153,14,ES_AUTOHSCROLL | ES_PASSWORD
|
||||
RTEXT "Passwort:", -1,7,70,96,8
|
||||
EDITTEXT IDC_USER_NEW_PASSWORD2,107,85,153,14,ES_AUTOHSCROLL | ES_PASSWORD
|
||||
RTEXT "Passwort wiederholen:", -1,7,88,96,8
|
||||
AUTOCHECKBOX "Benutzer muss das Passwort bei der ersten Anmeldung ändern",IDC_USER_NEW_FORCE_CHANGE,7,109,200,10
|
||||
AUTOCHECKBOX "Benutzer kann das Passwort nicht ändern",IDC_USER_NEW_CANNOT_CHANGE,7,123,200,10,WS_DISABLED
|
||||
AUTOCHECKBOX "Passwort läuft nie ab",IDC_USER_NEW_NEVER_EXPIRES,7,137,200,10,WS_DISABLED
|
||||
AUTOCHECKBOX "Benutzer muss das Passwort bei der ersten Anmeldung ändern",IDC_USER_NEW_FORCE_CHANGE,7,109,230,10
|
||||
AUTOCHECKBOX "Benutzer kann das Passwort nicht ändern",IDC_USER_NEW_CANNOT_CHANGE,7,123,200,10,WS_DISABLED
|
||||
AUTOCHECKBOX "Passwort läuft nie ab",IDC_USER_NEW_NEVER_EXPIRES,7,137,200,10,WS_DISABLED
|
||||
AUTOCHECKBOX "Konto ist deaktiviert",IDC_USER_NEW_DISABLED,7,151,200,10
|
||||
DEFPUSHBUTTON "OK",IDOK,156,179,50,14,WS_DISABLED
|
||||
PUSHBUTTON "Abbrechen",IDCANCEL,210,179,50,14
|
||||
|
@ -179,9 +179,9 @@ BEGIN
|
|||
END
|
||||
POPUP ""
|
||||
BEGIN
|
||||
MENUITEM "Mitglied hinzufügen", IDM_GROUP_ADD_MEMBER, GRAYED
|
||||
MENUITEM "Mitglied hinzufügen", IDM_GROUP_ADD_MEMBER, GRAYED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Löschen", IDM_GROUP_DELETE
|
||||
MENUITEM "Löschen", IDM_GROUP_DELETE
|
||||
MENUITEM "Umbenennen", IDM_GROUP_RENAME
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Eigenschaften", IDM_GROUP_PROPERTIES
|
||||
|
@ -197,9 +197,9 @@ BEGIN
|
|||
END
|
||||
POPUP ""
|
||||
BEGIN
|
||||
MENUITEM "Passwort ändern", IDM_USER_CHANGE_PASSWORD
|
||||
MENUITEM "Passwort ändern", IDM_USER_CHANGE_PASSWORD
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Löschen", IDM_USER_DELETE
|
||||
MENUITEM "Löschen", IDM_USER_DELETE
|
||||
MENUITEM "Umbenennen", IDM_USER_RENAME
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Eigenschaften", IDM_USER_PROPERTIES
|
||||
|
|
|
@ -9,7 +9,9 @@
|
|||
|
||||
#include "precomp.h"
|
||||
|
||||
#ifndef _MSC_VER
|
||||
const GUID IID_IKsPropertySet = {0x31efac30, 0x515c, 0x11d0, {0xa9,0xaa, 0x00,0xaa,0x00,0x61,0xbe,0x93}};
|
||||
#endif
|
||||
|
||||
class CControlNode : public IUnknown
|
||||
{
|
||||
|
@ -32,12 +34,12 @@ public:
|
|||
return m_Ref;
|
||||
}
|
||||
|
||||
CControlNode(HANDLE hFile, ULONG NodeType, ULONG PinId) : m_Ref(0), m_hFile(hFile), m_NodeType(NodeType), m_PinId(PinId){};
|
||||
CControlNode(IKsPropertySet * pProperty, ULONG NodeType, ULONG PinId) : m_Ref(0), m_pKsProperty(pProperty), m_NodeType(NodeType), m_PinId(PinId){};
|
||||
virtual ~CControlNode(){};
|
||||
|
||||
protected:
|
||||
LONG m_Ref;
|
||||
HANDLE m_hFile;
|
||||
IKsPropertySet * m_pKsProperty;
|
||||
ULONG m_NodeType;
|
||||
ULONG m_PinId;
|
||||
};
|
||||
|
@ -58,19 +60,19 @@ CControlNode::QueryInterface(
|
|||
}
|
||||
else if(IsEqualGUID(refiid, IID_IBDA_FrequencyFilter))
|
||||
{
|
||||
return CBDAFrequencyFilter_fnConstructor(m_hFile, m_NodeType, refiid, Output);
|
||||
return CBDAFrequencyFilter_fnConstructor(m_pKsProperty, m_NodeType, refiid, Output);
|
||||
}
|
||||
else if(IsEqualGUID(refiid, IID_IBDA_SignalStatistics))
|
||||
{
|
||||
return CBDASignalStatistics_fnConstructor(m_hFile, m_NodeType, refiid, Output);
|
||||
return CBDASignalStatistics_fnConstructor(m_pKsProperty, m_NodeType, refiid, Output);
|
||||
}
|
||||
else if(IsEqualGUID(refiid, IID_IBDA_LNBInfo))
|
||||
{
|
||||
return CBDALNBInfo_fnConstructor(m_hFile, m_NodeType, refiid, Output);
|
||||
return CBDALNBInfo_fnConstructor(m_pKsProperty, m_NodeType, refiid, Output);
|
||||
}
|
||||
else if(IsEqualGUID(refiid, IID_IBDA_DigitalDemodulator))
|
||||
{
|
||||
return CBDADigitalDemodulator_fnConstructor(m_hFile, m_NodeType, refiid, Output);
|
||||
return CBDADigitalDemodulator_fnConstructor(m_pKsProperty, m_NodeType, refiid, Output);
|
||||
}
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[MAX_PATH];
|
||||
|
@ -88,7 +90,6 @@ CControlNode::QueryInterface(
|
|||
HRESULT
|
||||
WINAPI
|
||||
CControlNode_fnConstructor(
|
||||
HANDLE hFile,
|
||||
IBaseFilter * pFilter,
|
||||
ULONG NodeType,
|
||||
ULONG PinId,
|
||||
|
@ -98,7 +99,7 @@ CControlNode_fnConstructor(
|
|||
WCHAR Buffer[100];
|
||||
HRESULT hr;
|
||||
IPin * pPin = NULL;
|
||||
IKsObject * pObject = NULL;
|
||||
IKsPropertySet * pProperty;
|
||||
|
||||
// store pin id
|
||||
swprintf(Buffer, L"%u", PinId);
|
||||
|
@ -115,26 +116,21 @@ CControlNode_fnConstructor(
|
|||
return hr;
|
||||
}
|
||||
|
||||
// query IKsObject interface
|
||||
hr = pPin->QueryInterface(IID_IKsObject, (void**)&pObject);
|
||||
// query for IKsPropertySet interface
|
||||
hr = pPin->QueryInterface(IID_IKsPropertySet, (void**)&pProperty);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
swprintf(Buffer, L"CControlNode_fnConstructor get IID_IKsObject status %lx\n", hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
// get pin handle
|
||||
hFile = pObject->KsGetObjectHandle();
|
||||
// release IKsObject interface
|
||||
pObject->Release();
|
||||
}
|
||||
// release IPin interface
|
||||
pPin->Release();
|
||||
|
||||
// construct device control
|
||||
CControlNode * handler = new CControlNode(hFile, NodeType, PinId);
|
||||
CControlNode * handler = new CControlNode(pProperty, NodeType, PinId);
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
OutputDebugStringW(L"CControlNode_fnConstructor\n");
|
||||
|
|
|
@ -9,20 +9,24 @@
|
|||
|
||||
#include "precomp.h"
|
||||
|
||||
const GUID CLSID_DVBTNetworkProvider = {0x216c62df, 0x6d7f, 0x4e9a, {0x85, 0x71, 0x5, 0xf1, 0x4e, 0xdb, 0x76, 0x6a}};
|
||||
const GUID IID_IAC3Filter = {0xe4539501, 0xc609, 0x46ea, {0xad, 0x2a, 0x0e, 0x97, 0x00, 0x24, 0x56, 0x83}};
|
||||
const GUID IID_IAsyncReader = {0x56A868AA, 0x0AD4, 0x11CE, {0xB0, 0x3A, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70}};
|
||||
const GUID IID_IMatrixMixer = {0xafc57835, 0x2fd1, 0x4541, {0xa6, 0xd9, 0x0d, 0xb7, 0x18, 0x56, 0xe5, 0x89}};
|
||||
const GUID IID_IBDA_NetworkProvider = {0xfd501041, 0x8ebe, 0x11ce, {0x81, 0x83, 0x00, 0xaa, 0x00, 0x57, 0x7d, 0xa2}};
|
||||
const GUID IID_IAMOpenProgress = {0x8E1C39A1, 0xDE53, 0x11cf, {0xAA, 0x63, 0x00, 0x80, 0xC7, 0x44, 0x52, 0x8D}};
|
||||
const GUID IID_IDistributorNotify = {0x56a868af, 0x0ad4, 0x11ce, {0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
|
||||
const GUID IID_IBDA_DeviceControl = {0xFD0A5AF3, 0xB41D, 0x11d2, {0x9C, 0x95, 0x00, 0xC0, 0x4F, 0x79, 0x71, 0xE0}};
|
||||
const GUID IID_IBDA_Topology = {0x79B56888, 0x7FEA, 0x4690, {0xB4, 0x5D, 0x38, 0xFD, 0x3C, 0x78, 0x49, 0xBE}};
|
||||
const GUID IID_IKsObject = {0x423c13a2, 0x2070, 0x11d0, {0x9e, 0xf7, 0x00, 0xaa, 0x00, 0xa2, 0x16, 0xa1}};
|
||||
|
||||
#ifndef _MSC_VER
|
||||
const GUID CLSID_DVBTNetworkProvider = {0x216c62df, 0x6d7f, 0x4e9a, {0x85, 0x71, 0x5, 0xf1, 0x4e, 0xdb, 0x76, 0x6a}};
|
||||
|
||||
const GUID KSPROPSETID_BdaTopology = {0xa14ee835, 0x0a23, 0x11d3, {0x9c, 0xc7, 0x0, 0xc0, 0x4f, 0x79, 0x71, 0xe0}};
|
||||
const GUID KSMETHODSETID_BdaDeviceConfiguration = {0x71985f45, 0x1ca1, 0x11d3, {0x9c, 0xc8, 0x0, 0xc0, 0x4f, 0x79, 0x71, 0xe0}};
|
||||
const GUID IID_IBaseFilter = {0x56a86895, 0x0ad4, 0x11ce, {0xb0,0x3a, 0x00,0x20,0xaf,0x0b,0xa7,0x70}};
|
||||
const GUID KSMETHODSETID_BdaChangeSync = {0xfd0a5af3, 0xb41d, 0x11d2, {0x9c, 0x95, 0x0, 0xc0, 0x4f, 0x79, 0x71, 0xe0}};
|
||||
const GUID IID_IBaseFilter = {0x56a86895, 0x0ad4, 0x11ce, {0xb0,0x3a, 0x00,0x20,0xaf,0x0b,0xa7,0x70}};
|
||||
const GUID IID_IAsyncReader = {0x56A868AA, 0x0AD4, 0x11CE, {0xB0, 0x3A, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70}};
|
||||
const GUID IID_IAMOpenProgress = {0x8E1C39A1, 0xDE53, 0x11cf, {0xAA, 0x63, 0x00, 0x80, 0xC7, 0x44, 0x52, 0x8D}};
|
||||
const GUID IID_IBDA_Topology = {0x79B56888, 0x7FEA, 0x4690, {0xB4, 0x5D, 0x38, 0xFD, 0x3C, 0x78, 0x49, 0xBE}};
|
||||
const GUID IID_IBDA_NetworkProvider = {0xfd501041, 0x8ebe, 0x11ce, {0x81, 0x83, 0x00, 0xaa, 0x00, 0x57, 0x7d, 0xa2}};
|
||||
const GUID IID_IBDA_DeviceControl = {0xFD0A5AF3, 0xB41D, 0x11d2, {0x9C, 0x95, 0x00, 0xC0, 0x4F, 0x79, 0x71, 0xE0}};
|
||||
|
||||
const GUID IID_IDistributorNotify = {0x56a868af, 0x0ad4, 0x11ce, {0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
|
||||
|
||||
#endif
|
||||
|
||||
class CBDADeviceControl : public IBDA_DeviceControl,
|
||||
public IBDA_Topology
|
||||
|
@ -468,15 +472,15 @@ CBDADeviceControl::GetControlNode(ULONG ulInputPinId, ULONG ulOutputPinId, ULONG
|
|||
hr = KsSynchronousDeviceControl(m_Handle, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSP_BDA_NODE_PIN) + sizeof(ULONG), &PinId, sizeof(ULONG), &BytesReturned);
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDADeviceControl::GetControlNode: hr %lx, BytesReturned %lu PinId %lu\n", hr, BytesReturned, PinId);
|
||||
WCHAR Buffer[200];
|
||||
swprintf(Buffer, L"CBDADeviceControl::GetControlNode: hr %lx, BytesReturned %lu PinId %lu ulInputPinId %lu ulOutputPinId %lu ulNodeType %lu\n", hr, BytesReturned, PinId, ulInputPinId, ulOutputPinId, ulNodeType);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = CControlNode_fnConstructor(m_Handle, m_pFilter, ulNodeType, PinId, IID_IUnknown, (LPVOID*)ppControlNode);
|
||||
hr = CControlNode_fnConstructor(m_pFilter, ulNodeType, PinId, IID_IUnknown, (LPVOID*)ppControlNode);
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
swprintf(Buffer, L"CBDADeviceControl::GetControlNode: hr %lx\n", hr);
|
||||
|
|
|
@ -9,8 +9,10 @@
|
|||
|
||||
#include "precomp.h"
|
||||
|
||||
#ifndef _MSC_VER
|
||||
const GUID IID_IBDA_DigitalDemodulator = {0xef30f379, 0x985b, 0x4d10, {0xb6, 0x40, 0xa7, 0x9d, 0x5e, 0x04, 0xe1, 0xe0}};
|
||||
const GUID KSPROPSETID_BdaDigitalDemodulator = {0xef30f379, 0x985b, 0x4d10, {0xb6, 0x40, 0xa7, 0x9d, 0x5e, 0x4, 0xe1, 0xe0}};
|
||||
#endif
|
||||
|
||||
class CBDADigitalDemodulator : public IBDA_DigitalDemodulator
|
||||
{
|
||||
|
@ -48,12 +50,12 @@ public:
|
|||
HRESULT STDMETHODCALLTYPE put_SpectralInversion(SpectralInversion *pSpectralInversion);
|
||||
HRESULT STDMETHODCALLTYPE get_SpectralInversion(SpectralInversion *pSpectralInversion);
|
||||
|
||||
CBDADigitalDemodulator(HANDLE hFile, ULONG NodeId) : m_Ref(0), m_hFile(hFile), m_NodeId(NodeId){};
|
||||
CBDADigitalDemodulator(IKsPropertySet * pProperty, ULONG NodeId) : m_Ref(0), m_pProperty(pProperty), m_NodeId(NodeId){};
|
||||
~CBDADigitalDemodulator(){};
|
||||
|
||||
protected:
|
||||
LONG m_Ref;
|
||||
HANDLE m_hFile;
|
||||
IKsPropertySet * m_pProperty;
|
||||
ULONG m_NodeId;
|
||||
};
|
||||
|
||||
|
@ -86,6 +88,7 @@ CBDADigitalDemodulator::QueryInterface(
|
|||
swprintf(Buffer, L"CBDADigitalDemodulator::QueryInterface: NoInterface for %s", lpstr);
|
||||
OutputDebugStringW(Buffer);
|
||||
CoTaskMemFree(lpstr);
|
||||
DebugBreak();
|
||||
#endif
|
||||
|
||||
return E_NOINTERFACE;
|
||||
|
@ -98,20 +101,17 @@ CBDADigitalDemodulator::put_ModulationType(ModulationType *pModulationType)
|
|||
KSP_NODE Node;
|
||||
HRESULT hr;
|
||||
|
||||
ULONG BytesReturned;
|
||||
|
||||
// setup request
|
||||
Node.Property.Set = KSPROPSETID_BdaDigitalDemodulator;
|
||||
Node.Property.Id = KSPROPERTY_BDA_MODULATION_TYPE;
|
||||
Node.Property.Flags = KSPROPERTY_TYPE_TOPOLOGY | KSPROPERTY_TYPE_SET;
|
||||
Node.NodeId = m_NodeId;
|
||||
Node.Reserved = 0;
|
||||
|
||||
// perform request
|
||||
hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), pModulationType, sizeof(ModulationType), &BytesReturned);
|
||||
hr = m_pProperty->Set(KSPROPSETID_BdaDigitalDemodulator, KSPROPERTY_BDA_MODULATION_TYPE, &Node.NodeId, sizeof(KSP_NODE)-sizeof(KSPROPERTY), pModulationType, sizeof(ModulationType));
|
||||
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDADigitalDemodulator::put_ModulationType: hr %lx, BytesReturned %lu\n", hr, BytesReturned);
|
||||
swprintf(Buffer, L"CBDADigitalDemodulator::put_ModulationType: pModulationType %lu hr %lx\n", *pModulationType, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
@ -131,20 +131,18 @@ CBDADigitalDemodulator::put_InnerFECMethod(FECMethod *pFECMethod)
|
|||
{
|
||||
KSP_NODE Node;
|
||||
HRESULT hr;
|
||||
ULONG BytesReturned;
|
||||
|
||||
// setup request
|
||||
Node.Property.Set = KSPROPSETID_BdaDigitalDemodulator;
|
||||
Node.Property.Id = KSPROPERTY_BDA_INNER_FEC_TYPE;
|
||||
Node.Property.Flags = KSPROPERTY_TYPE_TOPOLOGY | KSPROPERTY_TYPE_SET;
|
||||
Node.NodeId = m_NodeId;
|
||||
Node.Reserved = 0;
|
||||
|
||||
// perform request
|
||||
hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), pFECMethod, sizeof(FECMethod), &BytesReturned);
|
||||
hr = m_pProperty->Set(KSPROPSETID_BdaDigitalDemodulator, KSPROPERTY_BDA_INNER_FEC_TYPE, &Node.NodeId, sizeof(KSP_NODE)-sizeof(KSPROPERTY), pFECMethod, sizeof(FECMethod));
|
||||
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDADigitalDemodulator::put_InnerFECMethod: hr %lx, BytesReturned %lu\n", hr, BytesReturned);
|
||||
swprintf(Buffer, L"CBDADigitalDemodulator::put_InnerFECMethod: pFECMethod %lu hr %lx\n", *pFECMethod, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
@ -165,20 +163,16 @@ CBDADigitalDemodulator::put_InnerFECRate(BinaryConvolutionCodeRate *pFECRate)
|
|||
KSP_NODE Node;
|
||||
HRESULT hr;
|
||||
|
||||
ULONG BytesReturned;
|
||||
|
||||
// setup request
|
||||
Node.Property.Set = KSPROPSETID_BdaDigitalDemodulator;
|
||||
Node.Property.Id = KSPROPERTY_BDA_INNER_FEC_RATE;
|
||||
Node.Property.Flags = KSPROPERTY_TYPE_TOPOLOGY | KSPROPERTY_TYPE_SET;
|
||||
Node.NodeId = m_NodeId;
|
||||
Node.Reserved = 0;
|
||||
|
||||
// perform request
|
||||
hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), pFECRate, sizeof(BinaryConvolutionCodeRate), &BytesReturned);
|
||||
hr = m_pProperty->Set(KSPROPSETID_BdaDigitalDemodulator, KSPROPERTY_BDA_INNER_FEC_RATE, &Node.NodeId, sizeof(KSP_NODE)-sizeof(KSPROPERTY), pFECRate, sizeof(BinaryConvolutionCodeRate));
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDADigitalDemodulator::put_InnerFECRate: hr %lx, BytesReturned %lu\n", hr, BytesReturned);
|
||||
swprintf(Buffer, L"CBDADigitalDemodulator::put_InnerFECRate: pFECRate %lu hr %lx\n", *pFECRate, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
@ -198,20 +192,17 @@ CBDADigitalDemodulator::put_OuterFECMethod(FECMethod *pFECMethod)
|
|||
{
|
||||
KSP_NODE Node;
|
||||
HRESULT hr;
|
||||
ULONG BytesReturned;
|
||||
|
||||
// setup request
|
||||
Node.Property.Set = KSPROPSETID_BdaDigitalDemodulator;
|
||||
Node.Property.Id = KSPROPERTY_BDA_OUTER_FEC_TYPE;
|
||||
Node.Property.Flags = KSPROPERTY_TYPE_TOPOLOGY | KSPROPERTY_TYPE_SET;
|
||||
Node.NodeId = m_NodeId;
|
||||
Node.Reserved = 0;
|
||||
|
||||
// perform request
|
||||
hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), pFECMethod, sizeof(FECMethod), &BytesReturned);
|
||||
hr = m_pProperty->Set(KSPROPSETID_BdaDigitalDemodulator, KSPROPERTY_BDA_OUTER_FEC_TYPE, &Node.NodeId, sizeof(KSP_NODE)-sizeof(KSPROPERTY), pFECMethod, sizeof(FECMethod));
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDADigitalDemodulator::put_OuterFECMethod: hr %lx, BytesReturned %lu\n", hr, BytesReturned);
|
||||
swprintf(Buffer, L"CBDADigitalDemodulator::put_OuterFECMethod: pFECMethod %lu hr %lx\n", *pFECMethod, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
@ -232,20 +223,16 @@ CBDADigitalDemodulator::put_OuterFECRate(BinaryConvolutionCodeRate *pFECRate)
|
|||
KSP_NODE Node;
|
||||
HRESULT hr;
|
||||
|
||||
ULONG BytesReturned;
|
||||
|
||||
// setup request
|
||||
Node.Property.Set = KSPROPSETID_BdaDigitalDemodulator;
|
||||
Node.Property.Id = KSPROPERTY_BDA_OUTER_FEC_RATE;
|
||||
Node.Property.Flags = KSPROPERTY_TYPE_TOPOLOGY | KSPROPERTY_TYPE_SET;
|
||||
Node.NodeId = m_NodeId;
|
||||
Node.Reserved = 0;
|
||||
|
||||
// perform request
|
||||
hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), pFECRate, sizeof(BinaryConvolutionCodeRate), &BytesReturned);
|
||||
hr = m_pProperty->Set(KSPROPSETID_BdaDigitalDemodulator, KSPROPERTY_BDA_OUTER_FEC_RATE, &Node.NodeId, sizeof(KSP_NODE)-sizeof(KSPROPERTY), pFECRate, sizeof(BinaryConvolutionCodeRate));
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDADigitalDemodulator::put_OuterFECRate: hr %lx, BytesReturned %lu\n", hr, BytesReturned);
|
||||
swprintf(Buffer, L"CBDADigitalDemodulator::put_OuterFECRate: pFECRate %lu hr %lx\n", *pFECRate, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
@ -265,20 +252,17 @@ CBDADigitalDemodulator::put_SymbolRate(ULONG *pSymbolRate)
|
|||
{
|
||||
KSP_NODE Node;
|
||||
HRESULT hr;
|
||||
ULONG BytesReturned;
|
||||
|
||||
// setup request
|
||||
Node.Property.Set = KSPROPSETID_BdaDigitalDemodulator;
|
||||
Node.Property.Id = KSPROPERTY_BDA_SYMBOL_RATE;
|
||||
Node.Property.Flags = KSPROPERTY_TYPE_TOPOLOGY | KSPROPERTY_TYPE_SET;
|
||||
Node.NodeId = m_NodeId;
|
||||
Node.Reserved = 0;
|
||||
|
||||
// perform request
|
||||
hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), pSymbolRate, sizeof(ULONG), &BytesReturned);
|
||||
hr = m_pProperty->Set(KSPROPSETID_BdaDigitalDemodulator, KSPROPERTY_BDA_SYMBOL_RATE, &Node.NodeId, sizeof(KSP_NODE)-sizeof(KSPROPERTY), pSymbolRate, sizeof(ULONG));
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDADigitalDemodulator::put_SymbolRate: hr %lx, BytesReturned %lu\n", hr, BytesReturned);
|
||||
swprintf(Buffer, L"CBDADigitalDemodulator::put_SymbolRate: pSymbolRate %lu hr %lx\n", *pSymbolRate, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
@ -298,20 +282,17 @@ CBDADigitalDemodulator::put_SpectralInversion(SpectralInversion *pSpectralInvers
|
|||
{
|
||||
KSP_NODE Node;
|
||||
HRESULT hr;
|
||||
ULONG BytesReturned;
|
||||
|
||||
// setup request
|
||||
Node.Property.Set = KSPROPSETID_BdaDigitalDemodulator;
|
||||
Node.Property.Id = KSPROPERTY_BDA_SPECTRAL_INVERSION;
|
||||
Node.Property.Flags = KSPROPERTY_TYPE_TOPOLOGY | KSPROPERTY_TYPE_SET;
|
||||
Node.NodeId = m_NodeId;
|
||||
Node.Reserved = 0;
|
||||
|
||||
// perform request
|
||||
hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), pSpectralInversion, sizeof(SpectralInversion), &BytesReturned);
|
||||
hr = m_pProperty->Set(KSPROPSETID_BdaDigitalDemodulator, KSPROPERTY_BDA_SPECTRAL_INVERSION, &Node.NodeId, sizeof(KSP_NODE)-sizeof(KSPROPERTY), pSpectralInversion, sizeof(SpectralInversion));
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDADigitalDemodulator::put_SpectralInversion: hr %lx, BytesReturned %lu\n", hr, BytesReturned);
|
||||
swprintf(Buffer, L"CBDADigitalDemodulator::put_SpectralInversion: pSpectralInversion %lu hr %lx\n", *pSpectralInversion, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
@ -329,13 +310,13 @@ CBDADigitalDemodulator::get_SpectralInversion(SpectralInversion *pSpectralInvers
|
|||
HRESULT
|
||||
WINAPI
|
||||
CBDADigitalDemodulator_fnConstructor(
|
||||
HANDLE hFile,
|
||||
IKsPropertySet * pProperty,
|
||||
ULONG NodeId,
|
||||
REFIID riid,
|
||||
LPVOID * ppv)
|
||||
{
|
||||
// construct device control
|
||||
CBDADigitalDemodulator * handler = new CBDADigitalDemodulator(hFile, NodeId);
|
||||
CBDADigitalDemodulator * handler = new CBDADigitalDemodulator(pProperty, NodeId);
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
OutputDebugStringW(L"CBDADigitalDemodulator_fnConstructor\n");
|
||||
|
|
|
@ -9,8 +9,10 @@
|
|||
|
||||
#include "precomp.h"
|
||||
|
||||
#ifndef _MSC_VER
|
||||
const GUID IID_IBDA_FrequencyFilter = {0x71985f47, 0x1ca1, 0x11d3, {0x9c, 0xc8, 0x00, 0xc0, 0x4f, 0x79, 0x71, 0xe0}};
|
||||
const GUID KSPROPSETID_BdaFrequencyFilter = {0x71985f47, 0x1ca1, 0x11d3, {0x9c, 0xc8, 0x0, 0xc0, 0x4f, 0x79, 0x71, 0xe0}};
|
||||
#endif
|
||||
|
||||
class CBDAFrequencyFilter : public IBDA_FrequencyFilter
|
||||
{
|
||||
|
@ -46,12 +48,12 @@ public:
|
|||
HRESULT STDMETHODCALLTYPE put_FrequencyMultiplier(ULONG ulMultiplier);
|
||||
HRESULT STDMETHODCALLTYPE get_FrequencyMultiplier(ULONG *pulMultiplier);
|
||||
|
||||
CBDAFrequencyFilter(HANDLE hFile, ULONG NodeId) : m_Ref(0), m_hFile(hFile), m_NodeId(NodeId){};
|
||||
CBDAFrequencyFilter(IKsPropertySet * pProperty, ULONG NodeId) : m_Ref(0), m_pProperty(pProperty), m_NodeId(NodeId){};
|
||||
virtual ~CBDAFrequencyFilter(){};
|
||||
|
||||
protected:
|
||||
LONG m_Ref;
|
||||
HANDLE m_hFile;
|
||||
IKsPropertySet * m_pProperty;
|
||||
ULONG m_NodeId;
|
||||
};
|
||||
|
||||
|
@ -84,6 +86,7 @@ CBDAFrequencyFilter::QueryInterface(
|
|||
swprintf(Buffer, L"CControlNode::QueryInterface: NoInterface for %s", lpstr);
|
||||
OutputDebugStringW(Buffer);
|
||||
CoTaskMemFree(lpstr);
|
||||
DebugBreak();
|
||||
#endif
|
||||
|
||||
return E_NOINTERFACE;
|
||||
|
@ -110,20 +113,16 @@ CBDAFrequencyFilter::put_Frequency(ULONG ulFrequency)
|
|||
KSP_NODE Node;
|
||||
HRESULT hr;
|
||||
|
||||
ULONG BytesReturned;
|
||||
|
||||
// setup request
|
||||
Node.Property.Set = KSPROPSETID_BdaFrequencyFilter;
|
||||
Node.Property.Id = KSPROPERTY_BDA_RF_TUNER_FREQUENCY;
|
||||
Node.Property.Flags = KSPROPERTY_TYPE_SET | KSPROPERTY_TYPE_TOPOLOGY;
|
||||
Node.NodeId = m_NodeId;
|
||||
Node.Reserved = 0;
|
||||
|
||||
// perform request
|
||||
hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), &ulFrequency, sizeof(ULONG), &BytesReturned);
|
||||
hr = m_pProperty->Set(KSPROPSETID_BdaFrequencyFilter, KSPROPERTY_BDA_RF_TUNER_FREQUENCY, &Node.NodeId, sizeof(KSP_NODE)-sizeof(KSPROPERTY), &ulFrequency, sizeof(ULONG));
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDAFrequencyFilter::put_Frequency: m_NodeId %lu hr %lx, BytesReturned %lu\n", m_NodeId, hr, BytesReturned);
|
||||
swprintf(Buffer, L"CBDAFrequencyFilter::put_Frequency: m_NodeId %lu ulFrequency %lu hr %lx\n", m_NodeId, ulFrequency, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
@ -143,20 +142,17 @@ CBDAFrequencyFilter::put_Polarity(Polarisation Polarity)
|
|||
{
|
||||
KSP_NODE Node;
|
||||
HRESULT hr;
|
||||
ULONG BytesReturned;
|
||||
|
||||
// setup request
|
||||
Node.Property.Set = KSPROPSETID_BdaFrequencyFilter;
|
||||
Node.Property.Id = KSPROPERTY_BDA_RF_TUNER_POLARITY;
|
||||
Node.Property.Flags = KSPROPERTY_TYPE_SET | KSPROPERTY_TYPE_TOPOLOGY;
|
||||
Node.NodeId = m_NodeId;
|
||||
Node.Reserved = 0;
|
||||
|
||||
// perform request
|
||||
hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), &Polarity, sizeof(Polarisation), &BytesReturned);
|
||||
hr = m_pProperty->Set(KSPROPSETID_BdaFrequencyFilter, KSPROPERTY_BDA_RF_TUNER_POLARITY, &Node.NodeId, sizeof(KSP_NODE)-sizeof(KSPROPERTY), &Polarity, sizeof(Polarisation));
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDAFrequencyFilter::put_Polarity: m_NodeId %lu hr %lx, BytesReturned %lu\n", m_NodeId, hr, BytesReturned);
|
||||
swprintf(Buffer, L"CBDAFrequencyFilter::put_Polarity: m_NodeId %lu Polarity %lu hr %lx\n", m_NodeId, Polarity, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
@ -176,20 +172,17 @@ CBDAFrequencyFilter::put_Range(ULONG ulRange)
|
|||
{
|
||||
KSP_NODE Node;
|
||||
HRESULT hr;
|
||||
ULONG BytesReturned;
|
||||
|
||||
// setup request
|
||||
Node.Property.Set = KSPROPSETID_BdaFrequencyFilter;
|
||||
Node.Property.Id = KSPROPERTY_BDA_RF_TUNER_RANGE;
|
||||
Node.Property.Flags = KSPROPERTY_TYPE_SET | KSPROPERTY_TYPE_TOPOLOGY;
|
||||
Node.NodeId = m_NodeId;
|
||||
Node.Reserved = 0;
|
||||
|
||||
// perform request
|
||||
hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), &ulRange, sizeof(ULONG), &BytesReturned);
|
||||
hr = m_pProperty->Set(KSPROPSETID_BdaFrequencyFilter, KSPROPERTY_BDA_RF_TUNER_RANGE, &Node.NodeId, sizeof(KSP_NODE)-sizeof(KSPROPERTY), &ulRange, sizeof(ULONG));
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDAFrequencyFilter::put_Polarity: m_NodeId %lu hr %lx, BytesReturned %lu\n", m_NodeId, hr, BytesReturned);
|
||||
swprintf(Buffer, L"CBDAFrequencyFilter::put_Range: m_NodeId %lu ulRange %lu hr %lx\n", m_NodeId, ulRange, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
@ -209,20 +202,17 @@ CBDAFrequencyFilter::put_Bandwidth(ULONG ulBandwidth)
|
|||
{
|
||||
KSP_NODE Node;
|
||||
HRESULT hr;
|
||||
ULONG BytesReturned;
|
||||
|
||||
// setup request
|
||||
Node.Property.Set = KSPROPSETID_BdaFrequencyFilter;
|
||||
Node.Property.Id = KSPROPERTY_BDA_RF_TUNER_BANDWIDTH;
|
||||
Node.Property.Flags = KSPROPERTY_TYPE_SET | KSPROPERTY_TYPE_TOPOLOGY;
|
||||
Node.NodeId = m_NodeId;
|
||||
Node.Reserved = 0;
|
||||
|
||||
// perform request
|
||||
hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), &ulBandwidth, sizeof(ULONG), &BytesReturned);
|
||||
hr = m_pProperty->Set(KSPROPSETID_BdaFrequencyFilter, KSPROPERTY_BDA_RF_TUNER_BANDWIDTH, &Node.NodeId, sizeof(KSP_NODE)-sizeof(KSPROPERTY), &ulBandwidth, sizeof(ULONG));
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDAFrequencyFilter::put_Bandwidth: m_NodeId %lu hr %lx, BytesReturned %lu\n", m_NodeId, hr, BytesReturned);
|
||||
swprintf(Buffer, L"CBDAFrequencyFilter::put_Bandwidth: m_NodeId %lu ulBandwidth %lu hr %lx\n", m_NodeId, ulBandwidth, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
@ -241,20 +231,17 @@ CBDAFrequencyFilter::put_FrequencyMultiplier(ULONG ulMultiplier)
|
|||
{
|
||||
KSP_NODE Node;
|
||||
HRESULT hr;
|
||||
ULONG BytesReturned;
|
||||
|
||||
// setup request
|
||||
Node.Property.Set = KSPROPSETID_BdaFrequencyFilter;
|
||||
Node.Property.Id = KSPROPERTY_BDA_RF_TUNER_FREQUENCY_MULTIPLIER;
|
||||
Node.Property.Flags = KSPROPERTY_TYPE_SET | KSPROPERTY_TYPE_TOPOLOGY;
|
||||
Node.NodeId = m_NodeId;
|
||||
Node.Reserved = 0;
|
||||
|
||||
// perform request
|
||||
hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), &ulMultiplier, sizeof(ULONG), &BytesReturned);
|
||||
hr = m_pProperty->Set(KSPROPSETID_BdaFrequencyFilter, KSPROPERTY_BDA_RF_TUNER_FREQUENCY_MULTIPLIER, &Node.NodeId, sizeof(KSP_NODE)-sizeof(KSPROPERTY), &ulMultiplier, sizeof(ULONG));
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDAFrequencyFilter::put_FrequencyMultiplier: m_NodeId %lu hr %lx, BytesReturned %lu\n", m_NodeId, hr, BytesReturned);
|
||||
swprintf(Buffer, L"CBDAFrequencyFilter::put_FrequencyMultiplier: m_NodeId %lu ulMultiplier %lu hr %lx\n", m_NodeId, ulMultiplier, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
@ -271,13 +258,13 @@ CBDAFrequencyFilter::get_FrequencyMultiplier(ULONG *pulMultiplier)
|
|||
HRESULT
|
||||
WINAPI
|
||||
CBDAFrequencyFilter_fnConstructor(
|
||||
HANDLE hFile,
|
||||
IKsPropertySet* pProperty,
|
||||
ULONG NodeId,
|
||||
REFIID riid,
|
||||
LPVOID * ppv)
|
||||
{
|
||||
// construct device control
|
||||
CBDAFrequencyFilter * handler = new CBDAFrequencyFilter(hFile, NodeId);
|
||||
CBDAFrequencyFilter * handler = new CBDAFrequencyFilter(pProperty, NodeId);
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
OutputDebugStringW(L"CBDAFrequencyFilter_fnConstructor\n");
|
||||
|
|
|
@ -9,8 +9,10 @@
|
|||
|
||||
#include "precomp.h"
|
||||
|
||||
#ifndef _MSC_VER
|
||||
const GUID IID_IBDA_LNBInfo = {0x992cf102, 0x49f9, 0x4719, {0xa6, 0x64, 0xc4, 0xf2, 0x3e, 0x24, 0x08, 0xf4}};
|
||||
const GUID KSPROPSETID_BdaLNBInfo = {0x992cf102, 0x49f9, 0x4719, {0xa6, 0x64, 0xc4, 0xf2, 0x3e, 0x24, 0x8, 0xf4}};
|
||||
#endif
|
||||
|
||||
class CBDALNBInfo : public IBDA_LNBInfo
|
||||
{
|
||||
|
@ -41,12 +43,12 @@ public:
|
|||
HRESULT STDMETHODCALLTYPE put_HighLowSwitchFrequency(ULONG ulSwitchFrequency);
|
||||
HRESULT STDMETHODCALLTYPE get_HighLowSwitchFrequency(ULONG *pulSwitchFrequency);
|
||||
|
||||
CBDALNBInfo(HANDLE hFile, ULONG NodeId) : m_Ref(0), m_hFile(hFile), m_NodeId(NodeId){};
|
||||
CBDALNBInfo(IKsPropertySet *pProperty, ULONG NodeId) : m_Ref(0), m_pProperty(pProperty), m_NodeId(NodeId){};
|
||||
~CBDALNBInfo(){};
|
||||
|
||||
protected:
|
||||
LONG m_Ref;
|
||||
HANDLE m_hFile;
|
||||
IKsPropertySet * m_pProperty;
|
||||
ULONG m_NodeId;
|
||||
};
|
||||
|
||||
|
@ -90,20 +92,17 @@ CBDALNBInfo::put_LocalOscilatorFrequencyLowBand(ULONG ulLOFLow)
|
|||
{
|
||||
KSP_NODE Node;
|
||||
HRESULT hr;
|
||||
ULONG BytesReturned;
|
||||
|
||||
// setup request
|
||||
Node.Property.Set = KSPROPSETID_BdaLNBInfo;
|
||||
Node.Property.Id = KSPROPERTY_BDA_LNB_LOF_LOW_BAND;
|
||||
Node.Property.Flags = KSPROPERTY_TYPE_SET | KSPROPERTY_TYPE_TOPOLOGY;
|
||||
Node.NodeId = m_NodeId;
|
||||
Node.Reserved = 0;
|
||||
|
||||
// perform request
|
||||
hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), &ulLOFLow, sizeof(ULONG), &BytesReturned);
|
||||
hr = m_pProperty->Set(KSPROPSETID_BdaLNBInfo, KSPROPERTY_BDA_LNB_LOF_LOW_BAND, &Node.NodeId, sizeof(KSP_NODE)-sizeof(KSPROPERTY), &ulLOFLow, sizeof(LONG));
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDALNBInfo::put_LocalOscilatorFrequencyLowBand: m_NodeId %lu hr %lx, BytesReturned %lu\n", m_NodeId, hr, BytesReturned);
|
||||
swprintf(Buffer, L"CBDALNBInfo::put_LocalOscilatorFrequencyLowBand: m_NodeId %lu ulLOFLow %lu hr %lx\n", m_NodeId, ulLOFLow, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
@ -123,20 +122,17 @@ CBDALNBInfo::put_LocalOscilatorFrequencyHighBand(ULONG ulLOFHigh)
|
|||
{
|
||||
KSP_NODE Node;
|
||||
HRESULT hr;
|
||||
ULONG BytesReturned;
|
||||
|
||||
// setup request
|
||||
Node.Property.Set = KSPROPSETID_BdaLNBInfo;
|
||||
Node.Property.Id = KSPROPERTY_BDA_LNB_LOF_HIGH_BAND;
|
||||
Node.Property.Flags = KSPROPERTY_TYPE_SET | KSPROPERTY_TYPE_TOPOLOGY;
|
||||
Node.NodeId = m_NodeId;
|
||||
Node.Reserved = 0;
|
||||
|
||||
// perform request
|
||||
hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), &ulLOFHigh, sizeof(ULONG), &BytesReturned);
|
||||
hr = m_pProperty->Set(KSPROPSETID_BdaLNBInfo, KSPROPERTY_BDA_LNB_LOF_HIGH_BAND, &Node.NodeId, sizeof(KSP_NODE)-sizeof(KSPROPERTY), &ulLOFHigh, sizeof(ULONG));
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDALNBInfo::put_LocalOscilatorFrequencyHighBand: m_NodeId %lu hr %lx, BytesReturned %lu\n", m_NodeId, hr, BytesReturned);
|
||||
swprintf(Buffer, L"CBDALNBInfo::put_LocalOscilatorFrequencyHighBand: m_NodeId %lu ulLOFHigh %lu hr %lx\n", m_NodeId, ulLOFHigh, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
@ -156,20 +152,17 @@ CBDALNBInfo::put_HighLowSwitchFrequency(ULONG ulSwitchFrequency)
|
|||
{
|
||||
KSP_NODE Node;
|
||||
HRESULT hr;
|
||||
ULONG BytesReturned;
|
||||
|
||||
// setup request
|
||||
Node.Property.Set = KSPROPSETID_BdaLNBInfo;
|
||||
Node.Property.Id = KSPROPERTY_BDA_LNB_SWITCH_FREQUENCY;
|
||||
Node.Property.Flags = KSPROPERTY_TYPE_SET | KSPROPERTY_TYPE_TOPOLOGY;
|
||||
Node.NodeId = m_NodeId;
|
||||
Node.Reserved = 0;
|
||||
|
||||
// perform request
|
||||
hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), &ulSwitchFrequency, sizeof(ULONG), &BytesReturned);
|
||||
hr = m_pProperty->Set(KSPROPSETID_BdaLNBInfo, KSPROPERTY_BDA_LNB_SWITCH_FREQUENCY, &Node.NodeId, sizeof(KSP_NODE)-sizeof(KSPROPERTY), &ulSwitchFrequency, sizeof(ULONG));
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDALNBInfo::put_HighLowSwitchFrequency: m_NodeId %lu hr %lx, BytesReturned %lu\n", m_NodeId, hr, BytesReturned);
|
||||
swprintf(Buffer, L"CBDALNBInfo::put_HighLowSwitchFrequency: m_NodeId %lu ulSwitchFrequency %lu hr %lx\n", m_NodeId, ulSwitchFrequency, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
@ -186,13 +179,13 @@ CBDALNBInfo::get_HighLowSwitchFrequency(ULONG *pulSwitchFrequency)
|
|||
HRESULT
|
||||
WINAPI
|
||||
CBDALNBInfo_fnConstructor(
|
||||
HANDLE hFile,
|
||||
IKsPropertySet *pProperty,
|
||||
ULONG NodeId,
|
||||
REFIID riid,
|
||||
LPVOID * ppv)
|
||||
{
|
||||
// construct device control
|
||||
CBDALNBInfo * handler = new CBDALNBInfo(hFile, NodeId);
|
||||
CBDALNBInfo * handler = new CBDALNBInfo(pProperty, NodeId);
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
OutputDebugStringW(L"CBDALNBInfo_fnConstructor\n");
|
||||
|
|
|
@ -9,9 +9,12 @@
|
|||
|
||||
#include "precomp.h"
|
||||
|
||||
const GUID IID_IBDA_PinControl = {0x0DED49D5, 0xA8B7, 0x4d5d, {0x97, 0xA1, 0x12, 0xB0, 0xC1, 0x95, 0x87, 0x4D}};
|
||||
#ifndef _MSC_VER
|
||||
const GUID KSPROPSETID_BdaPinControl = {0x0ded49d5, 0xa8b7, 0x4d5d, {0x97, 0xa1, 0x12, 0xb0, 0xc1, 0x95, 0x87, 0x4d}};
|
||||
const GUID IID_IBDA_PinControl = {0x0DED49D5, 0xA8B7, 0x4d5d, {0x97, 0xA1, 0x12, 0xB0, 0xC1, 0x95, 0x87, 0x4D}};
|
||||
const GUID IID_IPin = {0x56a86891, 0x0ad4, 0x11ce, {0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
|
||||
#endif
|
||||
|
||||
|
||||
class CBDAPinControl : public IBDA_PinControl
|
||||
{
|
||||
|
@ -39,7 +42,7 @@ public:
|
|||
HRESULT STDMETHODCALLTYPE RegistrationContext(ULONG *pulRegistrationCtx);
|
||||
|
||||
|
||||
CBDAPinControl(HANDLE hFile, IBDA_NetworkProvider * pProvider, IPin * pConnectedPin) : m_Ref(0), m_Handle(hFile), m_pProvider(pProvider), m_pConnectedPin(pConnectedPin){};
|
||||
CBDAPinControl(HANDLE hFile, IBDA_NetworkProvider * pProvider, IPin * pConnectedPin, ULONG RegistrationCtx) : m_Ref(0), m_Handle(hFile), m_pProvider(pProvider), m_pConnectedPin(pConnectedPin), m_RegistrationCtx(RegistrationCtx){};
|
||||
virtual ~CBDAPinControl()
|
||||
{
|
||||
//m_pConnectedPin->Release();
|
||||
|
@ -51,6 +54,7 @@ protected:
|
|||
HANDLE m_Handle;
|
||||
IBDA_NetworkProvider * m_pProvider;
|
||||
IPin * m_pConnectedPin;
|
||||
ULONG m_RegistrationCtx;
|
||||
};
|
||||
|
||||
HRESULT
|
||||
|
@ -72,16 +76,7 @@ CBDAPinControl::QueryInterface(
|
|||
reinterpret_cast<IBDA_PinControl*>(*Output)->AddRef();
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[MAX_PATH];
|
||||
LPOLESTR lpstr;
|
||||
StringFromCLSID(refiid, &lpstr);
|
||||
swprintf(Buffer, L"CBDAPinControl::QueryInterface: NoInterface for %s", lpstr);
|
||||
OutputDebugStringW(Buffer);
|
||||
CoTaskMemFree(lpstr);
|
||||
#endif
|
||||
|
||||
DebugBreak();
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
|
@ -142,10 +137,98 @@ STDMETHODCALLTYPE
|
|||
CBDAPinControl::RegistrationContext(ULONG *pulRegistrationCtx)
|
||||
{
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
OutputDebugStringW(L"CBDAPinControl::RegistrationContext: NotImplemented\n");
|
||||
OutputDebugStringW(L"CBDAPinControl::RegistrationContext\n");
|
||||
#endif
|
||||
|
||||
return E_NOTIMPL;
|
||||
if (!pulRegistrationCtx)
|
||||
{
|
||||
// invalid argument
|
||||
return E_POINTER;
|
||||
}
|
||||
|
||||
if (m_RegistrationCtx)
|
||||
{
|
||||
// is registered
|
||||
*pulRegistrationCtx = m_RegistrationCtx;
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
//pin not registered
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
HRESULT
|
||||
GetNetworkProviderFromGraph(
|
||||
IFilterGraph * pGraph,
|
||||
IBDA_NetworkProvider ** pOutNetworkProvider)
|
||||
{
|
||||
IEnumFilters *pEnumFilters = NULL;
|
||||
IBaseFilter * ppFilter[1];
|
||||
IBDA_NetworkProvider * pNetworkProvider = NULL;
|
||||
HRESULT hr;
|
||||
|
||||
// get IEnumFilters interface
|
||||
hr = pGraph->EnumFilters(&pEnumFilters);
|
||||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
//clean up
|
||||
*pOutNetworkProvider = NULL;
|
||||
return hr;
|
||||
}
|
||||
|
||||
while(pEnumFilters->Next(1, ppFilter, NULL) == S_OK)
|
||||
{
|
||||
// check if that filter supports the IBDA_NetworkProvider interface
|
||||
hr = ppFilter[0]->QueryInterface(IID_IBDA_NetworkProvider, (void**)&pNetworkProvider);
|
||||
|
||||
// release IBaseFilter
|
||||
ppFilter[0]->Release();
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
break;
|
||||
}
|
||||
|
||||
// release IEnumFilters interface
|
||||
pEnumFilters->Release();
|
||||
|
||||
//store result
|
||||
*pOutNetworkProvider = pNetworkProvider;
|
||||
|
||||
if (pNetworkProvider)
|
||||
return S_OK;
|
||||
else
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
CBDAPinControl_RealConstructor(
|
||||
HANDLE hPin,
|
||||
IBDA_NetworkProvider *pNetworkProvider,
|
||||
IPin * pConnectedPin,
|
||||
ULONG RegistrationCtx,
|
||||
IUnknown * pUnkOuter,
|
||||
REFIID riid,
|
||||
LPVOID * ppv)
|
||||
{
|
||||
CBDAPinControl * handler = new CBDAPinControl(hPin, pNetworkProvider, pConnectedPin, RegistrationCtx);
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
OutputDebugStringW(L"CBDAPinControl_fnConstructor\n");
|
||||
#endif
|
||||
|
||||
if (!handler)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
if (FAILED(handler->QueryInterface(riid, ppv)))
|
||||
{
|
||||
/* not supported */
|
||||
delete handler;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
|
@ -158,30 +241,20 @@ CBDAPinControl_fnConstructor(
|
|||
IPin * pConnectedPin = NULL;
|
||||
IBDA_NetworkProvider * pNetworkProvider = NULL;
|
||||
HANDLE hFile = INVALID_HANDLE_VALUE;
|
||||
|
||||
#if 0
|
||||
if (!IsEqualGUID(riid, IID_IUnknown))
|
||||
{
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
OutputDebugStringW(L"CBDAPinControl_fnConstructor: Expected IUnknown\n");
|
||||
#endif
|
||||
return REGDB_E_CLASSNOTREG;
|
||||
}
|
||||
|
||||
|
||||
HRESULT hr;
|
||||
IKsObject * pObject = NULL;
|
||||
IPin * pPin = NULL;
|
||||
IEnumFilters *pEnumFilters = NULL;
|
||||
|
||||
IBaseFilter * ppFilter[1];
|
||||
IUnknown * pUnknown = NULL;
|
||||
PIN_INFO PinInfo;
|
||||
FILTER_INFO FilterInfo;
|
||||
|
||||
ULONG RegistrationCtx = 0;
|
||||
|
||||
if (!pUnkOuter)
|
||||
return E_POINTER;
|
||||
|
||||
OutputDebugStringW(L"CBDAPinControl_fnConstructor\n");
|
||||
//DebugBreak();
|
||||
|
||||
// query for IKsObject interface
|
||||
hr = pUnkOuter->QueryInterface(IID_IKsObject, (void**)&pObject);
|
||||
|
||||
|
@ -209,8 +282,15 @@ CBDAPinControl_fnConstructor(
|
|||
return hr;
|
||||
}
|
||||
|
||||
if (!PinInfo.pFilter)
|
||||
{
|
||||
//clean up
|
||||
pObject->Release();
|
||||
pPin->Release();
|
||||
return hr;
|
||||
}
|
||||
|
||||
// sanity checks
|
||||
assert(PinInfo.dir == PINDIR_OUTPUT);
|
||||
assert(PinInfo.pFilter != NULL);
|
||||
|
||||
// query filter info
|
||||
|
@ -219,57 +299,80 @@ CBDAPinControl_fnConstructor(
|
|||
// sanity check
|
||||
assert(FilterInfo.pGraph != NULL);
|
||||
|
||||
// get IEnumFilters interface
|
||||
hr = FilterInfo.pGraph->EnumFilters(&pEnumFilters);
|
||||
// get network provider interface
|
||||
hr = GetNetworkProviderFromGraph(FilterInfo.pGraph, &pNetworkProvider);
|
||||
|
||||
if (FAILED(hr))
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
//clean up
|
||||
FilterInfo.pGraph->Release();
|
||||
PinInfo.pFilter->Release();
|
||||
pObject->Release();
|
||||
pPin->Release();
|
||||
return hr;
|
||||
if (PinInfo.dir == PINDIR_OUTPUT)
|
||||
{
|
||||
// get connected pin handle
|
||||
hr = pPin->ConnectedTo(&pConnectedPin);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
// get file handle
|
||||
hFile = pObject->KsGetObjectHandle();
|
||||
if (hFile)
|
||||
{
|
||||
hr = CBDAPinControl_RealConstructor(hFile, pNetworkProvider, pConnectedPin, 0, pUnkOuter, riid, ppv);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
// set to null to prevent releasing
|
||||
pNetworkProvider = NULL;
|
||||
pConnectedPin = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// expected file handle
|
||||
hr = E_UNEXPECTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// get IUnknown from base filter
|
||||
hr = PinInfo.pFilter->QueryInterface(IID_IUnknown, (void**)&pUnknown);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
// register device filter
|
||||
hr = pNetworkProvider->RegisterDeviceFilter(pUnknown, &RegistrationCtx);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
// get file handle
|
||||
hFile = pObject->KsGetObjectHandle();
|
||||
if (hFile)
|
||||
{
|
||||
hr = CBDAPinControl_RealConstructor(hFile, pNetworkProvider, NULL, RegistrationCtx, pUnkOuter, riid, ppv);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
// set to null to prevent releasing
|
||||
pNetworkProvider = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// expected file handle
|
||||
hr = E_UNEXPECTED;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDAPinControl_fnConstructor failed to register filter with %lx\n", hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
DebugBreak();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while(pEnumFilters->Next(1, ppFilter, NULL) == S_OK)
|
||||
{
|
||||
// check if that filter supports the IBDA_NetworkProvider interface
|
||||
hr = ppFilter[0]->QueryInterface(IID_IBDA_NetworkProvider, (void**)&pNetworkProvider);
|
||||
|
||||
// release IBaseFilter
|
||||
ppFilter[0]->Release();
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
break;
|
||||
}
|
||||
|
||||
// release IEnumFilters interface
|
||||
pEnumFilters->Release();
|
||||
|
||||
// release IFilterGraph interface
|
||||
FilterInfo.pGraph->Release();
|
||||
|
||||
// release IBaseFilter interface
|
||||
PinInfo.pFilter->Release();
|
||||
|
||||
if (pNetworkProvider)
|
||||
{
|
||||
// get connected pin handle
|
||||
hr = pPin->ConnectedTo(&pConnectedPin);
|
||||
|
||||
// get file handle
|
||||
hFile = pObject->KsGetObjectHandle();
|
||||
|
||||
if (FAILED(hr) || hFile == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
// pin not connected
|
||||
pNetworkProvider->Release();
|
||||
// set zero
|
||||
pNetworkProvider = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// release IPin
|
||||
pPin->Release();
|
||||
|
||||
|
@ -277,30 +380,23 @@ CBDAPinControl_fnConstructor(
|
|||
pObject->Release();
|
||||
|
||||
|
||||
if (pNetworkProvider == NULL)
|
||||
if (pNetworkProvider)
|
||||
{
|
||||
// no network provider interface in graph
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
#endif
|
||||
|
||||
CBDAPinControl * handler = new CBDAPinControl(hFile, pNetworkProvider, pConnectedPin);
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
OutputDebugStringW(L"CBDAPinControl_fnConstructor");
|
||||
#endif
|
||||
|
||||
DebugBreak();
|
||||
|
||||
if (!handler)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
if (FAILED(handler->QueryInterface(riid, ppv)))
|
||||
{
|
||||
/* not supported */
|
||||
delete handler;
|
||||
return E_NOINTERFACE;
|
||||
// release network provider
|
||||
pNetworkProvider->Release();
|
||||
}
|
||||
|
||||
return NOERROR;
|
||||
if (pConnectedPin)
|
||||
{
|
||||
// release connected pin
|
||||
pConnectedPin->Release();
|
||||
}
|
||||
|
||||
if (pUnknown)
|
||||
{
|
||||
// release filter
|
||||
pUnknown->Release();
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef PRECOMP_H__
|
||||
#define PRECOMP_H__
|
||||
|
||||
//#define BDAPLGIN_TRACE
|
||||
#define BDAPLGIN_TRACE
|
||||
#define BUILDING_KS
|
||||
#define _KSDDK_
|
||||
#include <dshow.h>
|
||||
|
@ -9,6 +9,7 @@
|
|||
#include <ks.h>
|
||||
#define __STREAMS__
|
||||
#include <ksproxy.h>
|
||||
#include <ksmedia.h>
|
||||
#include <stdio.h>
|
||||
#include <wchar.h>
|
||||
#include <tchar.h>
|
||||
|
@ -55,7 +56,6 @@ CBDAPinControl_fnConstructor(
|
|||
HRESULT
|
||||
WINAPI
|
||||
CControlNode_fnConstructor(
|
||||
HANDLE hFile,
|
||||
IBaseFilter * pFilter,
|
||||
ULONG NodeType,
|
||||
ULONG PinId,
|
||||
|
@ -67,7 +67,7 @@ CControlNode_fnConstructor(
|
|||
HRESULT
|
||||
WINAPI
|
||||
CBDAFrequencyFilter_fnConstructor(
|
||||
HANDLE hFile,
|
||||
IKsPropertySet * pProperty,
|
||||
ULONG NodeId,
|
||||
REFIID riid,
|
||||
LPVOID * ppv);
|
||||
|
@ -77,7 +77,7 @@ CBDAFrequencyFilter_fnConstructor(
|
|||
HRESULT
|
||||
WINAPI
|
||||
CBDASignalStatistics_fnConstructor(
|
||||
HANDLE hFile,
|
||||
IKsPropertySet * pProperty,
|
||||
ULONG NodeId,
|
||||
REFIID riid,
|
||||
LPVOID * ppv);
|
||||
|
@ -87,7 +87,7 @@ CBDASignalStatistics_fnConstructor(
|
|||
HRESULT
|
||||
WINAPI
|
||||
CBDALNBInfo_fnConstructor(
|
||||
HANDLE hFile,
|
||||
IKsPropertySet * pProperty,
|
||||
ULONG NodeId,
|
||||
REFIID riid,
|
||||
LPVOID * ppv);
|
||||
|
@ -96,9 +96,11 @@ CBDALNBInfo_fnConstructor(
|
|||
HRESULT
|
||||
WINAPI
|
||||
CBDADigitalDemodulator_fnConstructor(
|
||||
HANDLE hFile,
|
||||
IKsPropertySet * pProperty,
|
||||
ULONG NodeId,
|
||||
REFIID riid,
|
||||
LPVOID * ppv);
|
||||
|
||||
extern const GUID IID_IKsObject;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -9,8 +9,10 @@
|
|||
|
||||
#include "precomp.h"
|
||||
|
||||
#ifndef _MSC_VER
|
||||
const GUID IID_IBDA_SignalStatistics = {0x1347d106, 0xcf3a, 0x428a, {0xa5, 0xcb, 0xac, 0x0d, 0x9a, 0x2a, 0x43, 0x38}};
|
||||
const GUID KSPROPSETID_BdaSignalStats = {0x1347d106, 0xcf3a, 0x428a, {0xa5, 0xcb, 0xac, 0xd, 0x9a, 0x2a, 0x43, 0x38}};
|
||||
#endif
|
||||
|
||||
class CBDASignalStatistics : public IBDA_SignalStatistics
|
||||
{
|
||||
|
@ -45,12 +47,12 @@ public:
|
|||
HRESULT STDMETHODCALLTYPE put_SampleTime(LONG lmsSampleTime);
|
||||
HRESULT STDMETHODCALLTYPE get_SampleTime(LONG *plmsSampleTime);
|
||||
|
||||
CBDASignalStatistics(HANDLE hFile, ULONG NodeId) : m_Ref(0), m_hFile(hFile), m_NodeId(NodeId){};
|
||||
CBDASignalStatistics(IKsPropertySet * pProperty, ULONG NodeId) : m_Ref(0), m_pProperty(pProperty), m_NodeId(NodeId){};
|
||||
~CBDASignalStatistics(){};
|
||||
|
||||
protected:
|
||||
LONG m_Ref;
|
||||
HANDLE m_hFile;
|
||||
IKsPropertySet * m_pProperty;
|
||||
ULONG m_NodeId;
|
||||
};
|
||||
|
||||
|
@ -75,7 +77,6 @@ CBDASignalStatistics::QueryInterface(
|
|||
reinterpret_cast<IBDA_SignalStatistics*>(*Output)->AddRef();
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
@ -95,13 +96,13 @@ CBDASignalStatistics::get_SignalStrength(LONG *plDbStrength)
|
|||
ULONG BytesReturned;
|
||||
|
||||
// setup request
|
||||
Node.Property.Set = KSPROPSETID_BdaSignalStats;
|
||||
Node.Property.Id = KSPROPERTY_BDA_SIGNAL_STRENGTH;
|
||||
Node.Property.Flags = KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_TOPOLOGY;
|
||||
Node.NodeId = (ULONG)-1;
|
||||
Node.Reserved = 0;
|
||||
|
||||
assert(m_pProperty);
|
||||
|
||||
hr = m_pProperty->Get(KSPROPSETID_BdaSignalStats, KSPROPERTY_BDA_SIGNAL_STRENGTH, &Node.NodeId, sizeof(KSP_NODE)-sizeof(KSPROPERTY), plDbStrength, sizeof(LONG), &BytesReturned);
|
||||
|
||||
// perform request
|
||||
hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), plDbStrength, sizeof(LONG), &BytesReturned);
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
|
@ -128,13 +129,11 @@ CBDASignalStatistics::get_SignalQuality(LONG *plPercentQuality)
|
|||
ULONG BytesReturned;
|
||||
|
||||
// setup request
|
||||
Node.Property.Set = KSPROPSETID_BdaSignalStats;
|
||||
Node.Property.Id = KSPROPERTY_BDA_SIGNAL_QUALITY;
|
||||
Node.Property.Flags = KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_TOPOLOGY;
|
||||
Node.NodeId = (ULONG)-1;
|
||||
Node.Reserved = 0;
|
||||
|
||||
// perform request
|
||||
hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), plPercentQuality, sizeof(LONG), &BytesReturned);
|
||||
hr = m_pProperty->Get(KSPROPSETID_BdaSignalStats, KSPROPERTY_BDA_SIGNAL_QUALITY, &Node.NodeId, sizeof(KSP_NODE)-sizeof(KSPROPERTY), plPercentQuality, sizeof(LONG), &BytesReturned);
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
|
@ -162,13 +161,12 @@ CBDASignalStatistics::get_SignalPresent(BOOLEAN *pfPresent)
|
|||
ULONG BytesReturned;
|
||||
|
||||
// setup request
|
||||
Node.Property.Set = KSPROPSETID_BdaSignalStats;
|
||||
Node.Property.Id = KSPROPERTY_BDA_SIGNAL_PRESENT;
|
||||
Node.Property.Flags = KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_TOPOLOGY;
|
||||
Node.NodeId = (ULONG)-1;
|
||||
Node.Reserved = 0;
|
||||
|
||||
// perform request
|
||||
hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), &Present, sizeof(ULONG), &BytesReturned);
|
||||
hr = m_pProperty->Get(KSPROPSETID_BdaSignalStats, KSPROPERTY_BDA_SIGNAL_PRESENT, &Node.NodeId, sizeof(KSP_NODE)-sizeof(KSPROPERTY), &Present, sizeof(ULONG), &BytesReturned);
|
||||
|
||||
// store result
|
||||
*pfPresent = Present;
|
||||
|
||||
|
@ -198,13 +196,12 @@ CBDASignalStatistics::get_SignalLocked(BOOLEAN *pfLocked)
|
|||
ULONG BytesReturned;
|
||||
|
||||
// setup request
|
||||
Node.Property.Set = KSPROPSETID_BdaSignalStats;
|
||||
Node.Property.Id = KSPROPERTY_BDA_SIGNAL_LOCKED;
|
||||
Node.Property.Flags = KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_TOPOLOGY;
|
||||
Node.NodeId = (ULONG)-1;
|
||||
Node.Reserved = 0;
|
||||
|
||||
// perform request
|
||||
hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), &Locked, sizeof(ULONG), &BytesReturned);
|
||||
hr = m_pProperty->Get(KSPROPSETID_BdaSignalStats, KSPROPERTY_BDA_SIGNAL_LOCKED, &Node.NodeId, sizeof(KSP_NODE)-sizeof(KSPROPERTY), &Locked, sizeof(ULONG), &BytesReturned);
|
||||
|
||||
*pfLocked = Locked;
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
|
@ -222,20 +219,17 @@ CBDASignalStatistics::put_SampleTime(LONG lmsSampleTime)
|
|||
{
|
||||
KSP_NODE Node;
|
||||
HRESULT hr;
|
||||
ULONG BytesReturned;
|
||||
|
||||
// setup request
|
||||
Node.Property.Set = KSPROPSETID_BdaSignalStats;
|
||||
Node.Property.Id = KSPROPERTY_BDA_SAMPLE_TIME;
|
||||
Node.Property.Flags = KSPROPERTY_TYPE_SET | KSPROPERTY_TYPE_TOPOLOGY;
|
||||
Node.NodeId = (ULONG)-1;
|
||||
Node.Reserved = 0;
|
||||
|
||||
// perform request
|
||||
hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), &lmsSampleTime, sizeof(LONG), &BytesReturned);
|
||||
hr = m_pProperty->Set(KSPROPSETID_BdaSignalStats, KSPROPERTY_BDA_SAMPLE_TIME, &Node.NodeId, sizeof(KSP_NODE)-sizeof(KSPROPERTY), &lmsSampleTime, sizeof(LONG));
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CBDASignalStatistics::put_SampleTime: m_NodeId %lu hr %lx, BytesReturned %lu\n", m_NodeId, hr, BytesReturned);
|
||||
swprintf(Buffer, L"CBDASignalStatistics::put_SampleTime: m_NodeId %lu hr %lx\n", m_NodeId, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
@ -251,13 +245,11 @@ CBDASignalStatistics::get_SampleTime(LONG *plmsSampleTime)
|
|||
ULONG BytesReturned;
|
||||
|
||||
// setup request
|
||||
Node.Property.Set = KSPROPSETID_BdaSignalStats;
|
||||
Node.Property.Id = KSPROPERTY_BDA_SAMPLE_TIME;
|
||||
Node.Property.Flags = KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_TOPOLOGY;
|
||||
Node.NodeId = (ULONG)-1;
|
||||
Node.Reserved = 0;
|
||||
|
||||
// perform request
|
||||
hr = KsSynchronousDeviceControl(m_hFile, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), plmsSampleTime, sizeof(LONG), &BytesReturned);
|
||||
hr = m_pProperty->Get(KSPROPSETID_BdaSignalStats, KSPROPERTY_BDA_SAMPLE_TIME, &Node.NodeId, sizeof(KSP_NODE)-sizeof(KSPROPERTY), plmsSampleTime, sizeof(LONG), &BytesReturned);
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
WCHAR Buffer[100];
|
||||
|
@ -271,13 +263,13 @@ CBDASignalStatistics::get_SampleTime(LONG *plmsSampleTime)
|
|||
HRESULT
|
||||
WINAPI
|
||||
CBDASignalStatistics_fnConstructor(
|
||||
HANDLE hFile,
|
||||
IKsPropertySet * pProperty,
|
||||
ULONG NodeId,
|
||||
REFIID riid,
|
||||
LPVOID * ppv)
|
||||
{
|
||||
// construct device control
|
||||
CBDASignalStatistics * handler = new CBDASignalStatistics(hFile, NodeId);
|
||||
CBDASignalStatistics * handler = new CBDASignalStatistics(pProperty, NodeId);
|
||||
|
||||
#ifdef BDAPLGIN_TRACE
|
||||
OutputDebugStringW(L"CBDASignalStatistics_fnConstructor\n");
|
||||
|
|
|
@ -15,6 +15,9 @@ class CKsAllocator : public IKsAllocatorEx,
|
|||
public IMemAllocatorCallbackTemp
|
||||
{
|
||||
public:
|
||||
typedef std::stack<IMediaSample *>MediaSampleStack;
|
||||
typedef std::list<IMediaSample *>MediaSampleList;
|
||||
|
||||
STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
|
||||
|
||||
STDMETHODIMP_(ULONG) AddRef()
|
||||
|
@ -58,9 +61,9 @@ public:
|
|||
HRESULT STDMETHODCALLTYPE GetFreeCount(LONG *plBuffersFree);
|
||||
|
||||
|
||||
CKsAllocator() : m_Ref(0), m_hAllocator(0), m_Mode(KsAllocatorMode_User), m_Notify(0), m_Allocated(0), m_FreeCount(0), m_cbBuffer(0), m_cBuffers(0), m_cbAlign(0), m_cbPrefix(0){}
|
||||
CKsAllocator();
|
||||
virtual ~CKsAllocator(){}
|
||||
|
||||
VOID STDMETHODCALLTYPE FreeMediaSamples();
|
||||
protected:
|
||||
LONG m_Ref;
|
||||
HANDLE m_hAllocator;
|
||||
|
@ -68,11 +71,16 @@ protected:
|
|||
ALLOCATOR_PROPERTIES_EX m_Properties;
|
||||
IMemAllocatorNotifyCallbackTemp *m_Notify;
|
||||
ULONG m_Allocated;
|
||||
ULONG m_FreeCount;
|
||||
ULONG m_cbBuffer;
|
||||
ULONG m_cBuffers;
|
||||
ULONG m_cbAlign;
|
||||
ULONG m_cbPrefix;
|
||||
LONG m_cbBuffer;
|
||||
LONG m_cBuffers;
|
||||
LONG m_cbAlign;
|
||||
LONG m_cbPrefix;
|
||||
BOOL m_Commited;
|
||||
CRITICAL_SECTION m_CriticalSection;
|
||||
MediaSampleStack m_FreeList;
|
||||
MediaSampleList m_UsedList;
|
||||
LPVOID m_Buffer;
|
||||
BOOL m_FreeSamples;
|
||||
};
|
||||
|
||||
|
||||
|
@ -93,14 +101,33 @@ CKsAllocator::QueryInterface(
|
|||
if (IsEqualGUID(refiid, IID_IMemAllocator) ||
|
||||
IsEqualGUID(refiid, IID_IMemAllocatorCallbackTemp))
|
||||
{
|
||||
*Output = (IDistributorNotify*)(this);
|
||||
reinterpret_cast<IDistributorNotify*>(*Output)->AddRef();
|
||||
*Output = (IMemAllocatorCallbackTemp*)(this);
|
||||
reinterpret_cast<IMemAllocatorCallbackTemp*>(*Output)->AddRef();
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
CKsAllocator::CKsAllocator() : m_Ref(0),
|
||||
m_hAllocator(0),
|
||||
m_Mode(KsAllocatorMode_User),
|
||||
m_Notify(0),
|
||||
m_Allocated(0),
|
||||
m_cbBuffer(0),
|
||||
m_cBuffers(0),
|
||||
m_cbAlign(0),
|
||||
m_cbPrefix(0),
|
||||
m_Commited(FALSE),
|
||||
m_FreeList(),
|
||||
m_UsedList(),
|
||||
m_Buffer(0),
|
||||
m_FreeSamples(FALSE)
|
||||
{
|
||||
InitializeCriticalSection(&m_CriticalSection);
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// IMemAllocator
|
||||
//
|
||||
|
@ -112,7 +139,11 @@ CKsAllocator::SetProperties(
|
|||
{
|
||||
SYSTEM_INFO SystemInfo;
|
||||
|
||||
OutputDebugStringW(L"CKsAllocator::SetProperties Stub\n");
|
||||
EnterCriticalSection(&m_CriticalSection);
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsAllocator::SetProperties\n");
|
||||
#endif
|
||||
|
||||
if (!pRequest || !pActual)
|
||||
return E_POINTER;
|
||||
|
@ -126,18 +157,28 @@ CKsAllocator::SetProperties(
|
|||
if (!pRequest->cbAlign || (pRequest->cbAlign - 1) & SystemInfo.dwAllocationGranularity)
|
||||
{
|
||||
// bad alignment
|
||||
LeaveCriticalSection(&m_CriticalSection);
|
||||
return VFW_E_BADALIGN;
|
||||
}
|
||||
|
||||
if (m_Mode == KsAllocatorMode_Kernel)
|
||||
{
|
||||
// u cannt change a kernel allocator
|
||||
// u can't change a kernel allocator
|
||||
LeaveCriticalSection(&m_CriticalSection);
|
||||
return VFW_E_ALREADY_COMMITTED;
|
||||
}
|
||||
|
||||
if (m_Allocated != m_FreeCount)
|
||||
if (m_Commited)
|
||||
{
|
||||
// need to decommit first
|
||||
LeaveCriticalSection(&m_CriticalSection);
|
||||
return VFW_E_ALREADY_COMMITTED;
|
||||
}
|
||||
|
||||
if (m_Allocated != m_FreeList.size())
|
||||
{
|
||||
// outstanding buffers
|
||||
LeaveCriticalSection(&m_CriticalSection);
|
||||
return VFW_E_BUFFERS_OUTSTANDING;
|
||||
}
|
||||
|
||||
|
@ -146,6 +187,7 @@ CKsAllocator::SetProperties(
|
|||
pActual->cbPrefix = m_cbPrefix = pRequest->cbPrefix;
|
||||
pActual->cBuffers = m_cBuffers = pRequest->cBuffers;
|
||||
|
||||
LeaveCriticalSection(&m_CriticalSection);
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
|
@ -169,28 +211,130 @@ HRESULT
|
|||
STDMETHODCALLTYPE
|
||||
CKsAllocator::Commit()
|
||||
{
|
||||
LONG Index;
|
||||
PUCHAR CurrentBuffer;
|
||||
IMediaSample * Sample;
|
||||
HRESULT hr;
|
||||
|
||||
//TODO integer overflow checks
|
||||
EnterCriticalSection(&m_CriticalSection);
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsAllocator::Commit\n");
|
||||
#endif
|
||||
|
||||
if (m_Mode == KsAllocatorMode_Kernel)
|
||||
{
|
||||
/* no-op for kernel allocator */
|
||||
LeaveCriticalSection(&m_CriticalSection);
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
OutputDebugStringW(L"CKsAllocator::Commit NotImplemented\n");
|
||||
return E_NOTIMPL;
|
||||
if (m_Commited)
|
||||
{
|
||||
// already commited
|
||||
LeaveCriticalSection(&m_CriticalSection);
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
if (m_cbBuffer < 0 || m_cBuffers < 0 || m_cbPrefix < 0)
|
||||
{
|
||||
// invalid parameter
|
||||
LeaveCriticalSection(&m_CriticalSection);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
LONG Size = m_cbBuffer + m_cbPrefix;
|
||||
|
||||
if (m_cbAlign > 1)
|
||||
{
|
||||
//check alignment
|
||||
LONG Mod = Size % m_cbAlign;
|
||||
if (Mod)
|
||||
{
|
||||
// calculate aligned size
|
||||
Size += m_cbAlign - Mod;
|
||||
}
|
||||
}
|
||||
|
||||
LONG TotalSize = Size * m_cBuffers;
|
||||
|
||||
assert(TotalSize);
|
||||
assert(m_cBuffers);
|
||||
assert(Size);
|
||||
|
||||
// now allocate buffer
|
||||
m_Buffer = VirtualAlloc(NULL, TotalSize, MEM_COMMIT, PAGE_READWRITE);
|
||||
if (!m_Buffer)
|
||||
{
|
||||
LeaveCriticalSection(&m_CriticalSection);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
ZeroMemory(m_Buffer, TotalSize);
|
||||
|
||||
CurrentBuffer = (PUCHAR)m_Buffer;
|
||||
|
||||
for (Index = 0; Index < m_cBuffers; Index++)
|
||||
{
|
||||
// construct media sample
|
||||
hr = CMediaSample_Constructor((IMemAllocator*)this, CurrentBuffer + m_cbPrefix, m_cbBuffer, IID_IMediaSample, (void**)&Sample);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
LeaveCriticalSection(&m_CriticalSection);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
// add to free list
|
||||
m_FreeList.push(Sample);
|
||||
m_Allocated++;
|
||||
|
||||
//next sample buffer
|
||||
CurrentBuffer += Size;
|
||||
}
|
||||
|
||||
// we are now commited
|
||||
m_Commited = true;
|
||||
|
||||
LeaveCriticalSection(&m_CriticalSection);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CKsAllocator::Decommit()
|
||||
{
|
||||
EnterCriticalSection(&m_CriticalSection);
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsAllocator::Decommit\n");
|
||||
#endif
|
||||
|
||||
if (m_Mode == KsAllocatorMode_Kernel)
|
||||
{
|
||||
/* no-op for kernel allocator */
|
||||
return NOERROR;
|
||||
LeaveCriticalSection(&m_CriticalSection);
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
OutputDebugStringW(L"CKsAllocator::Decommit NotImplemented\n");
|
||||
return E_NOTIMPL;
|
||||
m_Commited = false;
|
||||
|
||||
if (m_Allocated != m_FreeList.size())
|
||||
{
|
||||
// outstanding buffers
|
||||
m_FreeSamples = true;
|
||||
LeaveCriticalSection(&m_CriticalSection);
|
||||
return NOERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
// no outstanding buffers
|
||||
// free to free them
|
||||
FreeMediaSamples();
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&m_CriticalSection);
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
|
||||
|
@ -202,8 +346,50 @@ CKsAllocator::GetBuffer(
|
|||
REFERENCE_TIME *pEndTime,
|
||||
DWORD dwFlags)
|
||||
{
|
||||
OutputDebugStringW(L"CKsAllocator::GetBuffer NotImplemented\n");
|
||||
return E_NOTIMPL;
|
||||
IMediaSample * Sample = NULL;
|
||||
|
||||
if (!m_Commited)
|
||||
return VFW_E_NOT_COMMITTED;
|
||||
|
||||
do
|
||||
{
|
||||
EnterCriticalSection(&m_CriticalSection);
|
||||
|
||||
if (!m_FreeList.empty())
|
||||
{
|
||||
Sample = m_FreeList.top();
|
||||
m_FreeList.pop();
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&m_CriticalSection);
|
||||
|
||||
if (dwFlags & AM_GBF_NOWAIT)
|
||||
{
|
||||
// never wait untill a buffer becomes available
|
||||
break;
|
||||
}
|
||||
}
|
||||
while(Sample == NULL);
|
||||
|
||||
if (!Sample)
|
||||
{
|
||||
// no sample acquired
|
||||
//HACKKKKKKK
|
||||
Sample = m_UsedList.back();
|
||||
m_UsedList.pop_back();
|
||||
|
||||
if (!Sample)
|
||||
return VFW_E_TIMEOUT;
|
||||
}
|
||||
|
||||
// store result
|
||||
*ppBuffer = Sample;
|
||||
|
||||
// store sample in used list
|
||||
m_UsedList.push_front(Sample);
|
||||
|
||||
// done
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
|
@ -211,8 +397,36 @@ STDMETHODCALLTYPE
|
|||
CKsAllocator::ReleaseBuffer(
|
||||
IMediaSample *pBuffer)
|
||||
{
|
||||
OutputDebugStringW(L"CKsAllocator::ReleaseBuffer NotImplemented\n");
|
||||
return E_NOTIMPL;
|
||||
EnterCriticalSection(&m_CriticalSection);
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsAllocator::ReleaseBuffer\n");
|
||||
#endif
|
||||
|
||||
// media sample always 1 ref count in free list
|
||||
pBuffer->AddRef();
|
||||
|
||||
// add the sample to the free list
|
||||
m_FreeList.push(pBuffer);
|
||||
|
||||
|
||||
if (m_FreeSamples)
|
||||
{
|
||||
// pending de-commit
|
||||
if (m_FreeList.size () == m_Allocated)
|
||||
{
|
||||
FreeMediaSamples();
|
||||
}
|
||||
}
|
||||
|
||||
if (m_Notify)
|
||||
{
|
||||
//notify caller of an available buffer
|
||||
m_Notify->NotifyRelease();
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&m_CriticalSection);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
@ -223,7 +437,11 @@ STDMETHODCALLTYPE
|
|||
CKsAllocator::SetNotify(
|
||||
IMemAllocatorNotifyCallbackTemp *pNotify)
|
||||
{
|
||||
EnterCriticalSection(&m_CriticalSection);
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsAllocator::SetNotify\n");
|
||||
#endif
|
||||
|
||||
if (pNotify)
|
||||
pNotify->AddRef();
|
||||
|
@ -232,6 +450,8 @@ CKsAllocator::SetNotify(
|
|||
m_Notify->Release();
|
||||
|
||||
m_Notify = pNotify;
|
||||
|
||||
LeaveCriticalSection(&m_CriticalSection);
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
|
@ -240,8 +460,8 @@ STDMETHODCALLTYPE
|
|||
CKsAllocator::GetFreeCount(
|
||||
LONG *plBuffersFree)
|
||||
{
|
||||
OutputDebugStringW(L"CKsAllocator::GetFreeCount NotImplemented\n");
|
||||
return E_NOTIMPL;
|
||||
*plBuffersFree = m_Allocated - m_FreeList.size();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
@ -313,7 +533,9 @@ CKsAllocator::KsCreateAllocatorAndGetHandle(
|
|||
KSALLOCATOR_FRAMING AllocatorFraming;
|
||||
HANDLE hPin;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsAllocator::KsCreateAllocatorAndGetHandle\n");
|
||||
#endif
|
||||
|
||||
if (m_hAllocator)
|
||||
{
|
||||
|
@ -349,6 +571,32 @@ CKsAllocator::KsCreateAllocatorAndGetHandle(
|
|||
return m_hAllocator;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
VOID
|
||||
STDMETHODCALLTYPE
|
||||
CKsAllocator::FreeMediaSamples()
|
||||
{
|
||||
ULONG Index;
|
||||
|
||||
for(Index = 0; Index < m_FreeList.size(); Index++)
|
||||
{
|
||||
IMediaSample * Sample = m_FreeList.top();
|
||||
m_FreeList.pop();
|
||||
delete Sample;
|
||||
}
|
||||
|
||||
m_FreeSamples = false;
|
||||
m_Allocated = 0;
|
||||
|
||||
if (m_Buffer)
|
||||
{
|
||||
// release buffer
|
||||
VirtualFree(m_Buffer, 0, MEM_RELEASE);
|
||||
|
||||
m_Buffer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT
|
||||
WINAPI
|
||||
CKsAllocator_Constructor(
|
||||
|
@ -356,7 +604,9 @@ CKsAllocator_Constructor(
|
|||
REFIID riid,
|
||||
LPVOID * ppv)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsAllocator_Constructor\n");
|
||||
#endif
|
||||
|
||||
CKsAllocator * handler = new CKsAllocator();
|
||||
|
||||
|
|
|
@ -97,7 +97,9 @@ HRESULT
|
|||
STDMETHODCALLTYPE
|
||||
CKsBasicAudio::Stop()
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -105,7 +107,10 @@ HRESULT
|
|||
STDMETHODCALLTYPE
|
||||
CKsBasicAudio::Pause()
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -114,7 +119,10 @@ STDMETHODCALLTYPE
|
|||
CKsBasicAudio::Run(
|
||||
REFERENCE_TIME tStart)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -123,7 +131,9 @@ STDMETHODCALLTYPE
|
|||
CKsBasicAudio::SetSyncSource(
|
||||
IReferenceClock *pClock)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -131,7 +141,10 @@ HRESULT
|
|||
STDMETHODCALLTYPE
|
||||
CKsBasicAudio::NotifyGraphChange()
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -144,7 +157,10 @@ STDMETHODCALLTYPE
|
|||
CKsBasicAudio::GetTypeInfoCount(
|
||||
UINT *pctinfo)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -155,7 +171,9 @@ CKsBasicAudio::GetTypeInfo(
|
|||
LCID lcid,
|
||||
ITypeInfo **ppTInfo)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -168,7 +186,10 @@ CKsBasicAudio::GetIDsOfNames(
|
|||
LCID lcid,
|
||||
DISPID *rgDispId)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -184,7 +205,10 @@ CKsBasicAudio::Invoke(
|
|||
EXCEPINFO *pExcepInfo,
|
||||
UINT *puArgErr)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -197,7 +221,10 @@ STDMETHODCALLTYPE
|
|||
CKsBasicAudio::put_Volume(
|
||||
long lVolume)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -207,7 +234,10 @@ STDMETHODCALLTYPE
|
|||
CKsBasicAudio::get_Volume(
|
||||
long *plVolume)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -217,7 +247,10 @@ STDMETHODCALLTYPE
|
|||
CKsBasicAudio::put_Balance(
|
||||
long lBalance)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -227,7 +260,10 @@ STDMETHODCALLTYPE
|
|||
CKsBasicAudio::get_Balance(
|
||||
long *plBalance)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -238,7 +274,9 @@ CKsBasicAudio_Constructor(
|
|||
REFIID riid,
|
||||
LPVOID * ppv)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsBasicAudio_Constructor\n");
|
||||
#endif
|
||||
|
||||
CKsBasicAudio * handler = new CKsBasicAudio();
|
||||
|
||||
|
|
|
@ -12,6 +12,10 @@
|
|||
const GUID KSCATEGORY_CLOCK = {0x53172480, 0x4791, 0x11D0, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}};
|
||||
#endif
|
||||
|
||||
const GUID IID_IKsClockForwarder = {0x877e4352, 0x6fea, 0x11d0, {0xb8, 0x63, 0x00, 0xaa, 0x00, 0xa2, 0x16, 0xa1}};
|
||||
|
||||
DWORD WINAPI CKsClockForwarder_ThreadStartup(LPVOID lpParameter);
|
||||
|
||||
class CKsClockForwarder : public IDistributorNotify,
|
||||
public IKsObject
|
||||
{
|
||||
|
@ -45,14 +49,38 @@ public:
|
|||
// IKsObject interface
|
||||
HANDLE STDMETHODCALLTYPE KsGetObjectHandle();
|
||||
|
||||
CKsClockForwarder(HANDLE handle) : m_Ref(0), m_Handle(handle){}
|
||||
virtual ~CKsClockForwarder(){ if (m_Handle) CloseHandle(m_Handle);}
|
||||
|
||||
CKsClockForwarder(HANDLE handle);
|
||||
virtual ~CKsClockForwarder(){};
|
||||
HRESULT STDMETHODCALLTYPE SetClockState(KSSTATE State);
|
||||
protected:
|
||||
LONG m_Ref;
|
||||
HANDLE m_Handle;
|
||||
IReferenceClock * m_Clock;
|
||||
HANDLE m_hEvent;
|
||||
HANDLE m_hThread;
|
||||
BOOL m_ThreadStarted;
|
||||
BOOL m_PendingStop;
|
||||
BOOL m_ForceStart;
|
||||
KSSTATE m_State;
|
||||
REFERENCE_TIME m_Time;
|
||||
|
||||
friend DWORD WINAPI CKsClockForwarder_ThreadStartup(LPVOID lpParameter);
|
||||
};
|
||||
|
||||
CKsClockForwarder::CKsClockForwarder(
|
||||
HANDLE handle) : m_Ref(0),
|
||||
m_Handle(handle),
|
||||
m_Clock(0),
|
||||
m_hEvent(NULL),
|
||||
m_hThread(NULL),
|
||||
m_ThreadStarted(FALSE),
|
||||
m_PendingStop(FALSE),
|
||||
m_ForceStart(FALSE),
|
||||
m_State(KSSTATE_STOP),
|
||||
m_Time(0)
|
||||
{
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CKsClockForwarder::QueryInterface(
|
||||
|
@ -65,7 +93,8 @@ CKsClockForwarder::QueryInterface(
|
|||
reinterpret_cast<IUnknown*>(*Output)->AddRef();
|
||||
return NOERROR;
|
||||
}
|
||||
if (IsEqualGUID(refiid, IID_IKsObject))
|
||||
if (IsEqualGUID(refiid, IID_IKsObject) ||
|
||||
IsEqualGUID(refiid, IID_IKsClockForwarder))
|
||||
{
|
||||
*Output = (IKsObject*)(this);
|
||||
reinterpret_cast<IKsObject*>(*Output)->AddRef();
|
||||
|
@ -79,15 +108,6 @@ CKsClockForwarder::QueryInterface(
|
|||
return NOERROR;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (IsEqualGUID(refiid, IID_IKsClockForwarder))
|
||||
{
|
||||
*Output = PVOID(this);
|
||||
reinterpret_cast<IKsObject*>(*Output)->AddRef();
|
||||
return NOERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
@ -100,16 +120,86 @@ HRESULT
|
|||
STDMETHODCALLTYPE
|
||||
CKsClockForwarder::Stop()
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
return E_NOTIMPL;
|
||||
#ifdef KSPROXY_TRACE
|
||||
WCHAR Buffer[200];
|
||||
swprintf(Buffer, L"CKsClockForwarder::Stop m_ThreadStarted %u m_PendingStop %u m_hThread %p m_hEvent %p m_Handle %p\n", m_ThreadStarted, m_PendingStop, m_hThread, m_hEvent, m_Handle);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
m_Time = 0;
|
||||
if (m_ThreadStarted)
|
||||
{
|
||||
// signal pending stop
|
||||
m_PendingStop = true;
|
||||
|
||||
assert(m_hThread);
|
||||
assert(m_hEvent);
|
||||
|
||||
// set stop event
|
||||
SetEvent(m_hEvent);
|
||||
|
||||
// wait untill the thread has finished
|
||||
WaitForSingleObject(m_hThread, INFINITE);
|
||||
|
||||
// close thread handle
|
||||
CloseHandle(m_hThread);
|
||||
|
||||
// zero handle
|
||||
m_hThread = NULL;
|
||||
}
|
||||
|
||||
if (m_hEvent)
|
||||
{
|
||||
// close stop event
|
||||
CloseHandle(m_hEvent);
|
||||
m_hEvent = NULL;
|
||||
}
|
||||
|
||||
m_PendingStop = false;
|
||||
|
||||
SetClockState(KSSTATE_STOP);
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CKsClockForwarder::Pause()
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
return E_NOTIMPL;
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugString("CKsClockForwarder::Pause\n");
|
||||
#endif
|
||||
|
||||
if (!m_hEvent)
|
||||
{
|
||||
m_hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
|
||||
if (!m_hEvent)
|
||||
return MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, GetLastError());
|
||||
}
|
||||
|
||||
if (m_State <= KSSTATE_PAUSE)
|
||||
{
|
||||
if (m_State == KSSTATE_STOP)
|
||||
SetClockState(KSSTATE_ACQUIRE);
|
||||
|
||||
if (m_State == KSSTATE_ACQUIRE)
|
||||
SetClockState(KSSTATE_PAUSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_ForceStart)
|
||||
{
|
||||
SetClockState(KSSTATE_PAUSE);
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_hThread)
|
||||
{
|
||||
m_hThread = CreateThread(NULL, 0, CKsClockForwarder_ThreadStartup, (LPVOID)this, 0, NULL);
|
||||
if (!m_hThread)
|
||||
return MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, GetLastError());
|
||||
}
|
||||
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
|
@ -117,8 +207,28 @@ STDMETHODCALLTYPE
|
|||
CKsClockForwarder::Run(
|
||||
REFERENCE_TIME tStart)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
return E_NOTIMPL;
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugString("CKsClockForwarder::Run\n");
|
||||
#endif
|
||||
|
||||
m_Time = tStart;
|
||||
|
||||
if (!m_hEvent || !m_hThread)
|
||||
{
|
||||
m_ForceStart = TRUE;
|
||||
HRESULT hr = Pause();
|
||||
m_ForceStart = FALSE;
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
}
|
||||
|
||||
assert(m_hThread);
|
||||
|
||||
SetClockState(KSSTATE_RUN);
|
||||
SetEvent(m_hEvent);
|
||||
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
|
@ -126,16 +236,30 @@ STDMETHODCALLTYPE
|
|||
CKsClockForwarder::SetSyncSource(
|
||||
IReferenceClock *pClock)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
return E_NOTIMPL;
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugString("CKsClockForwarder::SetSyncSource\n");
|
||||
#endif
|
||||
|
||||
if (pClock)
|
||||
pClock->AddRef();
|
||||
|
||||
if (m_Clock)
|
||||
m_Clock->Release();
|
||||
|
||||
|
||||
m_Clock = pClock;
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CKsClockForwarder::NotifyGraphChange()
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
return E_NOTIMPL;
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugString("CKsClockForwarder::NotifyGraphChange\n");
|
||||
#endif
|
||||
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
@ -149,6 +273,66 @@ CKsClockForwarder::KsGetObjectHandle()
|
|||
return m_Handle;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CKsClockForwarder::SetClockState(KSSTATE State)
|
||||
{
|
||||
KSPROPERTY Property;
|
||||
ULONG BytesReturned;
|
||||
|
||||
Property.Set = KSPROPSETID_Clock;
|
||||
Property.Id = KSPROPERTY_CLOCK_STATE;
|
||||
Property.Flags = KSPROPERTY_TYPE_SET;
|
||||
|
||||
HRESULT hr = KsSynchronousDeviceControl(m_Handle, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSPROPERTY), &State, sizeof(KSSTATE), &BytesReturned);
|
||||
if (SUCCEEDED(hr))
|
||||
m_State = State;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CKsClockForwarder::SetClockState m_State %u State %u hr %lx\n", m_State, State, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
DWORD
|
||||
WINAPI
|
||||
CKsClockForwarder_ThreadStartup(LPVOID lpParameter)
|
||||
{
|
||||
REFERENCE_TIME Time;
|
||||
ULONG BytesReturned;
|
||||
|
||||
CKsClockForwarder * Fwd = (CKsClockForwarder*)lpParameter;
|
||||
|
||||
Fwd->m_ThreadStarted = TRUE;
|
||||
|
||||
do
|
||||
{
|
||||
if (Fwd->m_PendingStop)
|
||||
break;
|
||||
|
||||
if (Fwd->m_State != KSSTATE_RUN)
|
||||
WaitForSingleObject(Fwd->m_hEvent, INFINITE);
|
||||
|
||||
KSPROPERTY Property;
|
||||
Property.Set = KSPROPSETID_Clock;
|
||||
Property.Id = KSPROPERTY_CLOCK_TIME;
|
||||
Property.Flags = KSPROPERTY_TYPE_SET;
|
||||
|
||||
Fwd->m_Clock->GetTime(&Time);
|
||||
Time -= Fwd->m_Time;
|
||||
|
||||
KsSynchronousDeviceControl(Fwd->m_Handle, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSPROPERTY), &Time, sizeof(REFERENCE_TIME), &BytesReturned);
|
||||
}
|
||||
while(TRUE);
|
||||
|
||||
Fwd->m_ThreadStarted = FALSE;
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
WINAPI
|
||||
CKsClockForwarder_Constructor(
|
||||
|
@ -159,14 +343,18 @@ CKsClockForwarder_Constructor(
|
|||
HRESULT hr;
|
||||
HANDLE handle;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsClockForwarder_Constructor\n");
|
||||
#endif
|
||||
|
||||
// open default clock
|
||||
hr = KsOpenDefaultDevice(KSCATEGORY_CLOCK, GENERIC_READ | GENERIC_WRITE, &handle);
|
||||
|
||||
if (hr != NOERROR)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugString("CKsClockForwarder_Constructor failed to open device\n");
|
||||
#endif
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
|
|
@ -102,7 +102,9 @@ HRESULT
|
|||
STDMETHODCALLTYPE
|
||||
CVPConfig::Stop()
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -110,7 +112,9 @@ HRESULT
|
|||
STDMETHODCALLTYPE
|
||||
CVPConfig::Pause()
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -119,7 +123,9 @@ STDMETHODCALLTYPE
|
|||
CVPConfig::Run(
|
||||
REFERENCE_TIME tStart)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -128,7 +134,9 @@ STDMETHODCALLTYPE
|
|||
CVPConfig::SetSyncSource(
|
||||
IReferenceClock *pClock)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -136,7 +144,9 @@ HRESULT
|
|||
STDMETHODCALLTYPE
|
||||
CVPConfig::NotifyGraphChange()
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -149,7 +159,9 @@ CVPConfig::GetConnectInfo(
|
|||
LPDWORD pdwNumConnectInfo,
|
||||
IN OUT LPDDVIDEOPORTCONNECT pddVPConnectInfo)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -158,7 +170,9 @@ STDMETHODCALLTYPE
|
|||
CVPConfig::SetConnectInfo(
|
||||
DWORD dwChosenEntry)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -167,7 +181,9 @@ STDMETHODCALLTYPE
|
|||
CVPConfig::GetVPDataInfo(
|
||||
LPAMVPDATAINFO pamvpDataInfo)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -177,7 +193,9 @@ CVPConfig::GetMaxPixelRate(
|
|||
LPAMVPSIZE pamvpSize,
|
||||
OUT LPDWORD pdwMaxPixelsPerSecond)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -187,7 +205,9 @@ CVPConfig::InformVPInputFormats(
|
|||
DWORD dwNumFormats,
|
||||
IN LPDDPIXELFORMAT pDDPixelFormats)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -197,7 +217,9 @@ CVPConfig::GetVideoFormats(
|
|||
LPDWORD pdwNumFormats,
|
||||
IN OUT LPDDPIXELFORMAT pddPixelFormats)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -206,7 +228,9 @@ STDMETHODCALLTYPE
|
|||
CVPConfig::SetVideoFormat(
|
||||
DWORD dwChosenEntry)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -214,7 +238,9 @@ HRESULT
|
|||
STDMETHODCALLTYPE
|
||||
CVPConfig::SetInvertPolarity()
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -223,7 +249,9 @@ STDMETHODCALLTYPE
|
|||
CVPConfig::GetOverlaySurface(
|
||||
LPDIRECTDRAWSURFACE* ppddOverlaySurface)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -232,7 +260,9 @@ STDMETHODCALLTYPE
|
|||
CVPConfig::SetDirectDrawKernelHandle(
|
||||
ULONG_PTR dwDDKernelHandle)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -241,7 +271,9 @@ STDMETHODCALLTYPE
|
|||
CVPConfig::SetVideoPortID(
|
||||
IN DWORD dwVideoPortID)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -252,7 +284,9 @@ CVPConfig::SetDDSurfaceKernelHandles(
|
|||
DWORD cHandles,
|
||||
IN ULONG_PTR *rgDDKernelHandles)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -264,7 +298,9 @@ CVPConfig::SetSurfaceParameters(
|
|||
IN DWORD dwXOrigin,
|
||||
IN DWORD dwYOrigin)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -277,7 +313,9 @@ STDMETHODCALLTYPE
|
|||
CVPConfig::IsVPDecimationAllowed(
|
||||
LPBOOL pbIsDecimationAllowed)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -286,13 +324,13 @@ STDMETHODCALLTYPE
|
|||
CVPConfig::SetScalingFactors(
|
||||
LPAMVPSIZE pamvpSize)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
HRESULT
|
||||
WINAPI
|
||||
CVPConfig_Constructor(
|
||||
|
@ -300,7 +338,9 @@ CVPConfig_Constructor(
|
|||
REFIID riid,
|
||||
LPVOID * ppv)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CVPConfig_Constructor\n");
|
||||
#endif
|
||||
|
||||
CVPConfig * handler = new CVPConfig();
|
||||
|
||||
|
|
|
@ -98,7 +98,9 @@ HRESULT
|
|||
STDMETHODCALLTYPE
|
||||
CVPVBIConfig::Stop()
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -106,7 +108,9 @@ HRESULT
|
|||
STDMETHODCALLTYPE
|
||||
CVPVBIConfig::Pause()
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -115,7 +119,9 @@ STDMETHODCALLTYPE
|
|||
CVPVBIConfig::Run(
|
||||
REFERENCE_TIME tStart)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -124,7 +130,9 @@ STDMETHODCALLTYPE
|
|||
CVPVBIConfig::SetSyncSource(
|
||||
IReferenceClock *pClock)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -132,7 +140,9 @@ HRESULT
|
|||
STDMETHODCALLTYPE
|
||||
CVPVBIConfig::NotifyGraphChange()
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -145,7 +155,9 @@ CVPVBIConfig::GetConnectInfo(
|
|||
LPDWORD pdwNumConnectInfo,
|
||||
IN OUT LPDDVIDEOPORTCONNECT pddVPConnectInfo)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -154,7 +166,9 @@ STDMETHODCALLTYPE
|
|||
CVPVBIConfig::SetConnectInfo(
|
||||
DWORD dwChosenEntry)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -163,7 +177,9 @@ STDMETHODCALLTYPE
|
|||
CVPVBIConfig::GetVPDataInfo(
|
||||
LPAMVPDATAINFO pamvpDataInfo)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -173,7 +189,9 @@ CVPVBIConfig::GetMaxPixelRate(
|
|||
LPAMVPSIZE pamvpSize,
|
||||
OUT LPDWORD pdwMaxPixelsPerSecond)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -183,7 +201,9 @@ CVPVBIConfig::InformVPInputFormats(
|
|||
DWORD dwNumFormats,
|
||||
IN LPDDPIXELFORMAT pDDPixelFormats)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -193,7 +213,9 @@ CVPVBIConfig::GetVideoFormats(
|
|||
LPDWORD pdwNumFormats,
|
||||
IN OUT LPDDPIXELFORMAT pddPixelFormats)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -202,7 +224,9 @@ STDMETHODCALLTYPE
|
|||
CVPVBIConfig::SetVideoFormat(
|
||||
DWORD dwChosenEntry)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -210,7 +234,9 @@ HRESULT
|
|||
STDMETHODCALLTYPE
|
||||
CVPVBIConfig::SetInvertPolarity()
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -219,7 +245,9 @@ STDMETHODCALLTYPE
|
|||
CVPVBIConfig::GetOverlaySurface(
|
||||
LPDIRECTDRAWSURFACE* ppddOverlaySurface)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -228,7 +256,9 @@ STDMETHODCALLTYPE
|
|||
CVPVBIConfig::SetDirectDrawKernelHandle(
|
||||
ULONG_PTR dwDDKernelHandle)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -237,7 +267,9 @@ STDMETHODCALLTYPE
|
|||
CVPVBIConfig::SetVideoPortID(
|
||||
IN DWORD dwVideoPortID)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -248,7 +280,9 @@ CVPVBIConfig::SetDDSurfaceKernelHandles(
|
|||
DWORD cHandles,
|
||||
IN ULONG_PTR *rgDDKernelHandles)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -260,7 +294,9 @@ CVPVBIConfig::SetSurfaceParameters(
|
|||
IN DWORD dwXOrigin,
|
||||
IN DWORD dwYOrigin)
|
||||
{
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -272,7 +308,9 @@ CVPVBIConfig_Constructor(
|
|||
REFIID riid,
|
||||
LPVOID * ppv)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CVPVBIConfig_Constructor\n");
|
||||
#endif
|
||||
|
||||
CVPVBIConfig * handler = new CVPVBIConfig();
|
||||
|
||||
|
|
|
@ -103,7 +103,9 @@ CKsDataTypeHandler::KsIsMediaTypeInRanges(
|
|||
ULONG Index;
|
||||
HRESULT hr = S_FALSE;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsDataTypeHandler::KsIsMediaTypeInRanges\n");
|
||||
#endif
|
||||
|
||||
DataList = (PKSMULTIPLE_ITEM)DataRanges;
|
||||
DataRange = (PKSDATARANGE)(DataList + 1);
|
||||
|
@ -187,7 +189,9 @@ STDMETHODCALLTYPE
|
|||
CKsDataTypeHandler::KsSetMediaType(
|
||||
IN const AM_MEDIA_TYPE* AmMediaType)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugString("CKsDataTypeHandler::KsSetMediaType\n");
|
||||
#endif
|
||||
|
||||
if (m_Type)
|
||||
{
|
||||
|
@ -228,7 +232,10 @@ CKsDataTypeHandler_Constructor (
|
|||
REFIID riid,
|
||||
LPVOID * ppv)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsDataTypeHandler_Constructor\n");
|
||||
#endif
|
||||
|
||||
CKsDataTypeHandler * handler = new CKsDataTypeHandler();
|
||||
|
||||
if (!handler)
|
||||
|
|
|
@ -64,13 +64,6 @@ CEnumMediaTypes::QueryInterface(
|
|||
return NOERROR;
|
||||
}
|
||||
|
||||
WCHAR Buffer[MAX_PATH];
|
||||
LPOLESTR lpstr;
|
||||
StringFromCLSID(refiid, &lpstr);
|
||||
swprintf(Buffer, L"CEnumMediaTypes::QueryInterface: NoInterface for %s\n", lpstr);
|
||||
OutputDebugStringW(Buffer);
|
||||
CoTaskMemFree(lpstr);
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
@ -171,7 +164,9 @@ STDMETHODCALLTYPE
|
|||
CEnumMediaTypes::Clone(
|
||||
IEnumMediaTypes **ppEnum)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CEnumMediaTypes::Clone : NotImplemented\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -189,7 +184,7 @@ CEnumMediaTypes_fnConstructor(
|
|||
WCHAR Buffer[MAX_PATH];
|
||||
LPOLESTR lpstr;
|
||||
StringFromCLSID(riid, &lpstr);
|
||||
swprintf(Buffer, L"CEnumMediaTypes_fnConstructor riid %s pUnknown %p\n", lpstr, pUnknown);
|
||||
swprintf(Buffer, L"CEnumMediaTypes_fnConstructor riid %s\n", lpstr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -64,6 +64,14 @@ CEnumPins::QueryInterface(
|
|||
return NOERROR;
|
||||
}
|
||||
|
||||
WCHAR Buffer[100];
|
||||
LPOLESTR lpstr;
|
||||
StringFromCLSID(refiid, &lpstr);
|
||||
swprintf(Buffer, L"CEnumPins::QueryInterface: NoInterface for %s\n", lpstr);
|
||||
OutputDebugStringW(Buffer);
|
||||
CoTaskMemFree(lpstr);
|
||||
|
||||
DebugBreak();
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
@ -132,7 +140,10 @@ STDMETHODCALLTYPE
|
|||
CEnumPins::Clone(
|
||||
IEnumPins **ppEnum)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CEnumPins::Clone : NotImplemented\n");
|
||||
#endif
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
|
|
@ -62,6 +62,8 @@ class CInputPin : public IPin,
|
|||
public ISpecifyPropertyPages
|
||||
{
|
||||
public:
|
||||
typedef std::vector<IUnknown *>ProxyPluginVector;
|
||||
|
||||
STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
|
||||
|
||||
STDMETHODIMP_(ULONG) AddRef()
|
||||
|
@ -170,14 +172,15 @@ public:
|
|||
HRESULT STDMETHODCALLTYPE CheckFormat(const AM_MEDIA_TYPE *pmt);
|
||||
HRESULT STDMETHODCALLTYPE CreatePin(const AM_MEDIA_TYPE *pmt);
|
||||
HRESULT STDMETHODCALLTYPE CreatePinHandle(PKSPIN_MEDIUM Medium, PKSPIN_INTERFACE Interface, const AM_MEDIA_TYPE *pmt);
|
||||
CInputPin(IBaseFilter * ParentFilter, LPCWSTR PinName, HANDLE hFilter, ULONG PinId, KSPIN_COMMUNICATION Communication);
|
||||
HRESULT STDMETHODCALLTYPE GetSupportedSets(LPGUID * pOutGuid, PULONG NumGuids);
|
||||
HRESULT STDMETHODCALLTYPE LoadProxyPlugins(LPGUID pGuids, ULONG NumGuids);
|
||||
CInputPin(IBaseFilter * ParentFilter, LPCWSTR PinName, ULONG PinId, KSPIN_COMMUNICATION Communication);
|
||||
virtual ~CInputPin(){};
|
||||
|
||||
protected:
|
||||
LONG m_Ref;
|
||||
IBaseFilter * m_ParentFilter;
|
||||
LPCWSTR m_PinName;
|
||||
HANDLE m_hFilter;
|
||||
HANDLE m_hPin;
|
||||
ULONG m_PinId;
|
||||
IMemAllocator * m_MemAllocator;
|
||||
|
@ -196,17 +199,16 @@ protected:
|
|||
LPWSTR m_FilterName;
|
||||
FRAMING_PROP m_FramingProp[4];
|
||||
PKSALLOCATOR_FRAMING_EX m_FramingEx[4];
|
||||
ProxyPluginVector m_Plugins;
|
||||
};
|
||||
|
||||
CInputPin::CInputPin(
|
||||
IBaseFilter * ParentFilter,
|
||||
IBaseFilter * ParentFilter,
|
||||
LPCWSTR PinName,
|
||||
HANDLE hFilter,
|
||||
ULONG PinId,
|
||||
KSPIN_COMMUNICATION Communication) : m_Ref(0),
|
||||
m_ParentFilter(ParentFilter),
|
||||
m_PinName(PinName),
|
||||
m_hFilter(hFilter),
|
||||
m_hPin(INVALID_HANDLE_VALUE),
|
||||
m_PinId(PinId),
|
||||
m_MemAllocator(0),
|
||||
|
@ -218,13 +220,27 @@ CInputPin::CInputPin(
|
|||
m_KsAllocatorEx(0),
|
||||
m_PipeAllocatorFlag(0),
|
||||
m_bPinBusCacheInitialized(0),
|
||||
m_FilterName(0)
|
||||
m_FilterName(0),
|
||||
m_Plugins()
|
||||
{
|
||||
ZeroMemory(m_FramingProp, sizeof(m_FramingProp));
|
||||
ZeroMemory(m_FramingEx, sizeof(m_FramingEx));
|
||||
|
||||
HRESULT hr;
|
||||
IKsObject * KsObjectParent;
|
||||
HANDLE hFilter;
|
||||
|
||||
hr = m_ParentFilter->QueryInterface(IID_IKsObject, (LPVOID*)&KsObjectParent);
|
||||
assert(hr == S_OK);
|
||||
|
||||
hFilter = KsObjectParent->KsGetObjectHandle();
|
||||
assert(hFilter);
|
||||
|
||||
KsObjectParent->Release();
|
||||
|
||||
|
||||
ZeroMemory(&m_MediaFormat, sizeof(AM_MEDIA_TYPE));
|
||||
HRESULT hr = KsGetMediaType(0, &m_MediaFormat, m_hFilter, m_PinId);
|
||||
hr = KsGetMediaType(0, &m_MediaFormat, hFilter, m_PinId);
|
||||
assert(hr == S_OK);
|
||||
}
|
||||
|
||||
|
@ -346,7 +362,10 @@ CInputPin::Notify(
|
|||
IBaseFilter *pSelf,
|
||||
Quality q)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::Notify NotImplemented\n");
|
||||
#endif
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -355,7 +374,10 @@ STDMETHODCALLTYPE
|
|||
CInputPin::SetSink(
|
||||
IQualityControl *piqc)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::SetSink NotImplemented\n");
|
||||
#endif
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -368,7 +390,10 @@ STDMETHODCALLTYPE
|
|||
CInputPin::KsAddAggregate(
|
||||
IN REFGUID AggregateClass)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::KsAddAggregate NotImplemented\n");
|
||||
#endif
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -377,7 +402,10 @@ STDMETHODCALLTYPE
|
|||
CInputPin::KsRemoveAggregate(
|
||||
REFGUID AggregateClass)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::KsRemoveAggregate NotImplemented\n");
|
||||
#endif
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -401,7 +429,10 @@ CInputPin::Backout(
|
|||
IPin *ppinOut,
|
||||
IGraphBuilder *pGraph)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::Backout\n");
|
||||
#endif
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -414,7 +445,10 @@ STDMETHODCALLTYPE
|
|||
CInputPin::KsPinFactory(
|
||||
ULONG* PinFactory)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::KsPinFactory\n");
|
||||
#endif
|
||||
|
||||
*PinFactory = m_PinId;
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -590,7 +624,10 @@ HRESULT
|
|||
STDMETHODCALLTYPE
|
||||
CInputPin::GetAllocator(IMemAllocator **ppAllocator)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::GetAllocator\n");
|
||||
#endif
|
||||
|
||||
return VFW_E_NO_ALLOCATOR;
|
||||
}
|
||||
|
||||
|
@ -598,13 +635,16 @@ HRESULT
|
|||
STDMETHODCALLTYPE
|
||||
CInputPin::NotifyAllocator(IMemAllocator *pAllocator, BOOL bReadOnly)
|
||||
{
|
||||
WCHAR Buffer[100];
|
||||
HRESULT hr;
|
||||
ALLOCATOR_PROPERTIES Properties;
|
||||
|
||||
hr = pAllocator->GetProperties(&Properties);
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CInputPin::NotifyAllocator hr %lx bReadOnly, %u cbAlign %u cbBuffer %u cbPrefix %u cBuffers %u\n", hr, bReadOnly, Properties.cbAlign, Properties.cbBuffer, Properties.cbPrefix, Properties.cBuffers);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
if (pAllocator)
|
||||
{
|
||||
|
@ -645,9 +685,11 @@ CInputPin::GetAllocatorRequirements(ALLOCATOR_PROPERTIES *pProps)
|
|||
else
|
||||
hr = E_NOTIMPL;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CInputPin::GetAllocatorRequirements hr %lx m_hPin %p cBuffers %u cbBuffer %u cbAlign %u cbPrefix %u\n", hr, m_hPin, pProps->cBuffers, pProps->cbBuffer, pProps->cbAlign, pProps->cbPrefix);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
@ -656,7 +698,11 @@ HRESULT
|
|||
STDMETHODCALLTYPE
|
||||
CInputPin::Receive(IMediaSample *pSample)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::Receive NotImplemented\n");
|
||||
DebugBreak();
|
||||
#endif
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -664,7 +710,11 @@ HRESULT
|
|||
STDMETHODCALLTYPE
|
||||
CInputPin::ReceiveMultiple(IMediaSample **pSamples, long nSamples, long *nSamplesProcessed)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::ReceiveMultiple NotImplemented\n");
|
||||
DebugBreak();
|
||||
#endif
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -672,7 +722,11 @@ HRESULT
|
|||
STDMETHODCALLTYPE
|
||||
CInputPin::ReceiveCanBlock( void)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::ReceiveCanBlock NotImplemented\n");
|
||||
DebugBreak();
|
||||
#endif
|
||||
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
|
@ -685,7 +739,22 @@ STDMETHODCALLTYPE
|
|||
CInputPin::KsQueryMediums(
|
||||
PKSMULTIPLE_ITEM* MediumList)
|
||||
{
|
||||
return KsGetMultiplePinFactoryItems(m_hFilter, m_PinId, KSPROPERTY_PIN_MEDIUMS, (PVOID*)MediumList);
|
||||
HRESULT hr;
|
||||
IKsObject * KsObjectParent;
|
||||
HANDLE hFilter;
|
||||
|
||||
hr = m_ParentFilter->QueryInterface(IID_IKsObject, (LPVOID*)&KsObjectParent);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hFilter = KsObjectParent->KsGetObjectHandle();
|
||||
|
||||
KsObjectParent->Release();
|
||||
|
||||
if (!hFilter)
|
||||
return E_HANDLE;
|
||||
|
||||
return KsGetMultiplePinFactoryItems(hFilter, m_PinId, KSPROPERTY_PIN_MEDIUMS, (PVOID*)MediumList);
|
||||
}
|
||||
|
||||
HRESULT
|
||||
|
@ -693,7 +762,22 @@ STDMETHODCALLTYPE
|
|||
CInputPin::KsQueryInterfaces(
|
||||
PKSMULTIPLE_ITEM* InterfaceList)
|
||||
{
|
||||
return KsGetMultiplePinFactoryItems(m_hFilter, m_PinId, KSPROPERTY_PIN_INTERFACES, (PVOID*)InterfaceList);
|
||||
HRESULT hr;
|
||||
IKsObject * KsObjectParent;
|
||||
HANDLE hFilter;
|
||||
|
||||
hr = m_ParentFilter->QueryInterface(IID_IKsObject, (LPVOID*)&KsObjectParent);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hFilter = KsObjectParent->KsGetObjectHandle();
|
||||
|
||||
KsObjectParent->Release();
|
||||
|
||||
if (!hFilter)
|
||||
return E_HANDLE;
|
||||
|
||||
return KsGetMultiplePinFactoryItems(hFilter, m_PinId, KSPROPERTY_PIN_INTERFACES, (PVOID*)InterfaceList);
|
||||
}
|
||||
|
||||
HRESULT
|
||||
|
@ -744,8 +828,6 @@ CInputPin::KsPropagateAcquire()
|
|||
ULONG BytesReturned;
|
||||
HRESULT hr;
|
||||
|
||||
OutputDebugStringW(L"CInputPin::KsPropagateAcquire\n");
|
||||
|
||||
assert(m_hPin != INVALID_HANDLE_VALUE);
|
||||
|
||||
Property.Set = KSPROPSETID_Connection;
|
||||
|
@ -837,7 +919,11 @@ CInputPin::KsQualityNotify(
|
|||
ULONG Proportion,
|
||||
REFERENCE_TIME TimeDelta)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::KsQualityNotify NotImplemented\n");
|
||||
#endif
|
||||
|
||||
DebugBreak();
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -851,7 +937,9 @@ CInputPin::KsNotifyError(
|
|||
IMediaSample* Sample,
|
||||
HRESULT hr)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::KsNotifyError NotImplemented\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -1024,7 +1112,10 @@ HRESULT
|
|||
STDMETHODCALLTYPE
|
||||
CInputPin::Connect(IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::Connect NotImplemented\n");
|
||||
DebugBreak();
|
||||
#endif
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
|
@ -1075,7 +1166,10 @@ CInputPin::Disconnect( void)
|
|||
m_Pin->Release();
|
||||
m_Pin = NULL;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::Disconnect\n");
|
||||
#endif
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT
|
||||
|
@ -1103,7 +1197,11 @@ CInputPin::ConnectionMediaType(AM_MEDIA_TYPE *pmt)
|
|||
if (!m_Pin)
|
||||
return VFW_E_NOT_CONNECTED;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::ConnectionMediaType NotImplemented\n");
|
||||
DebugBreak();
|
||||
#endif
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
HRESULT
|
||||
|
@ -1155,9 +1253,23 @@ CInputPin::EnumMediaTypes(IEnumMediaTypes **ppEnum)
|
|||
HRESULT hr;
|
||||
ULONG MediaTypeCount = 0, Index;
|
||||
AM_MEDIA_TYPE * MediaTypes;
|
||||
IKsObject * KsObjectParent;
|
||||
HANDLE hFilter;
|
||||
|
||||
hr = m_ParentFilter->QueryInterface(IID_IKsObject, (LPVOID*)&KsObjectParent);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hFilter = KsObjectParent->KsGetObjectHandle();
|
||||
|
||||
KsObjectParent->Release();
|
||||
|
||||
if (!hFilter)
|
||||
return E_HANDLE;
|
||||
|
||||
|
||||
// query media type count
|
||||
hr = KsGetMediaTypeCount(m_hFilter, m_PinId, &MediaTypeCount);
|
||||
hr = KsGetMediaTypeCount(hFilter, m_PinId, &MediaTypeCount);
|
||||
if (FAILED(hr) || !MediaTypeCount)
|
||||
return hr;
|
||||
|
||||
|
@ -1175,7 +1287,7 @@ CInputPin::EnumMediaTypes(IEnumMediaTypes **ppEnum)
|
|||
for(Index = 0; Index < MediaTypeCount; Index++)
|
||||
{
|
||||
// get media type
|
||||
hr = KsGetMediaType(Index, &MediaTypes[Index], m_hFilter, m_PinId);
|
||||
hr = KsGetMediaType(Index, &MediaTypes[Index], hFilter, m_PinId);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
// failed
|
||||
|
@ -1191,35 +1303,45 @@ HRESULT
|
|||
STDMETHODCALLTYPE
|
||||
CInputPin::QueryInternalConnections(IPin **apPin, ULONG *nPin)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::QueryInternalConnections NotImplemented\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CInputPin::EndOfStream( void)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::EndOfStream NotImplemented\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CInputPin::BeginFlush( void)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::BeginFlush NotImplemented\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CInputPin::EndFlush( void)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::EndFlush NotImplemented\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CInputPin::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::NewSegment NotImplemented\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -1233,11 +1355,25 @@ CInputPin::CheckFormat(
|
|||
PKSMULTIPLE_ITEM MultipleItem;
|
||||
PKSDATAFORMAT DataFormat;
|
||||
HRESULT hr;
|
||||
IKsObject * KsObjectParent;
|
||||
HANDLE hFilter;
|
||||
|
||||
if (!pmt)
|
||||
return E_POINTER;
|
||||
|
||||
hr = KsGetMultiplePinFactoryItems(m_hFilter, m_PinId, KSPROPERTY_PIN_DATARANGES, (PVOID*)&MultipleItem);
|
||||
hr = m_ParentFilter->QueryInterface(IID_IKsObject, (LPVOID*)&KsObjectParent);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hFilter = KsObjectParent->KsGetObjectHandle();
|
||||
|
||||
KsObjectParent->Release();
|
||||
|
||||
if (!hFilter)
|
||||
return E_HANDLE;
|
||||
|
||||
|
||||
hr = KsGetMultiplePinFactoryItems(hFilter, m_PinId, KSPROPERTY_PIN_DATARANGES, (PVOID*)&MultipleItem);
|
||||
if (FAILED(hr))
|
||||
return S_FALSE;
|
||||
|
||||
|
@ -1250,7 +1386,9 @@ CInputPin::CheckFormat(
|
|||
{
|
||||
// format is supported
|
||||
CoTaskMemFree(MultipleItem);
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::CheckFormat format OK\n");
|
||||
#endif
|
||||
return S_OK;
|
||||
}
|
||||
DataFormat = (PKSDATAFORMAT)((ULONG_PTR)DataFormat + DataFormat->FormatSize);
|
||||
|
@ -1317,7 +1455,9 @@ CInputPin::CreatePin(
|
|||
if (FAILED(hr))
|
||||
{
|
||||
// failed to load interface handler plugin
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::CreatePin failed to load InterfaceHandlerPlugin\n");
|
||||
#endif
|
||||
CoTaskMemFree(MediumList);
|
||||
CoTaskMemFree(InterfaceList);
|
||||
|
||||
|
@ -1329,7 +1469,9 @@ CInputPin::CreatePin(
|
|||
if (FAILED(hr))
|
||||
{
|
||||
// failed to load interface handler plugin
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::CreatePin failed to initialize InterfaceHandlerPlugin\n");
|
||||
#endif
|
||||
InterfaceHandler->Release();
|
||||
CoTaskMemFree(MediumList);
|
||||
CoTaskMemFree(InterfaceList);
|
||||
|
@ -1350,10 +1492,12 @@ CInputPin::CreatePin(
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CInputPin::CreatePin unexpected communication %u %s\n", m_Communication, m_PinName);
|
||||
OutputDebugStringW(Buffer);
|
||||
DebugBreak();
|
||||
#endif
|
||||
hr = E_FAIL;
|
||||
}
|
||||
|
||||
|
@ -1375,6 +1519,23 @@ CInputPin::CreatePinHandle(
|
|||
PKSDATAFORMAT DataFormat;
|
||||
ULONG Length;
|
||||
HRESULT hr;
|
||||
IKsObject * KsObjectParent;
|
||||
HANDLE hFilter;
|
||||
|
||||
if (!pmt)
|
||||
return E_POINTER;
|
||||
|
||||
hr = m_ParentFilter->QueryInterface(IID_IKsObject, (LPVOID*)&KsObjectParent);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hFilter = KsObjectParent->KsGetObjectHandle();
|
||||
|
||||
KsObjectParent->Release();
|
||||
|
||||
if (!hFilter)
|
||||
return E_HANDLE;
|
||||
|
||||
|
||||
if (m_hPin != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
|
@ -1423,7 +1584,7 @@ CInputPin::CreatePinHandle(
|
|||
}
|
||||
|
||||
// create pin
|
||||
hr = KsCreatePin(m_hFilter, PinConnect, GENERIC_WRITE, &m_hPin);
|
||||
hr = KsCreatePin(hFilter, PinConnect, GENERIC_WRITE, &m_hPin);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
|
@ -1432,16 +1593,19 @@ CInputPin::CreatePinHandle(
|
|||
CopyMemory(&m_Interface, Interface, sizeof(KSPIN_INTERFACE));
|
||||
CopyMemory(&m_MediaFormat, pmt, sizeof(AM_MEDIA_TYPE));
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
LPOLESTR pMajor, pSub, pFormat;
|
||||
StringFromIID(m_MediaFormat.majortype, &pMajor);
|
||||
StringFromIID(m_MediaFormat.subtype , &pSub);
|
||||
StringFromIID(m_MediaFormat.formattype, &pFormat);
|
||||
|
||||
WCHAR Buffer[200];
|
||||
swprintf(Buffer, L"CInputPin::CreatePinHandle Major %s SubType %s Format %s pbFormat %p cbFormat %u\n", pMajor, pSub, pFormat, pmt->pbFormat, pmt->cbFormat);
|
||||
CoTaskMemFree(pMajor);
|
||||
CoTaskMemFree(pSub);
|
||||
CoTaskMemFree(pFormat);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
if (pmt->cbFormat)
|
||||
{
|
||||
|
@ -1456,6 +1620,35 @@ CInputPin::CreatePinHandle(
|
|||
CopyMemory(m_MediaFormat.pbFormat, pmt->pbFormat, pmt->cbFormat);
|
||||
}
|
||||
|
||||
LPGUID pGuid;
|
||||
ULONG NumGuids = 0;
|
||||
|
||||
// get all supported sets
|
||||
hr = GetSupportedSets(&pGuid, &NumGuids);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::CreatePinHandle GetSupportedSets failed\n");
|
||||
DebugBreak();
|
||||
#endif
|
||||
return hr;
|
||||
}
|
||||
|
||||
// load all proxy plugins
|
||||
hr = LoadProxyPlugins(pGuid, NumGuids);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::CreatePinHandle LoadProxyPlugins failed\n");
|
||||
DebugBreak();
|
||||
#endif
|
||||
return hr;
|
||||
}
|
||||
|
||||
// free sets
|
||||
CoTaskMemFree(pGuid);
|
||||
|
||||
|
||||
//TODO
|
||||
// connect pin pipes
|
||||
|
||||
|
@ -1467,6 +1660,140 @@ CInputPin::CreatePinHandle(
|
|||
return hr;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CInputPin::GetSupportedSets(
|
||||
LPGUID * pOutGuid,
|
||||
PULONG NumGuids)
|
||||
{
|
||||
KSPROPERTY Property;
|
||||
LPGUID pGuid;
|
||||
ULONG NumProperty = 0;
|
||||
ULONG NumMethods = 0;
|
||||
ULONG NumEvents = 0;
|
||||
ULONG Length;
|
||||
ULONG BytesReturned;
|
||||
HRESULT hr;
|
||||
|
||||
Property.Set = GUID_NULL;
|
||||
Property.Id = 0;
|
||||
Property.Flags = KSPROPERTY_TYPE_SETSUPPORT;
|
||||
|
||||
KsSynchronousDeviceControl(m_hPin, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSPROPERTY), NULL, 0, &NumProperty);
|
||||
KsSynchronousDeviceControl(m_hPin, IOCTL_KS_METHOD, (PVOID)&Property, sizeof(KSPROPERTY), NULL, 0, &NumMethods);
|
||||
KsSynchronousDeviceControl(m_hPin, IOCTL_KS_ENABLE_EVENT, (PVOID)&Property, sizeof(KSPROPERTY), NULL, 0, &NumEvents);
|
||||
|
||||
Length = NumProperty + NumMethods + NumEvents;
|
||||
|
||||
assert(Length);
|
||||
|
||||
// allocate guid buffer
|
||||
pGuid = (LPGUID)CoTaskMemAlloc(Length);
|
||||
if (!pGuid)
|
||||
{
|
||||
// failed
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
NumProperty /= sizeof(GUID);
|
||||
NumMethods /= sizeof(GUID);
|
||||
NumEvents /= sizeof(GUID);
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
WCHAR Buffer[200];
|
||||
swprintf(Buffer, L"CInputPin::GetSupportedSets NumProperty %lu NumMethods %lu NumEvents %lu\n", NumProperty, NumMethods, NumEvents);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
// get all properties
|
||||
hr = KsSynchronousDeviceControl(m_hPin, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSPROPERTY), (PVOID)pGuid, Length, &BytesReturned);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
CoTaskMemFree(pGuid);
|
||||
return E_FAIL;
|
||||
}
|
||||
Length -= BytesReturned;
|
||||
|
||||
// get all methods
|
||||
if (Length && NumMethods)
|
||||
{
|
||||
hr = KsSynchronousDeviceControl(m_hPin, IOCTL_KS_METHOD, (PVOID)&Property, sizeof(KSPROPERTY), (PVOID)&pGuid[NumProperty], Length, &BytesReturned);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
CoTaskMemFree(pGuid);
|
||||
return E_FAIL;
|
||||
}
|
||||
Length -= BytesReturned;
|
||||
}
|
||||
|
||||
// get all events
|
||||
if (Length && NumEvents)
|
||||
{
|
||||
hr = KsSynchronousDeviceControl(m_hPin, IOCTL_KS_ENABLE_EVENT, (PVOID)&Property, sizeof(KSPROPERTY), (PVOID)&pGuid[NumProperty+NumMethods], Length, &BytesReturned);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
CoTaskMemFree(pGuid);
|
||||
return E_FAIL;
|
||||
}
|
||||
Length -= BytesReturned;
|
||||
}
|
||||
|
||||
*pOutGuid = pGuid;
|
||||
*NumGuids = NumProperty+NumEvents+NumMethods;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CInputPin::LoadProxyPlugins(
|
||||
LPGUID pGuids,
|
||||
ULONG NumGuids)
|
||||
{
|
||||
ULONG Index;
|
||||
LPOLESTR pStr;
|
||||
HKEY hKey, hSubKey;
|
||||
HRESULT hr;
|
||||
IUnknown * pUnknown;
|
||||
|
||||
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\MediaInterfaces", 0, KEY_READ, &hKey) != ERROR_SUCCESS)
|
||||
{
|
||||
OutputDebugStringW(L"CInputPin::LoadProxyPlugins failed to open MediaInterfaces key\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
// enumerate all sets
|
||||
for(Index = 0; Index < NumGuids; Index++)
|
||||
{
|
||||
// convert to string
|
||||
hr = StringFromCLSID(pGuids[Index], &pStr);
|
||||
if (FAILED(hr))
|
||||
return E_FAIL;
|
||||
|
||||
// now try open class key
|
||||
if (RegOpenKeyExW(hKey, pStr, 0, KEY_READ, &hSubKey) != ERROR_SUCCESS)
|
||||
{
|
||||
// no plugin for that set exists
|
||||
CoTaskMemFree(pStr);
|
||||
continue;
|
||||
}
|
||||
|
||||
// try load plugin
|
||||
hr = CoCreateInstance(pGuids[Index], (IBaseFilter*)this, CLSCTX_INPROC_SERVER, IID_IUnknown, (void**)&pUnknown);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
// store plugin
|
||||
m_Plugins.push_back(pUnknown);
|
||||
DebugBreak();
|
||||
}
|
||||
// close key
|
||||
RegCloseKey(hSubKey);
|
||||
}
|
||||
|
||||
// close media interfaces key
|
||||
RegCloseKey(hKey);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
WINAPI
|
||||
CInputPin_Constructor(
|
||||
|
@ -1478,7 +1805,7 @@ CInputPin_Constructor(
|
|||
REFIID riid,
|
||||
LPVOID * ppv)
|
||||
{
|
||||
CInputPin * handler = new CInputPin(ParentFilter, PinName, hFilter, PinId, Communication);
|
||||
CInputPin * handler = new CInputPin(ParentFilter, PinName, PinId, Communication);
|
||||
|
||||
if (!handler)
|
||||
return E_OUTOFMEMORY;
|
||||
|
|
|
@ -35,24 +35,25 @@ public:
|
|||
HRESULT STDMETHODCALLTYPE KsProcessMediaSamples(IKsDataTypeHandler *KsDataTypeHandler, IMediaSample** SampleList, PLONG SampleCount, KSIOOPERATION IoOperation, PKSSTREAM_SEGMENT *StreamSegment);
|
||||
HRESULT STDMETHODCALLTYPE KsCompleteIo(PKSSTREAM_SEGMENT StreamSegment);
|
||||
|
||||
CKsInterfaceHandler() : m_Ref(0), m_Handle(NULL), m_Pin(0){};
|
||||
CKsInterfaceHandler() : m_Ref(0), m_Handle(NULL), m_Pin(0) {m_PinName[0] = L'\0';};
|
||||
virtual ~CKsInterfaceHandler(){};
|
||||
|
||||
protected:
|
||||
LONG m_Ref;
|
||||
HANDLE m_Handle;
|
||||
IKsPinEx * m_Pin;
|
||||
WCHAR m_PinName[129];
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
KSSTREAM_SEGMENT StreamSegment;
|
||||
OVERLAPPED Overlapped;
|
||||
IMediaSample * MediaSample[64];
|
||||
|
||||
ULONG SampleCount;
|
||||
ULONG ExtendedSize;
|
||||
PKSSTREAM_HEADER StreamHeader;
|
||||
OVERLAPPED Overlapped;
|
||||
}KSSTREAM_SEGMENT_EXT, *PKSSTREAM_SEGMENT_EXT;
|
||||
|
||||
|
||||
|
@ -118,6 +119,22 @@ CKsInterfaceHandler::KsSetPin(
|
|||
Pin->Release();
|
||||
}
|
||||
}
|
||||
#if 1
|
||||
//DBG code
|
||||
PIN_INFO PinInfo;
|
||||
IPin * pPin;
|
||||
if (SUCCEEDED(KsPin->QueryInterface(IID_IPin, (void**)&pPin)))
|
||||
{
|
||||
if (SUCCEEDED(pPin->QueryPinInfo(&PinInfo)))
|
||||
{
|
||||
if (PinInfo.pFilter)
|
||||
PinInfo.pFilter->Release();
|
||||
|
||||
wcscpy(m_PinName, PinInfo.achName);
|
||||
}
|
||||
pPin->Release();
|
||||
}
|
||||
#endif
|
||||
|
||||
// done
|
||||
return hr;
|
||||
|
@ -136,8 +153,6 @@ CKsInterfaceHandler::KsProcessMediaSamples(
|
|||
ULONG ExtendedSize, Index, BytesReturned;
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
OutputDebugString("CKsInterfaceHandler::KsProcessMediaSamples\n");
|
||||
|
||||
// sanity check
|
||||
assert(*SampleCount);
|
||||
|
||||
|
@ -237,6 +252,7 @@ CKsInterfaceHandler::KsProcessMediaSamples(
|
|||
// query for IMediaSample2 interface
|
||||
IMediaSample2 * MediaSample;
|
||||
AM_SAMPLE2_PROPERTIES Properties;
|
||||
ZeroMemory(&Properties, sizeof(AM_SAMPLE2_PROPERTIES));
|
||||
|
||||
hr = SampleList[Index]->QueryInterface(IID_IMediaSample2, (void**)&MediaSample);
|
||||
if (SUCCEEDED(hr))
|
||||
|
@ -254,7 +270,9 @@ CKsInterfaceHandler::KsProcessMediaSamples(
|
|||
hr = SampleList[Index]->GetPointer((BYTE**)&Properties.pbBuffer);
|
||||
assert(hr == NOERROR);
|
||||
hr = SampleList[Index]->GetTime(&Properties.tStart, &Properties.tStop);
|
||||
assert(hr == NOERROR);
|
||||
|
||||
Properties.cbBuffer = SampleList[Index]->GetSize();
|
||||
assert(Properties.cbBuffer);
|
||||
|
||||
Properties.dwSampleFlags = 0;
|
||||
|
||||
|
@ -267,10 +285,11 @@ CKsInterfaceHandler::KsProcessMediaSamples(
|
|||
if (SampleList[Index]->IsSyncPoint() == S_OK)
|
||||
Properties.dwSampleFlags |= AM_SAMPLE_SPLICEPOINT;
|
||||
}
|
||||
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"BufferLength %lu Property Buffer %p ExtendedSize %u lActual %u\n", Properties.cbBuffer, Properties.pbBuffer, ExtendedSize, Properties.lActual);
|
||||
#ifdef KSPROXY_TRACE
|
||||
WCHAR Buffer[200];
|
||||
swprintf(Buffer, L"CKsInterfaceHandler::KsProcessMediaSamples PinName %s BufferLength %lu Property Buffer %p ExtendedSize %u lActual %u dwSampleFlags %lx\n", m_PinName, Properties.cbBuffer, Properties.pbBuffer, ExtendedSize, Properties.lActual, Properties.dwSampleFlags);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
CurStreamHeader->Size = sizeof(KSSTREAM_HEADER) + ExtendedSize;
|
||||
CurStreamHeader->PresentationTime.Denominator = 1;
|
||||
|
@ -336,8 +355,6 @@ CKsInterfaceHandler::KsCompleteIo(
|
|||
AM_SAMPLE2_PROPERTIES Properties;
|
||||
REFERENCE_TIME Start, Stop;
|
||||
|
||||
OutputDebugStringW(L"CKsInterfaceHandler::KsCompleteIo\n");
|
||||
|
||||
// get private stream segment
|
||||
StreamSegment = (PKSSTREAM_SEGMENT_EXT)InStreamSegment;
|
||||
|
||||
|
@ -463,7 +480,9 @@ CKsInterfaceHandler_Constructor(
|
|||
REFIID riid,
|
||||
LPVOID * ppv)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsInterfaceHandler_Constructor\n");
|
||||
#endif
|
||||
|
||||
CKsInterfaceHandler * handler = new CKsInterfaceHandler();
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ KsOpenDefaultDevice(
|
|||
WCHAR Path[MAX_PATH+sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W)];
|
||||
|
||||
/* open device list */
|
||||
hList = SetupDiGetClassDevsW(&Category, NULL, NULL, DIGCF_DEVICEINTERFACE /* | DIGCF_PRESENT*/);
|
||||
hList = SetupDiGetClassDevsW(&Category, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT);
|
||||
|
||||
if (hList == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
|
@ -129,7 +129,7 @@ KsOpenDefaultDevice(
|
|||
DeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
|
||||
DeviceInterfaceData.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);
|
||||
|
||||
if (SetupDiEnumDeviceInterfaces(hList, &DeviceInfoData, &Category, 0, &DeviceInterfaceData))
|
||||
if (SetupDiEnumDeviceInterfaces(hList, NULL, &Category, 0, &DeviceInterfaceData))
|
||||
{
|
||||
/* setup interface data struct */
|
||||
DeviceInterfaceDetailData = (PSP_DEVICE_INTERFACE_DETAIL_DATA_W)Path;
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
<file>interface.cpp</file>
|
||||
<file>ksproxy.cpp</file>
|
||||
<file>ksproxy.rc</file>
|
||||
<file>mediasample.cpp</file>
|
||||
<file>node.cpp</file>
|
||||
<file>output_pin.cpp</file>
|
||||
<file>proxy.cpp</file>
|
||||
|
|
|
@ -124,7 +124,9 @@ CKsNode_Constructor(
|
|||
HANDLE handle;
|
||||
KSNODE_CREATE NodeCreate;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsNode_Constructor\n");
|
||||
#endif
|
||||
|
||||
//setup request
|
||||
NodeCreate.CreateFlags = 0;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -3,6 +3,7 @@
|
|||
#define _FORCENAMELESSUNION
|
||||
#define BUILDING_KS
|
||||
#define _KSDDK_
|
||||
//#define KSPROXY_TRACE
|
||||
#include <dshow.h>
|
||||
//#include <streams.h>
|
||||
#include <ks.h>
|
||||
|
@ -18,6 +19,8 @@
|
|||
#include <setupapi.h>
|
||||
#include <stdio.h>
|
||||
#include <vector>
|
||||
#include <stack>
|
||||
#include <list>
|
||||
#include <assert.h>
|
||||
#include <ksmedia.h>
|
||||
//#include <debug.h>
|
||||
|
@ -138,6 +141,12 @@ COutputPin_Constructor(
|
|||
REFIID riid,
|
||||
LPVOID * ppv);
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
COutputPin_SetState(
|
||||
IPin * Pin,
|
||||
KSSTATE State);
|
||||
|
||||
/* enumpins.cpp */
|
||||
HRESULT
|
||||
WINAPI
|
||||
|
@ -166,10 +175,30 @@ CKsNode_Constructor(
|
|||
REFIID riid,
|
||||
LPVOID * ppv);
|
||||
|
||||
/* allocator.cpp */
|
||||
HRESULT
|
||||
WINAPI
|
||||
CKsAllocator_Constructor(
|
||||
IUnknown * pUnkOuter,
|
||||
REFIID riid,
|
||||
LPVOID * ppv);
|
||||
|
||||
/* mediasample.cpp */
|
||||
HRESULT
|
||||
WINAPI
|
||||
CMediaSample_Constructor(
|
||||
IMemAllocator* Allocator,
|
||||
BYTE* pBuffer,
|
||||
ULONG BufferSize,
|
||||
REFIID riid,
|
||||
LPVOID * ppv);
|
||||
|
||||
|
||||
extern const GUID IID_IKsObject;
|
||||
extern const GUID IID_IKsPinEx;
|
||||
extern const GUID IID_IKsAggregateControl;
|
||||
extern const GUID IID_IKsPinPipe;
|
||||
extern const GUID IID_IKsPinFactory;
|
||||
extern const GUID IID_IKsAllocatorEx;
|
||||
extern KSPIN_INTERFACE StandardPinInterface;
|
||||
extern KSPIN_MEDIUM StandardPinMedium;
|
||||
|
|
|
@ -63,7 +63,7 @@ public:
|
|||
InterlockedDecrement(&m_Ref);
|
||||
if (!m_Ref)
|
||||
{
|
||||
delete this;
|
||||
//delete this;
|
||||
return 0;
|
||||
}
|
||||
return m_Ref;
|
||||
|
@ -171,7 +171,7 @@ public:
|
|||
HRESULT STDMETHODCALLTYPE GetPages(CAUUID *pPages);
|
||||
|
||||
|
||||
CKsProxy() : m_Ref(0), m_pGraph(0), m_ReferenceClock((IReferenceClock*)this), m_FilterState(State_Stopped), m_hDevice(0), m_Plugins(), m_Pins(), m_DevicePath(0), m_hClock(0) {};
|
||||
CKsProxy();
|
||||
~CKsProxy()
|
||||
{
|
||||
if (m_hDevice)
|
||||
|
@ -203,8 +203,23 @@ protected:
|
|||
LPWSTR m_DevicePath;
|
||||
CLSID m_DeviceInterfaceGUID;
|
||||
HANDLE m_hClock;
|
||||
CRITICAL_SECTION m_Lock;
|
||||
};
|
||||
|
||||
CKsProxy::CKsProxy() : m_Ref(0),
|
||||
m_pGraph(0),
|
||||
m_ReferenceClock((IReferenceClock*)this),
|
||||
m_FilterState(State_Stopped),
|
||||
m_hDevice(0),
|
||||
m_Plugins(),
|
||||
m_Pins(),
|
||||
m_DevicePath(0),
|
||||
m_hClock(0)
|
||||
{
|
||||
InitializeCriticalSection(&m_Lock);
|
||||
}
|
||||
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CKsProxy::QueryInterface(
|
||||
|
@ -332,24 +347,26 @@ CKsProxy::QueryInterface(
|
|||
HRESULT hr = m_Plugins[Index]->QueryInterface(refiid, Output);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
WCHAR Buffer[100];
|
||||
LPOLESTR lpstr;
|
||||
StringFromCLSID(refiid, &lpstr);
|
||||
swprintf(Buffer, L"CKsProxy::QueryInterface plugin %lu supports interface %s\n", Index, lpstr);
|
||||
OutputDebugStringW(Buffer);
|
||||
CoTaskMemFree(lpstr);
|
||||
#endif
|
||||
return hr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
WCHAR Buffer[MAX_PATH];
|
||||
LPOLESTR lpstr;
|
||||
StringFromCLSID(refiid, &lpstr);
|
||||
swprintf(Buffer, L"CKsProxy::QueryInterface: NoInterface for %s !!!\n", lpstr);
|
||||
OutputDebugStringW(Buffer);
|
||||
CoTaskMemFree(lpstr);
|
||||
|
||||
#endif
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
@ -362,7 +379,9 @@ HRESULT
|
|||
STDMETHODCALLTYPE
|
||||
CKsProxy::GetPages(CAUUID *pPages)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::GetPages NotImplemented\n");
|
||||
#endif
|
||||
|
||||
if (!pPages)
|
||||
return E_POINTER;
|
||||
|
@ -478,7 +497,10 @@ STDMETHODCALLTYPE
|
|||
CKsProxy::KsGetTime(
|
||||
LONGLONG* Time)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::KsGetTime\n");
|
||||
#endif
|
||||
|
||||
return PerformClockProperty(KSPROPERTY_CLOCK_TIME, KSPROPERTY_TYPE_GET, (PVOID)Time, sizeof(LONGLONG));
|
||||
}
|
||||
|
||||
|
@ -487,7 +509,10 @@ STDMETHODCALLTYPE
|
|||
CKsProxy::KsSetTime(
|
||||
LONGLONG Time)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::KsSetTime\n");
|
||||
#endif
|
||||
|
||||
return PerformClockProperty(KSPROPERTY_CLOCK_TIME, KSPROPERTY_TYPE_SET, (PVOID)&Time, sizeof(LONGLONG));
|
||||
}
|
||||
|
||||
|
@ -496,7 +521,10 @@ STDMETHODCALLTYPE
|
|||
CKsProxy::KsGetPhysicalTime(
|
||||
LONGLONG* Time)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::KsGetPhysicalTime\n");
|
||||
#endif
|
||||
|
||||
return PerformClockProperty(KSPROPERTY_CLOCK_PHYSICALTIME, KSPROPERTY_TYPE_GET, (PVOID)Time, sizeof(LONGLONG));
|
||||
}
|
||||
|
||||
|
@ -505,7 +533,10 @@ STDMETHODCALLTYPE
|
|||
CKsProxy::KsSetPhysicalTime(
|
||||
LONGLONG Time)
|
||||
{
|
||||
OutputDebugStringW(L"CKsProxy::KsSetPhysicalTime NotImplemented\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::KsSetPhysicalTime\n");
|
||||
#endif
|
||||
|
||||
return PerformClockProperty(KSPROPERTY_CLOCK_PHYSICALTIME, KSPROPERTY_TYPE_SET, (PVOID)&Time, sizeof(LONGLONG));
|
||||
}
|
||||
|
||||
|
@ -514,7 +545,10 @@ STDMETHODCALLTYPE
|
|||
CKsProxy::KsGetCorrelatedTime(
|
||||
KSCORRELATED_TIME* CorrelatedTime)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::KsGetCorrelatedTime\n");
|
||||
#endif
|
||||
|
||||
return PerformClockProperty(KSPROPERTY_CLOCK_CORRELATEDTIME, KSPROPERTY_TYPE_GET, (PVOID)CorrelatedTime, sizeof(KSCORRELATED_TIME));
|
||||
}
|
||||
|
||||
|
@ -523,7 +557,9 @@ STDMETHODCALLTYPE
|
|||
CKsProxy::KsSetCorrelatedTime(
|
||||
KSCORRELATED_TIME* CorrelatedTime)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::KsSetCorrelatedTime\n");
|
||||
#endif
|
||||
return PerformClockProperty(KSPROPERTY_CLOCK_CORRELATEDTIME, KSPROPERTY_TYPE_SET, (PVOID)CorrelatedTime, sizeof(KSCORRELATED_TIME));
|
||||
}
|
||||
|
||||
|
@ -532,7 +568,9 @@ STDMETHODCALLTYPE
|
|||
CKsProxy::KsGetCorrelatedPhysicalTime(
|
||||
KSCORRELATED_TIME* CorrelatedTime)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::KsGetCorrelatedPhysicalTime\n");
|
||||
#endif
|
||||
return PerformClockProperty(KSPROPERTY_CLOCK_CORRELATEDPHYSICALTIME, KSPROPERTY_TYPE_GET, (PVOID)CorrelatedTime, sizeof(KSCORRELATED_TIME));
|
||||
}
|
||||
|
||||
|
@ -541,7 +579,10 @@ STDMETHODCALLTYPE
|
|||
CKsProxy::KsSetCorrelatedPhysicalTime(
|
||||
KSCORRELATED_TIME* CorrelatedTime)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::KsSetCorrelatedPhysicalTime\n");
|
||||
#endif
|
||||
|
||||
return PerformClockProperty(KSPROPERTY_CLOCK_CORRELATEDPHYSICALTIME, KSPROPERTY_TYPE_SET, (PVOID)CorrelatedTime, sizeof(KSCORRELATED_TIME));
|
||||
}
|
||||
|
||||
|
@ -550,7 +591,9 @@ STDMETHODCALLTYPE
|
|||
CKsProxy::KsGetResolution(
|
||||
KSRESOLUTION* Resolution)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::KsGetResolution\n");
|
||||
#endif
|
||||
return PerformClockProperty(KSPROPERTY_CLOCK_RESOLUTION, KSPROPERTY_TYPE_GET, (PVOID)Resolution, sizeof(KSRESOLUTION));
|
||||
}
|
||||
|
||||
|
@ -559,7 +602,9 @@ STDMETHODCALLTYPE
|
|||
CKsProxy::KsGetState(
|
||||
KSSTATE* State)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::KsGetState\n");
|
||||
#endif
|
||||
return PerformClockProperty(KSPROPERTY_CLOCK_STATE, KSPROPERTY_TYPE_GET, (PVOID)State, sizeof(KSSTATE));
|
||||
}
|
||||
|
||||
|
@ -575,7 +620,9 @@ CKsProxy::GetTime(
|
|||
KSPROPERTY Property;
|
||||
ULONG BytesReturned;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::GetTime\n");
|
||||
#endif
|
||||
|
||||
if (!pTime)
|
||||
return E_POINTER;
|
||||
|
@ -620,7 +667,9 @@ CKsProxy::AdviseTime(
|
|||
ULONG BytesReturned;
|
||||
PKSEVENT_TIME_MARK Event;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::AdviseTime\n");
|
||||
#endif
|
||||
|
||||
//
|
||||
//FIXME locks
|
||||
|
@ -686,7 +735,9 @@ CKsProxy::AdvisePeriodic(
|
|||
ULONG BytesReturned;
|
||||
PKSEVENT_TIME_INTERVAL Event;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::AdvisePeriodic\n");
|
||||
#endif
|
||||
|
||||
//
|
||||
//FIXME locks
|
||||
|
@ -748,7 +799,9 @@ CKsProxy::Unadvise(
|
|||
HRESULT hr;
|
||||
ULONG BytesReturned;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::Unadvise\n");
|
||||
#endif
|
||||
|
||||
if (m_hClock)
|
||||
{
|
||||
|
@ -786,7 +839,10 @@ CKsProxy::GetCapabilities(
|
|||
Property.Id = KSPROPERTY_MEDIASEEKING_CAPABILITIES;
|
||||
Property.Flags = KSPROPERTY_TYPE_GET;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::GetCapabilities\n");
|
||||
#endif
|
||||
|
||||
|
||||
if (!pCapabilities)
|
||||
return E_POINTER;
|
||||
|
@ -836,7 +892,9 @@ CKsProxy::CheckCapabilities(
|
|||
DWORD Capabilities;
|
||||
HRESULT hr;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::CheckCapabilities\n");
|
||||
#endif
|
||||
|
||||
if (!pCapabilities)
|
||||
return E_POINTER;
|
||||
|
@ -914,11 +972,13 @@ CKsProxy::IsFormatSupported(
|
|||
ULONG Index;
|
||||
HRESULT hr = S_FALSE;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
WCHAR Buffer[100];
|
||||
LPOLESTR pstr;
|
||||
StringFromCLSID(*pFormat, &pstr);
|
||||
swprintf(Buffer, L"CKsProxy::IsFormatSupported %s\n",pstr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
if (!pFormat)
|
||||
return E_POINTER;
|
||||
|
@ -927,8 +987,10 @@ CKsProxy::IsFormatSupported(
|
|||
hr = GetMediaSeekingFormats(&FormatList);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
swprintf(Buffer, L"CKsProxy::IsFormatSupported NumFormat %lu\n",FormatList->Count);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
//iterate through format list
|
||||
pGuid = (LPGUID)(FormatList + 1);
|
||||
|
@ -961,7 +1023,9 @@ CKsProxy::IsFormatSupported(
|
|||
{
|
||||
// plugin does not support interface
|
||||
hr = S_FALSE;
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::IsFormatSupported plugin does not support IMediaSeeking interface\n");
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -986,7 +1050,9 @@ CKsProxy::QueryPreferredFormat(
|
|||
HRESULT hr;
|
||||
ULONG Index;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::QueryPreferredFormat\n");
|
||||
#endif
|
||||
|
||||
if (!pFormat)
|
||||
return E_POINTER;
|
||||
|
@ -1046,7 +1112,9 @@ CKsProxy::GetTimeFormat(
|
|||
Property.Id = KSPROPERTY_MEDIASEEKING_TIMEFORMAT;
|
||||
Property.Flags = KSPROPERTY_TYPE_GET;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::GetTimeFormat\n");
|
||||
#endif
|
||||
|
||||
hr = KsSynchronousDeviceControl(m_hDevice, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSPROPERTY), (PVOID)pFormat, sizeof(GUID), &BytesReturned);
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND) || hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_SET_NOT_FOUND))
|
||||
|
@ -1086,7 +1154,9 @@ CKsProxy::IsUsingTimeFormat(
|
|||
{
|
||||
GUID Format;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::IsUsingTimeFormat\n");
|
||||
#endif
|
||||
|
||||
if (FAILED(QueryPreferredFormat(&Format)))
|
||||
return S_FALSE;
|
||||
|
@ -1110,7 +1180,9 @@ CKsProxy::SetTimeFormat(
|
|||
Property.Id = KSPROPERTY_MEDIASEEKING_TIMEFORMAT;
|
||||
Property.Flags = KSPROPERTY_TYPE_SET;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::SetTimeFormat\n");
|
||||
#endif
|
||||
|
||||
hr = KsSynchronousDeviceControl(m_hDevice, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSPROPERTY), (PVOID)pFormat, sizeof(GUID), &BytesReturned);
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND) || hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_SET_NOT_FOUND))
|
||||
|
@ -1158,7 +1230,9 @@ CKsProxy::GetDuration(
|
|||
Property.Id = KSPROPERTY_MEDIASEEKING_DURATION;
|
||||
Property.Flags = KSPROPERTY_TYPE_GET;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::GetDuration\n");
|
||||
#endif
|
||||
|
||||
hr = KsSynchronousDeviceControl(m_hDevice, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSPROPERTY), (PVOID)pDuration, sizeof(LONGLONG), &BytesReturned);
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND) || hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_SET_NOT_FOUND))
|
||||
|
@ -1204,7 +1278,9 @@ CKsProxy::GetStopPosition(
|
|||
Property.Id = KSPROPERTY_MEDIASEEKING_STOPPOSITION;
|
||||
Property.Flags = KSPROPERTY_TYPE_GET;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::GetStopPosition\n");
|
||||
#endif
|
||||
|
||||
hr = KsSynchronousDeviceControl(m_hDevice, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSPROPERTY), (PVOID)pStop, sizeof(LONGLONG), &BytesReturned);
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND) || hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_SET_NOT_FOUND))
|
||||
|
@ -1250,7 +1326,9 @@ CKsProxy::GetCurrentPosition(
|
|||
Property.Id = KSPROPERTY_MEDIASEEKING_POSITION;
|
||||
Property.Flags = KSPROPERTY_TYPE_GET;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::GetCurrentPosition\n");
|
||||
#endif
|
||||
|
||||
hr = KsSynchronousDeviceControl(m_hDevice, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSPROPERTY), (PVOID)pCurrent, sizeof(LONGLONG), &BytesReturned);
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND) || hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_SET_NOT_FOUND))
|
||||
|
@ -1300,7 +1378,9 @@ CKsProxy::ConvertTimeFormat(
|
|||
Property.Property.Id = KSPROPERTY_MEDIASEEKING_CONVERTTIMEFORMAT;
|
||||
Property.Property.Flags = KSPROPERTY_TYPE_GET;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::ConvertTimeFormat\n");
|
||||
#endif
|
||||
|
||||
if (!pTargetFormat)
|
||||
{
|
||||
|
@ -1383,7 +1463,9 @@ CKsProxy::SetPositions(
|
|||
Positions.Stop = *pStop;
|
||||
Positions.StopFlags = (KS_SEEKING_FLAGS)dwStopFlags;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::SetPositions\n");
|
||||
#endif
|
||||
|
||||
hr = KsSynchronousDeviceControl(m_hDevice, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSPROPERTY), (PVOID)&Positions, sizeof(KSPROPERTY_POSITIONS), &BytesReturned);
|
||||
if (SUCCEEDED(hr))
|
||||
|
@ -1444,7 +1526,9 @@ CKsProxy::GetPositions(
|
|||
{
|
||||
HRESULT hr;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::GetPositions\n");
|
||||
#endif
|
||||
|
||||
hr = GetCurrentPosition(pCurrent);
|
||||
if (SUCCEEDED(hr))
|
||||
|
@ -1468,7 +1552,9 @@ CKsProxy::GetAvailable(
|
|||
Property.Id = KSPROPERTY_MEDIASEEKING_AVAILABLE;
|
||||
Property.Flags = KSPROPERTY_TYPE_GET;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::GetAvailable\n");
|
||||
#endif
|
||||
|
||||
hr = KsSynchronousDeviceControl(m_hDevice, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSPROPERTY), (PVOID)&Media, sizeof(KSPROPERTY_MEDIAAVAILABLE), &BytesReturned);
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND) || hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_SET_NOT_FOUND))
|
||||
|
@ -1512,7 +1598,9 @@ STDMETHODCALLTYPE
|
|||
CKsProxy::SetRate(
|
||||
double dRate)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::SetRate\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -1521,7 +1609,9 @@ STDMETHODCALLTYPE
|
|||
CKsProxy::GetRate(
|
||||
double *pdRate)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::GetRate\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -1538,7 +1628,9 @@ CKsProxy::GetPreroll(
|
|||
Property.Id = KSPROPERTY_MEDIASEEKING_PREROLL;
|
||||
Property.Flags = KSPROPERTY_TYPE_GET;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::GetPreroll\n");
|
||||
#endif
|
||||
|
||||
hr = KsSynchronousDeviceControl(m_hDevice, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSPROPERTY), (PVOID)pllPreroll, sizeof(LONGLONG), &BytesReturned);
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND) || hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_SET_NOT_FOUND))
|
||||
|
@ -1584,7 +1676,7 @@ CKsProxy::GetMiscFlags()
|
|||
HRESULT hr;
|
||||
PIN_DIRECTION PinDirection;
|
||||
KSPIN_COMMUNICATION Communication;
|
||||
WCHAR Buffer[100];
|
||||
|
||||
|
||||
for(Index = 0; Index < m_Pins.size(); Index++)
|
||||
{
|
||||
|
@ -1599,7 +1691,7 @@ CKsProxy::GetMiscFlags()
|
|||
if (SUCCEEDED(GetPinCommunication(Index, //FIXME verify PinId
|
||||
&Communication)))
|
||||
{
|
||||
if (Communication == KSPIN_COMMUNICATION_NONE || Communication == KSPIN_COMMUNICATION_BRIDGE)
|
||||
if (Communication != KSPIN_COMMUNICATION_NONE && Communication != KSPIN_COMMUNICATION_BRIDGE)
|
||||
{
|
||||
Flags |= AM_FILTER_MISC_FLAGS_IS_SOURCE;
|
||||
}
|
||||
|
@ -1608,8 +1700,12 @@ CKsProxy::GetMiscFlags()
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CKsProxy::GetMiscFlags stub Flags %x\n", Flags);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
return Flags;
|
||||
}
|
||||
|
||||
|
@ -1625,8 +1721,11 @@ CKsProxy::KsProperty(
|
|||
ULONG DataLength,
|
||||
ULONG* BytesReturned)
|
||||
{
|
||||
assert(m_hDevice != 0);
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::KsProperty\n");
|
||||
#endif
|
||||
|
||||
assert(m_hDevice != 0);
|
||||
return KsSynchronousDeviceControl(m_hDevice, IOCTL_KS_PROPERTY, (PVOID)Property, PropertyLength, (PVOID)PropertyData, DataLength, BytesReturned);
|
||||
}
|
||||
|
||||
|
@ -1639,8 +1738,11 @@ CKsProxy::KsMethod(
|
|||
ULONG DataLength,
|
||||
ULONG* BytesReturned)
|
||||
{
|
||||
assert(m_hDevice != 0);
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::KsMethod\n");
|
||||
#endif
|
||||
|
||||
assert(m_hDevice != 0);
|
||||
return KsSynchronousDeviceControl(m_hDevice, IOCTL_KS_METHOD, (PVOID)Method, MethodLength, (PVOID)MethodData, DataLength, BytesReturned);
|
||||
}
|
||||
|
||||
|
@ -1653,8 +1755,11 @@ CKsProxy::KsEvent(
|
|||
ULONG DataLength,
|
||||
ULONG* BytesReturned)
|
||||
{
|
||||
assert(m_hDevice != 0);
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::KsEvent\n");
|
||||
#endif
|
||||
|
||||
assert(m_hDevice != 0);
|
||||
if (EventLength)
|
||||
return KsSynchronousDeviceControl(m_hDevice, IOCTL_KS_ENABLE_EVENT, (PVOID)Event, EventLength, (PVOID)EventData, DataLength, BytesReturned);
|
||||
else
|
||||
|
@ -1677,7 +1782,9 @@ CKsProxy::Set(
|
|||
{
|
||||
ULONG BytesReturned;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::Set\n");
|
||||
#endif
|
||||
|
||||
if (cbInstanceData)
|
||||
{
|
||||
|
@ -1721,7 +1828,9 @@ CKsProxy::Get(
|
|||
{
|
||||
ULONG BytesReturned;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::Get\n");
|
||||
#endif
|
||||
|
||||
if (cbInstanceData)
|
||||
{
|
||||
|
@ -1762,7 +1871,9 @@ CKsProxy::QuerySupported(
|
|||
KSPROPERTY Property;
|
||||
ULONG BytesReturned;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::QuerySupported\n");
|
||||
#endif
|
||||
|
||||
Property.Set = guidPropSet;
|
||||
Property.Id = dwPropID;
|
||||
|
@ -1787,7 +1898,9 @@ CKsProxy::CreateNodeInstance(
|
|||
{
|
||||
HRESULT hr;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::CreateNodeInstance\n");
|
||||
#endif
|
||||
|
||||
*Interface = NULL;
|
||||
|
||||
|
@ -1812,7 +1925,9 @@ STDMETHODCALLTYPE
|
|||
CKsProxy::KsAddAggregate(
|
||||
IN REFGUID AggregateClass)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::KsAddAggregate NotImplemented\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -1821,7 +1936,10 @@ STDMETHODCALLTYPE
|
|||
CKsProxy::KsRemoveAggregate(
|
||||
REFGUID AggregateClass)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::KsRemoveAggregate NotImplemented\n");
|
||||
#endif
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -1834,8 +1952,10 @@ HRESULT
|
|||
STDMETHODCALLTYPE
|
||||
CKsProxy::IsDirty()
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::IsDirty Notimplemented\n");
|
||||
DebugBreak();
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -1853,7 +1973,9 @@ CKsProxy::Load(
|
|||
ULONG PinId;
|
||||
LPOLESTR pMajor, pSub, pFormat;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::Load\n");
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
ULONG Version = ReadInt(pStm, hr);
|
||||
|
@ -1923,7 +2045,10 @@ CKsProxy::Save(
|
|||
IStream *pStm,
|
||||
BOOL fClearDirty)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::Save Notimplemented\n");
|
||||
#endif
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -1932,8 +2057,11 @@ STDMETHODCALLTYPE
|
|||
CKsProxy::GetSizeMax(
|
||||
ULARGE_INTEGER *pcbSize)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::GetSizeMax Notimplemented\n");
|
||||
DebugBreak();
|
||||
#endif
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -1945,8 +2073,9 @@ HRESULT
|
|||
STDMETHODCALLTYPE
|
||||
CKsProxy::DeviceInfo(CLSID *pclsidInterfaceClass, LPWSTR *pwszSymbolicLink)
|
||||
{
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::DeviceInfo\n");
|
||||
#endif
|
||||
|
||||
if (!m_DevicePath)
|
||||
{
|
||||
|
@ -1971,7 +2100,9 @@ HRESULT
|
|||
STDMETHODCALLTYPE
|
||||
CKsProxy::Reassociate(void)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::Reassociate\n");
|
||||
#endif
|
||||
|
||||
if (!m_DevicePath || m_hDevice)
|
||||
{
|
||||
|
@ -1994,7 +2125,9 @@ HRESULT
|
|||
STDMETHODCALLTYPE
|
||||
CKsProxy::Disassociate(void)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::Disassociate\n");
|
||||
#endif
|
||||
|
||||
if (!m_hDevice)
|
||||
return E_HANDLE;
|
||||
|
@ -2012,7 +2145,10 @@ HANDLE
|
|||
STDMETHODCALLTYPE
|
||||
CKsProxy::KsGetClockHandle()
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::KsGetClockHandle\n");
|
||||
#endif
|
||||
|
||||
return m_hClock;
|
||||
}
|
||||
|
||||
|
@ -2025,7 +2161,10 @@ HANDLE
|
|||
STDMETHODCALLTYPE
|
||||
CKsProxy::KsGetObjectHandle()
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::KsGetObjectHandle\n");
|
||||
#endif
|
||||
|
||||
return m_hDevice;
|
||||
}
|
||||
|
||||
|
@ -2036,7 +2175,10 @@ HRESULT
|
|||
STDMETHODCALLTYPE
|
||||
CKsProxy::InitNew( void)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::InitNew\n");
|
||||
#endif
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -2323,7 +2465,6 @@ CKsProxy::CreatePins()
|
|||
KSPIN_DATAFLOW DataFlow;
|
||||
KSPIN_COMMUNICATION Communication;
|
||||
HRESULT hr;
|
||||
WCHAR Buffer[100];
|
||||
LPWSTR PinName;
|
||||
IPin * pPin;
|
||||
ULONG InputPin = 0;
|
||||
|
@ -2390,8 +2531,12 @@ CKsProxy::CreatePins()
|
|||
// store pins
|
||||
m_Pins.push_back(pPin);
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"Index %lu DataFlow %lu Name %s\n", Index, DataFlow, PinName);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
|
@ -2402,14 +2547,16 @@ STDMETHODCALLTYPE
|
|||
CKsProxy::Load(IPropertyBag *pPropBag, IErrorLog *pErrorLog)
|
||||
{
|
||||
HRESULT hr;
|
||||
WCHAR Buffer[100];
|
||||
VARIANT varName;
|
||||
LPGUID pGuid;
|
||||
ULONG NumGuids = 0;
|
||||
HDEVINFO hList;
|
||||
SP_DEVICE_INTERFACE_DATA DeviceInterfaceData;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
WCHAR Buffer[100];
|
||||
OutputDebugStringW(L"CKsProxy::Load\n");
|
||||
#endif
|
||||
|
||||
// read device path
|
||||
varName.vt = VT_BSTR;
|
||||
|
@ -2417,14 +2564,18 @@ CKsProxy::Load(IPropertyBag *pPropBag, IErrorLog *pErrorLog)
|
|||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
swprintf(Buffer, L"CKsProxy::Load Read %lx\n", hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
return MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, GetLastError());
|
||||
}
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"DevicePath: ");
|
||||
OutputDebugStringW(varName.bstrVal);
|
||||
OutputDebugStringW(L"\n");
|
||||
#endif
|
||||
|
||||
// create device list
|
||||
hList = SetupDiCreateDeviceInfoListExW(NULL, NULL, NULL, NULL);
|
||||
|
@ -2453,9 +2604,10 @@ CKsProxy::Load(IPropertyBag *pPropBag, IErrorLog *pErrorLog)
|
|||
if (m_hDevice == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
// failed to open device
|
||||
#ifdef KSPROXY_TRACE
|
||||
swprintf(Buffer, L"CKsProxy:: failed to open device with %lx\n", GetLastError());
|
||||
OutputDebugStringW(Buffer);
|
||||
|
||||
#endif
|
||||
return MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, GetLastError());
|
||||
}
|
||||
|
||||
|
@ -2493,7 +2645,9 @@ HRESULT
|
|||
STDMETHODCALLTYPE
|
||||
CKsProxy::Save(IPropertyBag *pPropBag, BOOL fClearDirty, BOOL fSaveAllProperties)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::Save\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -2506,7 +2660,9 @@ STDMETHODCALLTYPE
|
|||
CKsProxy::GetClassID(
|
||||
CLSID *pClassID)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::GetClassID\n");
|
||||
#endif
|
||||
CopyMemory(pClassID, &CLSID_Proxy, sizeof(GUID));
|
||||
|
||||
return S_OK;
|
||||
|
@ -2516,8 +2672,21 @@ HRESULT
|
|||
STDMETHODCALLTYPE
|
||||
CKsProxy::Stop()
|
||||
{
|
||||
OutputDebugStringW(L"CKsProxy::Stop : NotImplemented\n");
|
||||
return E_NOTIMPL;
|
||||
HRESULT hr;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::Stop\n");
|
||||
#endif
|
||||
|
||||
EnterCriticalSection(&m_Lock);
|
||||
|
||||
hr = SetPinState(KSSTATE_STOP);
|
||||
if (SUCCEEDED(hr))
|
||||
m_FilterState = State_Stopped;
|
||||
|
||||
LeaveCriticalSection(&m_Lock);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
|
@ -2526,17 +2695,28 @@ CKsProxy::Pause()
|
|||
{
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::Pause\n");
|
||||
#endif
|
||||
|
||||
if (m_FilterState == State_Stopped)
|
||||
EnterCriticalSection(&m_Lock);
|
||||
|
||||
if (m_FilterState == State_Running)
|
||||
{
|
||||
hr = SetPinState(KSSTATE_PAUSE);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = SetPinState(KSSTATE_STOP);
|
||||
}
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
if (m_FilterState == State_Stopped)
|
||||
{
|
||||
hr = SetPinState(KSSTATE_PAUSE);
|
||||
}
|
||||
}
|
||||
|
||||
m_FilterState = State_Paused;
|
||||
if (SUCCEEDED(hr))
|
||||
m_FilterState = State_Paused;
|
||||
|
||||
LeaveCriticalSection(&m_Lock);
|
||||
return hr;
|
||||
|
||||
}
|
||||
|
@ -2548,23 +2728,32 @@ CKsProxy::Run(
|
|||
{
|
||||
HRESULT hr;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::Run\n");
|
||||
#endif
|
||||
|
||||
EnterCriticalSection(&m_Lock);
|
||||
|
||||
if (m_FilterState == State_Stopped)
|
||||
{
|
||||
LeaveCriticalSection(&m_Lock);
|
||||
// setting filter state to pause
|
||||
hr = Pause();
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
EnterCriticalSection(&m_Lock);
|
||||
assert(m_FilterState == State_Paused);
|
||||
}
|
||||
|
||||
hr = SetPinState(KSSTATE_RUN);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
m_FilterState = State_Running;
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
m_FilterState = State_Running;
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&m_Lock);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
@ -2578,6 +2767,7 @@ CKsProxy::SetPinState(
|
|||
IKsObject *pObject;
|
||||
ULONG BytesReturned;
|
||||
KSPROPERTY Property;
|
||||
PIN_INFO PinInfo;
|
||||
|
||||
Property.Set = KSPROPSETID_Connection;
|
||||
Property.Id = KSPROPERTY_CONNECTION_STATE;
|
||||
|
@ -2602,6 +2792,22 @@ CKsProxy::SetPinState(
|
|||
// release connected pin
|
||||
TempPin->Release();
|
||||
|
||||
// query for the pin info
|
||||
hr = Pin->QueryPinInfo(&PinInfo);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
if (PinInfo.pFilter)
|
||||
PinInfo.pFilter->Release();
|
||||
|
||||
if (PinInfo.dir == PINDIR_OUTPUT)
|
||||
{
|
||||
hr = COutputPin_SetState(Pin, State);
|
||||
if (SUCCEEDED(hr))
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//query IKsObject interface
|
||||
hr = Pin->QueryInterface(IID_IKsObject, (void**)&pObject);
|
||||
|
||||
|
@ -2614,9 +2820,11 @@ CKsProxy::SetPinState(
|
|||
// now set state
|
||||
hr = KsSynchronousDeviceControl(hPin, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSPROPERTY), (PVOID)&State, sizeof(KSSTATE), &BytesReturned);
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CKsProxy::SetPinState Index %u State %u hr %lx\n", Index, State, hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
@ -2630,6 +2838,9 @@ CKsProxy::GetState(
|
|||
DWORD dwMilliSecsTimeout,
|
||||
FILTER_STATE *State)
|
||||
{
|
||||
if (!State)
|
||||
return E_POINTER;
|
||||
|
||||
*State = m_FilterState;
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -2649,8 +2860,9 @@ CKsProxy::SetSyncSource(
|
|||
ULONG BytesReturned;
|
||||
PIN_DIRECTION PinDir;
|
||||
|
||||
// Plug In Distributor: IKsClock
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::SetSyncSource\n");
|
||||
#endif
|
||||
|
||||
// FIXME
|
||||
// need locks
|
||||
|
@ -2744,7 +2956,9 @@ CKsProxy::SetSyncSource(
|
|||
}
|
||||
|
||||
m_ReferenceClock = pClock;
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::SetSyncSource done\n");
|
||||
#endif
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -2753,7 +2967,9 @@ STDMETHODCALLTYPE
|
|||
CKsProxy::GetSyncSource(
|
||||
IReferenceClock **pClock)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::GetSyncSource\n");
|
||||
#endif
|
||||
|
||||
if (!pClock)
|
||||
return E_POINTER;
|
||||
|
@ -2770,7 +2986,10 @@ STDMETHODCALLTYPE
|
|||
CKsProxy::EnumPins(
|
||||
IEnumPins **ppEnum)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::EnumPins\n");
|
||||
#endif
|
||||
|
||||
return CEnumPins_fnConstructor(m_Pins, IID_IEnumPins, (void**)ppEnum);
|
||||
}
|
||||
|
||||
|
@ -2781,7 +3000,9 @@ CKsProxy::FindPin(
|
|||
{
|
||||
ULONG PinId;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::FindPin\n");
|
||||
#endif
|
||||
|
||||
if (!ppPin)
|
||||
return E_POINTER;
|
||||
|
@ -2817,7 +3038,9 @@ CKsProxy::QueryFilterInfo(
|
|||
if (!pInfo)
|
||||
return E_POINTER;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::QueryFilterInfo\n");
|
||||
#endif
|
||||
|
||||
pInfo->achName[0] = L'\0';
|
||||
pInfo->pGraph = m_pGraph;
|
||||
|
@ -2834,7 +3057,11 @@ CKsProxy::JoinFilterGraph(
|
|||
IFilterGraph *pGraph,
|
||||
LPCWSTR pName)
|
||||
{
|
||||
OutputDebugStringW(L"CKsProxy::JoinFilterGraph\n");
|
||||
#ifdef KSPROXY_TRACE
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CKsProxy::JoinFilterGraph pName %s pGraph %p m_Ref %u\n", pName, pGraph, m_Ref);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
if (pGraph)
|
||||
{
|
||||
|
@ -2856,7 +3083,9 @@ STDMETHODCALLTYPE
|
|||
CKsProxy::QueryVendorInfo(
|
||||
LPWSTR *pVendorInfo)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::QueryVendorInfo\n");
|
||||
#endif
|
||||
return StringFromCLSID(CLSID_Proxy, pVendorInfo);
|
||||
}
|
||||
|
||||
|
@ -2868,7 +3097,10 @@ HRESULT
|
|||
STDMETHODCALLTYPE
|
||||
CKsProxy::Register()
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::Register : NotImplemented\n");
|
||||
#endif
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -2876,7 +3108,9 @@ HRESULT
|
|||
STDMETHODCALLTYPE
|
||||
CKsProxy::Unregister()
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsProxy::Unregister : NotImplemented\n");
|
||||
#endif
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -2887,11 +3121,13 @@ CKsProxy_Constructor(
|
|||
REFIID riid,
|
||||
LPVOID * ppv)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
WCHAR Buffer[100];
|
||||
LPOLESTR pstr;
|
||||
StringFromCLSID(riid, &pstr);
|
||||
swprintf(Buffer, L"CKsProxy_Constructor pUnkOuter %p riid %s\n", pUnkOuter, pstr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
CKsProxy * handler = new CKsProxy();
|
||||
|
||||
|
|
|
@ -88,7 +88,9 @@ STDMETHODCALLTYPE
|
|||
CKsQualityForwarder::KsFlushClient(
|
||||
IN IKsPin *Pin)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugString("UNIMPLEMENTED\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
HRESULT
|
||||
|
@ -101,14 +103,18 @@ CKsQualityForwarder_Constructor(
|
|||
HRESULT hr;
|
||||
HANDLE handle;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsQualityForwarder_Constructor\n");
|
||||
#endif
|
||||
|
||||
// open default clock
|
||||
hr = KsOpenDefaultDevice(KSCATEGORY_QUALITY, GENERIC_READ | GENERIC_WRITE, &handle);
|
||||
|
||||
if (hr != NOERROR)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugString("CKsClockForwarder_Constructor failed to open device\n");
|
||||
#endif
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
|
||||
#include "precomp.h"
|
||||
|
||||
const GUID CLSID_DVBTNetworkProvider = {0x216c62df, 0x6d7f, 0x4e9a, {0x85, 0x71, 0x5, 0xf1, 0x4e, 0xdb, 0x76, 0x6a}};
|
||||
|
||||
static INTERFACE_TABLE InterfaceTable[] =
|
||||
{
|
||||
{&CLSID_DVBTNetworkProvider, CNetworkProvider_fnConstructor},
|
||||
|
|
|
@ -8,11 +8,15 @@
|
|||
*/
|
||||
#include "precomp.h"
|
||||
|
||||
#define DEVICE_FILTER_MASK (0x80000000)
|
||||
|
||||
class CNetworkProvider : public IBaseFilter,
|
||||
public IAMovieSetup,
|
||||
public IBDA_NetworkProvider
|
||||
{
|
||||
public:
|
||||
typedef std::vector<IUnknown*>DeviceFilterStack;
|
||||
|
||||
STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
|
||||
|
||||
STDMETHODIMP_(ULONG) AddRef()
|
||||
|
@ -58,7 +62,7 @@ public:
|
|||
HRESULT STDMETHODCALLTYPE RegisterDeviceFilter(IUnknown *pUnkFilterControl, ULONG *ppvRegisitrationContext);
|
||||
HRESULT STDMETHODCALLTYPE UnRegisterDeviceFilter(ULONG pvRegistrationContext);
|
||||
|
||||
CNetworkProvider() : m_Ref(0), m_pGraph(0), m_ReferenceClock(0), m_FilterState(State_Stopped) {m_Pins[0] = 0;};
|
||||
CNetworkProvider(LPCGUID ClassID);
|
||||
virtual ~CNetworkProvider(){};
|
||||
|
||||
protected:
|
||||
|
@ -67,6 +71,9 @@ protected:
|
|||
IReferenceClock * m_ReferenceClock;
|
||||
FILTER_STATE m_FilterState;
|
||||
IPin * m_Pins[1];
|
||||
GUID m_ClassID;
|
||||
DeviceFilterStack m_DeviceFilters;
|
||||
IScanningTuner * m_Tuner;
|
||||
};
|
||||
|
||||
HRESULT
|
||||
|
@ -75,6 +82,9 @@ CNetworkProvider::QueryInterface(
|
|||
IN REFIID refiid,
|
||||
OUT PVOID* Output)
|
||||
{
|
||||
ULONG Index;
|
||||
HRESULT hr;
|
||||
|
||||
*Output = NULL;
|
||||
|
||||
if (IsEqualGUID(refiid, IID_IUnknown))
|
||||
|
@ -94,7 +104,47 @@ CNetworkProvider::QueryInterface(
|
|||
IsEqualGUID(refiid, IID_IScanningTuner))
|
||||
{
|
||||
// construct scanning tuner
|
||||
return CScanningTunner_fnConstructor(NULL, refiid, Output);
|
||||
if (!m_Tuner)
|
||||
{
|
||||
HRESULT hr = CScanningTunner_fnConstructor(m_DeviceFilters, refiid, (void**)&m_Tuner);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
}
|
||||
m_Tuner->AddRef();
|
||||
*Output = (IUnknown*)m_Tuner;
|
||||
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
if (IsEqualGUID(refiid, IID_IBDA_NetworkProvider))
|
||||
{
|
||||
*Output = (IBDA_NetworkProvider*)(this);
|
||||
reinterpret_cast<IBDA_NetworkProvider*>(*Output)->AddRef();
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
for(Index = 0; Index < m_DeviceFilters.size(); Index++)
|
||||
{
|
||||
// get device filter
|
||||
IUnknown *pFilter = m_DeviceFilters[Index];
|
||||
|
||||
if (!pFilter)
|
||||
continue;
|
||||
|
||||
// query for requested interface
|
||||
hr = pFilter->QueryInterface(refiid, Output);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
#ifdef MSDVBNP_TRACE
|
||||
WCHAR Buffer[MAX_PATH];
|
||||
LPOLESTR lpstr;
|
||||
StringFromCLSID(refiid, &lpstr);
|
||||
swprintf(Buffer, L"CNetworkProvider::QueryInterface: DeviceFilter %lu supports %s !!!\n", Index, lpstr);
|
||||
OutputDebugStringW(Buffer);
|
||||
CoTaskMemFree(lpstr);
|
||||
#endif
|
||||
return hr;
|
||||
}
|
||||
}
|
||||
|
||||
WCHAR Buffer[MAX_PATH];
|
||||
|
@ -103,11 +153,23 @@ CNetworkProvider::QueryInterface(
|
|||
swprintf(Buffer, L"CNetworkProvider::QueryInterface: NoInterface for %s !!!\n", lpstr);
|
||||
OutputDebugStringW(Buffer);
|
||||
CoTaskMemFree(lpstr);
|
||||
|
||||
DebugBreak();
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
CNetworkProvider::CNetworkProvider(LPCGUID ClassID) : m_Ref(0),
|
||||
m_pGraph(0),
|
||||
m_ReferenceClock(0),
|
||||
m_FilterState(State_Stopped),
|
||||
m_DeviceFilters(),
|
||||
m_Tuner(0)
|
||||
{
|
||||
m_Pins[0] = 0;
|
||||
|
||||
CopyMemory(&m_ClassID, ClassID, sizeof(GUID));
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// IBaseFilter interface
|
||||
//
|
||||
|
@ -117,24 +179,29 @@ STDMETHODCALLTYPE
|
|||
CNetworkProvider::GetClassID(
|
||||
CLSID *pClassID)
|
||||
{
|
||||
OutputDebugStringW(L"CNetworkProvider::GetClassID : NotImplemented\n");
|
||||
return E_NOTIMPL;
|
||||
OutputDebugStringW(L"CNetworkProvider::GetClassID\n");
|
||||
CopyMemory(&pClassID, &m_ClassID, sizeof(GUID));
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CNetworkProvider::Stop()
|
||||
{
|
||||
OutputDebugStringW(L"CNetworkProvider::Stop : NotImplemented\n");
|
||||
return E_NOTIMPL;
|
||||
OutputDebugStringW(L"CNetworkProvider::Stop\n");
|
||||
m_FilterState = State_Stopped;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CNetworkProvider::Pause()
|
||||
{
|
||||
OutputDebugStringW(L"CNetworkProvider::Pause : NotImplemented\n");
|
||||
return E_NOTIMPL;
|
||||
OutputDebugStringW(L"CNetworkProvider::Pause\n");
|
||||
|
||||
m_FilterState = State_Paused;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
|
@ -142,8 +209,10 @@ STDMETHODCALLTYPE
|
|||
CNetworkProvider::Run(
|
||||
REFERENCE_TIME tStart)
|
||||
{
|
||||
OutputDebugStringW(L"CNetworkProvider::Run : NotImplemented\n");
|
||||
return E_NOTIMPL;
|
||||
OutputDebugStringW(L"CNetworkProvider::Run\n");
|
||||
|
||||
m_FilterState = State_Running;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
|
@ -166,7 +235,6 @@ CNetworkProvider::SetSyncSource(
|
|||
pClock->AddRef();
|
||||
|
||||
}
|
||||
|
||||
if (m_ReferenceClock)
|
||||
{
|
||||
m_ReferenceClock->Release();
|
||||
|
@ -227,6 +295,9 @@ CNetworkProvider::QueryFilterInfo(
|
|||
pInfo->achName[0] = L'\0';
|
||||
pInfo->pGraph = m_pGraph;
|
||||
|
||||
if (m_pGraph)
|
||||
m_pGraph->AddRef();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -257,7 +328,6 @@ STDMETHODCALLTYPE
|
|||
CNetworkProvider::QueryVendorInfo(
|
||||
LPWSTR *pVendorInfo)
|
||||
{
|
||||
OutputDebugStringW(L"CNetworkProvider::QueryVendorInfo : NotImplemented\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -336,16 +406,95 @@ CNetworkProvider::RegisterDeviceFilter(
|
|||
IUnknown *pUnkFilterControl,
|
||||
ULONG *ppvRegisitrationContext)
|
||||
{
|
||||
OutputDebugStringW(L"CNetworkProvider::RegisterDeviceFilter : NotImplemented\n");
|
||||
return E_NOTIMPL;
|
||||
HRESULT hr;
|
||||
IBDA_DeviceControl * pDeviceControl = NULL;
|
||||
IBDA_Topology *pTopology = NULL;
|
||||
|
||||
OutputDebugStringW(L"CNetworkProvider::RegisterDeviceFilter\n");
|
||||
|
||||
if (!pUnkFilterControl || !ppvRegisitrationContext)
|
||||
{
|
||||
//invalid argument
|
||||
return E_POINTER;
|
||||
}
|
||||
|
||||
// the filter must support IBDA_DeviceControl and IBDA_Topology
|
||||
hr = pUnkFilterControl->QueryInterface(IID_IBDA_DeviceControl, (void**)&pDeviceControl);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
OutputDebugStringW(L"CNetworkProvider::RegisterDeviceFilter Filter does not support IBDA_DeviceControl\n");
|
||||
return hr;
|
||||
}
|
||||
|
||||
hr = pUnkFilterControl->QueryInterface(IID_IBDA_Topology, (void**)&pTopology);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
pDeviceControl->Release();
|
||||
OutputDebugStringW(L"CNetworkProvider::RegisterDeviceFilter Filter does not support IID_IBDA_Topology\n");
|
||||
return hr;
|
||||
}
|
||||
|
||||
//TODO
|
||||
// analyize device filter
|
||||
|
||||
// increment reference
|
||||
pUnkFilterControl->AddRef();
|
||||
|
||||
// release IBDA_DeviceControl interface
|
||||
pDeviceControl->Release();
|
||||
|
||||
// release IBDA_Topology interface
|
||||
pTopology->Release();
|
||||
|
||||
// store registration ctx
|
||||
*ppvRegisitrationContext = (m_DeviceFilters.size() | DEVICE_FILTER_MASK);
|
||||
|
||||
// store filter
|
||||
m_DeviceFilters.push_back(pUnkFilterControl);
|
||||
|
||||
OutputDebugStringW(L"CNetworkProvider::RegisterDeviceFilter complete\n");
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CNetworkProvider::UnRegisterDeviceFilter(ULONG pvRegistrationContext)
|
||||
{
|
||||
OutputDebugStringW(L"CNetworkProvider::UnRegisterDeviceFilter : NotImplemented\n");
|
||||
return E_NOTIMPL;
|
||||
ULONG Index;
|
||||
IUnknown * pUnknown;
|
||||
|
||||
OutputDebugStringW(L"CNetworkProvider::UnRegisterDeviceFilter\n");
|
||||
|
||||
if (!(pvRegistrationContext & DEVICE_FILTER_MASK))
|
||||
{
|
||||
// invalid argument
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
// get real index
|
||||
Index = pvRegistrationContext & ~DEVICE_FILTER_MASK;
|
||||
|
||||
if (Index >= m_DeviceFilters.size())
|
||||
{
|
||||
// invalid argument
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
pUnknown = m_DeviceFilters[Index];
|
||||
if (!pUnknown)
|
||||
{
|
||||
// filter was already de-registered
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
// remove from vector
|
||||
m_DeviceFilters[Index] = NULL;
|
||||
|
||||
// release extra reference
|
||||
pUnknown->Release();
|
||||
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
|
@ -355,7 +504,7 @@ CNetworkProvider_fnConstructor(
|
|||
REFIID riid,
|
||||
LPVOID * ppv)
|
||||
{
|
||||
CNetworkProvider * handler = new CNetworkProvider();
|
||||
CNetworkProvider * handler = new CNetworkProvider(&CLSID_DVBTNetworkProvider);
|
||||
|
||||
#ifdef MSDVBNP_TRACE
|
||||
WCHAR Buffer[MAX_PATH];
|
||||
|
|
|
@ -8,8 +8,10 @@
|
|||
*/
|
||||
#include "precomp.h"
|
||||
|
||||
#ifndef _MSC_VER
|
||||
const GUID KSDATAFORMAT_TYPE_BDA_ANTENNA = {0x71985f41, 0x1ca1, 0x11d3, {0x9c, 0xc8, 0x0, 0xc0, 0x4f, 0x79, 0x71, 0xe0}};
|
||||
const GUID GUID_NULL = {0x00000000L, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};
|
||||
#endif
|
||||
|
||||
class CPin : public IPin
|
||||
{
|
||||
|
|
|
@ -9,15 +9,18 @@
|
|||
#include <ks.h>
|
||||
#define __STREAMS__
|
||||
#include <ksproxy.h>
|
||||
#include <ksmedia.h>
|
||||
#include <stdio.h>
|
||||
#include <wchar.h>
|
||||
#include <tchar.h>
|
||||
#include <uuids.h>
|
||||
#include <bdatypes.h>
|
||||
#include <bdaiface.h>
|
||||
#include <bdatif.h>
|
||||
#include <bdamedia.h>
|
||||
#include <tuner.h>
|
||||
#include <assert.h>
|
||||
#include <vector>
|
||||
|
||||
typedef HRESULT (CALLBACK *LPFNCREATEINSTANCE)(IUnknown* pUnkOuter, REFIID riid, LPVOID* ppvObject);
|
||||
|
||||
|
@ -46,7 +49,7 @@ CNetworkProvider_fnConstructor(
|
|||
HRESULT
|
||||
WINAPI
|
||||
CScanningTunner_fnConstructor(
|
||||
IUnknown *pUnknown,
|
||||
std::vector<IUnknown*> & m_DeviceFilter,
|
||||
REFIID riid,
|
||||
LPVOID * ppv);
|
||||
|
||||
|
@ -79,4 +82,8 @@ CEnumMediaTypes_fnConstructor(
|
|||
REFIID riid,
|
||||
LPVOID * ppv);
|
||||
|
||||
#ifndef _MSC_VER
|
||||
extern const GUID CLSID_DVBTNetworkProvider;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -48,12 +48,19 @@ public:
|
|||
HRESULT STDMETHODCALLTYPE ScanDown(long MillisecondsPause);
|
||||
HRESULT STDMETHODCALLTYPE AutoProgram();
|
||||
|
||||
CScanningTunner() : m_Ref(0), m_TuningSpace(0){};
|
||||
virtual ~CScanningTunner(){};
|
||||
|
||||
CScanningTunner(std::vector<IUnknown*> & DeviceFilters) : m_Ref(0), m_TuningSpace(0), m_DeviceFilters(DeviceFilters){};
|
||||
virtual ~CScanningTunner() {};
|
||||
HRESULT STDMETHODCALLTYPE StartChanges();
|
||||
HRESULT STDMETHODCALLTYPE CommitChanges();
|
||||
HRESULT STDMETHODCALLTYPE CheckChanges();
|
||||
HRESULT STDMETHODCALLTYPE SetLnbInfo(IBDA_LNBInfo * pLnbInfo, ULONG ulLOFLow, ULONG ulLOFHigh, ULONG ulSwitchFrequency);
|
||||
HRESULT STDMETHODCALLTYPE SetDigitalDemodulator(IBDA_DigitalDemodulator * pDigitalDemo, ModulationType ModType, FECMethod InnerFEC, BinaryConvolutionCodeRate InnerFECRate, FECMethod OuterFEC, BinaryConvolutionCodeRate OuterFECRate, ULONG SymbolRate);
|
||||
HRESULT SetFrequency(IBDA_FrequencyFilter * pFrequency, ULONG FrequencyMultiplier, ULONG Frequency, Polarisation Polarity, ULONG Range, ULONG Bandwidth);
|
||||
HRESULT STDMETHODCALLTYPE performDVBTTune(IDVBTuneRequest * pDVBTRequest, IDVBTLocator *pDVBTLocator);
|
||||
protected:
|
||||
LONG m_Ref;
|
||||
ITuningSpace * m_TuningSpace;
|
||||
std::vector<IUnknown*> & m_DeviceFilters;
|
||||
};
|
||||
|
||||
HRESULT
|
||||
|
@ -140,8 +147,48 @@ STDMETHODCALLTYPE
|
|||
CScanningTunner::put_TuneRequest(
|
||||
ITuneRequest *TuneRequest)
|
||||
{
|
||||
OutputDebugStringW(L"CScanningTunner::put_TuneRequest : NotImplemented\n");
|
||||
return E_NOTIMPL;
|
||||
IDVBTuneRequest * pDVBTRequest;
|
||||
ILocator *pLocator;
|
||||
IDVBTLocator *pDVBTLocator;
|
||||
HRESULT hr;
|
||||
|
||||
|
||||
OutputDebugStringW(L"CScanningTunner::put_TuneRequest\n");
|
||||
|
||||
// query for IDVBTuneRequest interface
|
||||
hr = TuneRequest->QueryInterface(IID_IDVBTuneRequest, (void**)&pDVBTRequest);
|
||||
|
||||
// sanity check
|
||||
assert(hr == NOERROR);
|
||||
|
||||
// get the IDVBTLocator
|
||||
hr = pDVBTRequest->get_Locator((ILocator**)&pLocator);
|
||||
|
||||
// sanity check
|
||||
assert(hr == NOERROR);
|
||||
assert(pLocator);
|
||||
|
||||
hr = pLocator->QueryInterface(IID_ILocator, (void**)&pDVBTLocator);
|
||||
|
||||
// sanity check
|
||||
assert(hr == NOERROR);
|
||||
|
||||
|
||||
StartChanges();
|
||||
CommitChanges();
|
||||
StartChanges();
|
||||
|
||||
hr = performDVBTTune(pDVBTRequest, pDVBTLocator);
|
||||
|
||||
|
||||
pDVBTLocator->Release();
|
||||
pDVBTRequest->Release();
|
||||
|
||||
CheckChanges();
|
||||
CommitChanges();
|
||||
StartChanges();
|
||||
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
|
@ -233,20 +280,431 @@ CScanningTunner::AutoProgram()
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CScanningTunner::performDVBTTune(
|
||||
IDVBTuneRequest * pDVBTRequest,
|
||||
IDVBTLocator *pDVBTLocator)
|
||||
{
|
||||
HRESULT hr;
|
||||
ULONG Index;
|
||||
IBDA_Topology *pTopo;
|
||||
IUnknown *pNode;
|
||||
IBDA_FrequencyFilter * pFrequency;
|
||||
IBDA_LNBInfo * pLnbInfo;
|
||||
IBDA_DigitalDemodulator *pDigitalDemo;
|
||||
LONG BandWidth;
|
||||
LONG Frequency;
|
||||
LONG SymbolRate;
|
||||
FECMethod InnerFEC, OuterFEC;
|
||||
BinaryConvolutionCodeRate InnerFECRate, OuterFECRate;
|
||||
ModulationType Modulation;
|
||||
|
||||
pDVBTLocator->get_Bandwidth(&BandWidth);
|
||||
pDVBTLocator->get_CarrierFrequency(&Frequency);
|
||||
pDVBTLocator->get_InnerFEC(&InnerFEC);
|
||||
pDVBTLocator->get_InnerFECRate(&InnerFECRate);
|
||||
pDVBTLocator->get_Modulation(&Modulation);
|
||||
pDVBTLocator->get_OuterFEC(&OuterFEC);
|
||||
pDVBTLocator->get_OuterFECRate(&OuterFECRate);
|
||||
pDVBTLocator->get_SymbolRate(&SymbolRate);
|
||||
|
||||
|
||||
WCHAR Buffer[1000];
|
||||
swprintf(Buffer, L"BandWidth %lu Frequency %lu Rate %lu InnerFEC %ld OuterFEC %ld InnerFECRate %ld OuterFECRate %ld Modulation %lu\n",
|
||||
BandWidth, Frequency, SymbolRate, InnerFEC, OuterFEC, InnerFECRate, OuterFECRate, Modulation);
|
||||
|
||||
OutputDebugStringW(Buffer);
|
||||
|
||||
|
||||
|
||||
for(Index = 0; Index < m_DeviceFilters.size(); Index++)
|
||||
{
|
||||
// get device filter
|
||||
IUnknown * pFilter = m_DeviceFilters[Index];
|
||||
|
||||
if (!pFilter)
|
||||
continue;
|
||||
|
||||
hr = pFilter->QueryInterface(IID_IBDA_Topology, (void**)&pTopo);
|
||||
// sanity check
|
||||
assert(hr == NOERROR);
|
||||
|
||||
pNode = NULL;
|
||||
hr = pTopo->GetControlNode(0, 1, 0, &pNode); //HACK
|
||||
|
||||
WCHAR Buffer[100];
|
||||
swprintf(Buffer, L"CScanningTunner::performDVBTTune GetControlNode %lx\n", hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
|
||||
if (FAILED(hr))
|
||||
continue;
|
||||
|
||||
// sanity check
|
||||
assert(hr == NOERROR);
|
||||
assert(pNode);
|
||||
|
||||
hr = pNode->QueryInterface(IID_IBDA_FrequencyFilter, (void**)&pFrequency);
|
||||
|
||||
swprintf(Buffer, L"CScanningTunner::performDVBTTune IID_IBDA_FrequencyFilter hr %lx\n", hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
|
||||
// sanity check
|
||||
assert(hr == NOERROR);
|
||||
|
||||
hr = SetFrequency(pFrequency, 1000 /* FIXME */, Frequency, BDA_POLARISATION_NOT_DEFINED /* FIXME */, BDA_RANGE_NOT_SET /* FIXME */, BandWidth);
|
||||
|
||||
swprintf(Buffer, L"CScanningTunner::performDVBTTune SetFrequency hr %lx\n", hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
|
||||
//sanity check
|
||||
assert(hr == NOERROR);
|
||||
|
||||
// release interface
|
||||
pFrequency->Release();
|
||||
|
||||
|
||||
hr = pNode->QueryInterface(IID_IBDA_LNBInfo, (void**)&pLnbInfo);
|
||||
|
||||
swprintf(Buffer, L"CScanningTunner::performDVBTTune IID_IBDA_LNBInfo hr %lx\n", hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
|
||||
// sanity check
|
||||
assert(hr == NOERROR);
|
||||
|
||||
hr = SetLnbInfo(pLnbInfo, ULONG_MAX /* FIXME */, ULONG_MAX /* FIXME*/, ULONG_MAX /*FIXME*/);
|
||||
|
||||
|
||||
swprintf(Buffer, L"CScanningTunner::performDVBTTune SetLnbInfo hr %lx\n", hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
|
||||
// sanity check
|
||||
assert(hr == NOERROR);
|
||||
|
||||
// release interface
|
||||
pLnbInfo->Release();
|
||||
|
||||
hr = pNode->QueryInterface(IID_IBDA_DigitalDemodulator, (void**)&pDigitalDemo);
|
||||
|
||||
swprintf(Buffer, L"CScanningTunner::performDVBTTune IID_IBDA_DigitalDemodulator hr %lx\n", hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
|
||||
// sanity check
|
||||
assert(hr == NOERROR);
|
||||
|
||||
hr = SetDigitalDemodulator(pDigitalDemo, Modulation, InnerFEC, InnerFECRate, OuterFEC, OuterFECRate, SymbolRate);
|
||||
|
||||
swprintf(Buffer, L"CScanningTunner::performDVBTTune SetDigitalDemodulator hr %lx\n", hr);
|
||||
OutputDebugStringW(Buffer);
|
||||
|
||||
// sanity check
|
||||
assert(hr == NOERROR);
|
||||
|
||||
// release interface
|
||||
pDigitalDemo->Release();
|
||||
|
||||
// release control node
|
||||
pNode->Release();
|
||||
|
||||
// release IBDA_Topology;
|
||||
pTopo->Release();
|
||||
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CScanningTunner::CheckChanges()
|
||||
{
|
||||
ULONG Index;
|
||||
HRESULT hResult = NOERROR;
|
||||
IBDA_DeviceControl * pDeviceControl;
|
||||
|
||||
for(Index = 0; Index < m_DeviceFilters.size(); Index++)
|
||||
{
|
||||
// get filter
|
||||
IUnknown * pFilter = m_DeviceFilters[Index];
|
||||
|
||||
if (!pFilter)
|
||||
continue;
|
||||
|
||||
// query for IBDA_DeviceControl interface
|
||||
hResult = pFilter->QueryInterface(IID_IBDA_DeviceControl, (void**)&pDeviceControl);
|
||||
|
||||
// sanity check
|
||||
assert(hResult == NOERROR);
|
||||
|
||||
//start changes
|
||||
hResult = pDeviceControl->CheckChanges();
|
||||
|
||||
// fix for unimplemented
|
||||
if (hResult == E_NOTIMPL)
|
||||
hResult = NOERROR;
|
||||
|
||||
// release interface
|
||||
pDeviceControl->Release();
|
||||
|
||||
if (FAILED(hResult))
|
||||
{
|
||||
//shouldnt happen
|
||||
break;
|
||||
}
|
||||
}
|
||||
// done
|
||||
return hResult;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CScanningTunner::CommitChanges()
|
||||
{
|
||||
ULONG Index;
|
||||
HRESULT hResult = NOERROR;
|
||||
IBDA_DeviceControl * pDeviceControl;
|
||||
|
||||
for(Index = 0; Index < m_DeviceFilters.size(); Index++)
|
||||
{
|
||||
// get filter
|
||||
IUnknown * pFilter = m_DeviceFilters[Index];
|
||||
|
||||
if (!pFilter)
|
||||
continue;
|
||||
|
||||
// query for IBDA_DeviceControl interface
|
||||
HRESULT hr = pFilter->QueryInterface(IID_IBDA_DeviceControl, (void**)&pDeviceControl);
|
||||
|
||||
// sanity check
|
||||
assert(hr == NOERROR);
|
||||
|
||||
//start changes
|
||||
hr = pDeviceControl->CommitChanges();
|
||||
|
||||
// fix for unimplemented
|
||||
if (hr == E_NOTIMPL)
|
||||
hr = NOERROR;
|
||||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
pDeviceControl->StartChanges();
|
||||
pDeviceControl->CommitChanges();
|
||||
hResult = E_UNEXPECTED;
|
||||
}
|
||||
|
||||
// release interface
|
||||
pDeviceControl->Release();
|
||||
|
||||
}
|
||||
|
||||
//done
|
||||
return hResult;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CScanningTunner::StartChanges()
|
||||
{
|
||||
ULONG Index;
|
||||
IBDA_DeviceControl * pDeviceControl;
|
||||
|
||||
for(Index = 0; Index < m_DeviceFilters.size(); Index++)
|
||||
{
|
||||
// get filter
|
||||
IUnknown * pFilter = m_DeviceFilters[Index];
|
||||
|
||||
if (!pFilter)
|
||||
continue;
|
||||
|
||||
// query for IBDA_DeviceControl interface
|
||||
HRESULT hr = pFilter->QueryInterface(IID_IBDA_DeviceControl, (void**)&pDeviceControl);
|
||||
|
||||
// sanity check
|
||||
assert(hr == NOERROR);
|
||||
|
||||
//start changes
|
||||
hr = pDeviceControl->StartChanges();
|
||||
|
||||
// release interface
|
||||
pDeviceControl->Release();
|
||||
|
||||
// fix for unimplemented
|
||||
if (hr == E_NOTIMPL)
|
||||
hr = NOERROR;
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
}
|
||||
|
||||
// now commit the changes
|
||||
for(Index = 0; Index < m_DeviceFilters.size(); Index++)
|
||||
{
|
||||
// get filter
|
||||
IUnknown * pFilter = m_DeviceFilters[Index];
|
||||
|
||||
if (!pFilter)
|
||||
continue;
|
||||
|
||||
// query for IBDA_DeviceControl interface
|
||||
HRESULT hr = pFilter->QueryInterface(IID_IBDA_DeviceControl, (void**)&pDeviceControl);
|
||||
|
||||
// sanity check
|
||||
assert(hr == NOERROR);
|
||||
|
||||
hr = pDeviceControl->CommitChanges();
|
||||
|
||||
// release interface
|
||||
pDeviceControl->Release();
|
||||
}
|
||||
|
||||
// done
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CScanningTunner::SetLnbInfo(
|
||||
IBDA_LNBInfo * pLnbInfo,
|
||||
ULONG ulLOFLow,
|
||||
ULONG ulLOFHigh,
|
||||
ULONG ulSwitchFrequency)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
hr = pLnbInfo->put_LocalOscilatorFrequencyLowBand(ulLOFLow);
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND) || hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_SET_NOT_FOUND))
|
||||
hr = NOERROR;
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = pLnbInfo->put_LocalOscilatorFrequencyHighBand(ulLOFHigh);
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND) || hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_SET_NOT_FOUND))
|
||||
hr = NOERROR;
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = pLnbInfo->put_HighLowSwitchFrequency(ulSwitchFrequency);
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND) || hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_SET_NOT_FOUND))
|
||||
hr = NOERROR;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
CScanningTunner::SetFrequency(
|
||||
IBDA_FrequencyFilter * pFrequency,
|
||||
ULONG FrequencyMultiplier,
|
||||
ULONG Frequency,
|
||||
Polarisation Polarity,
|
||||
ULONG Range,
|
||||
ULONG Bandwidth)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
hr = pFrequency->put_FrequencyMultiplier(FrequencyMultiplier);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = pFrequency->put_Frequency(Frequency);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = pFrequency->put_Polarity(Polarity);
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND))
|
||||
hr = NOERROR;
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = pFrequency->put_Range(Range);
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND))
|
||||
hr = NOERROR;
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = pFrequency->put_Bandwidth(Bandwidth);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CScanningTunner::SetDigitalDemodulator(
|
||||
IBDA_DigitalDemodulator * pDigitalDemo,
|
||||
ModulationType ModType,
|
||||
FECMethod InnerFEC,
|
||||
BinaryConvolutionCodeRate InnerFECRate,
|
||||
FECMethod OuterFEC,
|
||||
BinaryConvolutionCodeRate OuterFECRate,
|
||||
ULONG SymbolRate)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
hr = pDigitalDemo->put_ModulationType(&ModType);
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND) || hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_SET_NOT_FOUND))
|
||||
hr = NOERROR;
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = pDigitalDemo->put_InnerFECMethod(&InnerFEC);
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND) || hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_SET_NOT_FOUND))
|
||||
hr = NOERROR;
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = pDigitalDemo->put_InnerFECRate(&InnerFECRate);
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND) || hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_SET_NOT_FOUND))
|
||||
hr = NOERROR;
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = pDigitalDemo->put_OuterFECMethod(&OuterFEC);
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND) || hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_SET_NOT_FOUND))
|
||||
hr = NOERROR;
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = pDigitalDemo->put_OuterFECRate(&OuterFECRate);
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND) || hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_SET_NOT_FOUND))
|
||||
hr = NOERROR;
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = pDigitalDemo->put_SymbolRate(&SymbolRate);
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND) || hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_SET_NOT_FOUND))
|
||||
hr = NOERROR;
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
SpectralInversion Inversion = BDA_SPECTRAL_INVERSION_NOT_DEFINED;
|
||||
hr = pDigitalDemo->put_SpectralInversion(&Inversion);
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND) || hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_SET_NOT_FOUND))
|
||||
hr = NOERROR;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
HRESULT
|
||||
WINAPI
|
||||
CScanningTunner_fnConstructor(
|
||||
IUnknown *pUnknown,
|
||||
std::vector<IUnknown*> & DeviceFilter,
|
||||
REFIID riid,
|
||||
LPVOID * ppv)
|
||||
{
|
||||
CScanningTunner * handler = new CScanningTunner();
|
||||
CScanningTunner * handler = new CScanningTunner(DeviceFilter);
|
||||
|
||||
#ifdef MSDVBNP_TRACE
|
||||
WCHAR Buffer[MAX_PATH];
|
||||
LPOLESTR lpstr;
|
||||
StringFromCLSID(riid, &lpstr);
|
||||
swprintf(Buffer, L"CScanningTunner_fnConstructor riid %s pUnknown %p\n", lpstr, pUnknown);
|
||||
swprintf(Buffer, L"CScanningTunner_fnConstructor riid %s\n", lpstr);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ static WCHAR const pin_in_name[] = { 'I', 'n', 0 };
|
|||
static WCHAR const pin_out_name[] = { 'O', 'u', 't', 0 };
|
||||
|
||||
IEnumPins *pinsenum_create(IBaseFilter *filter, IPin **pins, ULONG pinCount);
|
||||
IEnumMediaTypes *mediaenum_create(AM_MEDIA_TYPE *mtype);
|
||||
IEnumMediaTypes *mediaenum_create(const AM_MEDIA_TYPE *mtype);
|
||||
|
||||
/* Fixed pins enumerator, holds filter referenced */
|
||||
typedef struct _PE_Impl {
|
||||
|
@ -258,7 +258,7 @@ Single_IEnumMediaTypes_Next(IEnumMediaTypes *iface, ULONG nTypes, AM_MEDIA_TYPE
|
|||
return E_INVALIDARG;
|
||||
if (!types || ((nTypes != 1) && !fetched))
|
||||
return E_POINTER;
|
||||
if (!This->past) {
|
||||
if (!This->past && !IsEqualGUID(&This->mtype.majortype,&GUID_NULL)) {
|
||||
AM_MEDIA_TYPE *mtype = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
|
||||
*mtype = This->mtype;
|
||||
if (mtype->cbFormat) {
|
||||
|
@ -324,7 +324,7 @@ static const IEnumMediaTypesVtbl IEnumMediaTypes_VTable =
|
|||
Single_IEnumMediaTypes_Clone,
|
||||
};
|
||||
|
||||
IEnumMediaTypes *mediaenum_create(AM_MEDIA_TYPE *mtype)
|
||||
IEnumMediaTypes *mediaenum_create(const AM_MEDIA_TYPE *mtype)
|
||||
{
|
||||
ME_Impl *obj = CoTaskMemAlloc(sizeof(ME_Impl));
|
||||
if (obj) {
|
||||
|
@ -332,14 +332,18 @@ IEnumMediaTypes *mediaenum_create(AM_MEDIA_TYPE *mtype)
|
|||
obj->me.lpVtbl = &IEnumMediaTypes_VTable;
|
||||
obj->refCount = 1;
|
||||
obj->past = FALSE;
|
||||
obj->mtype = *mtype;
|
||||
obj->mtype.pUnk = NULL;
|
||||
if (mtype->cbFormat) {
|
||||
obj->mtype.pbFormat = CoTaskMemAlloc(mtype->cbFormat);
|
||||
CopyMemory(obj->mtype.pbFormat, mtype->pbFormat, mtype->cbFormat);
|
||||
if (mtype) {
|
||||
obj->mtype = *mtype;
|
||||
obj->mtype.pUnk = NULL;
|
||||
if (mtype->cbFormat) {
|
||||
obj->mtype.pbFormat = CoTaskMemAlloc(mtype->cbFormat);
|
||||
CopyMemory(obj->mtype.pbFormat, mtype->pbFormat, mtype->cbFormat);
|
||||
}
|
||||
else
|
||||
obj->mtype.pbFormat = NULL;
|
||||
}
|
||||
else
|
||||
obj->mtype.pbFormat = NULL;
|
||||
obj->mtype.majortype = GUID_NULL;
|
||||
}
|
||||
return &obj->me;
|
||||
}
|
||||
|
@ -361,6 +365,7 @@ typedef struct _SG_Impl {
|
|||
const IMemInputPinVtbl* IMemInputPin_Vtbl;
|
||||
/* TODO: IMediaPosition, IMediaSeeking, IQualityControl */
|
||||
LONG refCount;
|
||||
CRITICAL_SECTION critSect;
|
||||
FILTER_INFO info;
|
||||
FILTER_STATE state;
|
||||
AM_MEDIA_TYPE mtype;
|
||||
|
@ -372,6 +377,8 @@ typedef struct _SG_Impl {
|
|||
ISampleGrabberCB *grabberIface;
|
||||
LONG grabberMethod;
|
||||
LONG oneShot;
|
||||
LONG bufferLen;
|
||||
void* bufferData;
|
||||
} SG_Impl;
|
||||
|
||||
enum {
|
||||
|
@ -413,6 +420,10 @@ static void SampleGrabber_cleanup(SG_Impl *This)
|
|||
ISampleGrabberCB_Release(This->grabberIface);
|
||||
if (This->mtype.pbFormat)
|
||||
CoTaskMemFree(This->mtype.pbFormat);
|
||||
if (This->bufferData)
|
||||
CoTaskMemFree(This->bufferData);
|
||||
This->critSect.DebugInfo->Spare[0] = 0;
|
||||
DeleteCriticalSection(&This->critSect);
|
||||
}
|
||||
|
||||
/* Common helper AddRef called from all interfaces */
|
||||
|
@ -471,11 +482,31 @@ static HRESULT SampleGrabber_query(SG_Impl *This, REFIID riid, void **ppvObject)
|
|||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
/* Helper that calls installed sample callbacks */
|
||||
/* Helper that buffers data and/or calls installed sample callbacks */
|
||||
static void SampleGrabber_callback(SG_Impl *This, IMediaSample *sample)
|
||||
{
|
||||
double time = 0.0;
|
||||
REFERENCE_TIME tStart, tEnd;
|
||||
if (This->bufferLen >= 0) {
|
||||
BYTE *data = 0;
|
||||
long size = IMediaSample_GetActualDataLength(sample);
|
||||
if (size >= 0 && SUCCEEDED(IMediaSample_GetPointer(sample, &data))) {
|
||||
if (!data)
|
||||
size = 0;
|
||||
EnterCriticalSection(&This->critSect);
|
||||
if (This->bufferLen != size) {
|
||||
if (This->bufferData)
|
||||
CoTaskMemFree(This->bufferData);
|
||||
This->bufferData = size ? CoTaskMemAlloc(size) : NULL;
|
||||
This->bufferLen = size;
|
||||
}
|
||||
if (size)
|
||||
CopyMemory(This->bufferData, data, size);
|
||||
LeaveCriticalSection(&This->critSect);
|
||||
}
|
||||
}
|
||||
if (!This->grabberIface)
|
||||
return;
|
||||
if (SUCCEEDED(IMediaSample_GetTime(sample, &tStart, &tEnd)))
|
||||
time = 1e-7 * tStart;
|
||||
switch (This->grabberMethod) {
|
||||
|
@ -777,11 +808,16 @@ SampleGrabber_ISampleGrabber_GetConnectedMediaType(ISampleGrabber *iface, AM_MED
|
|||
static HRESULT WINAPI
|
||||
SampleGrabber_ISampleGrabber_SetBufferSamples(ISampleGrabber *iface, BOOL bufferEm)
|
||||
{
|
||||
TRACE("(%u)\n", bufferEm);
|
||||
SG_Impl *This = impl_from_ISampleGrabber(iface);
|
||||
TRACE("(%p)->(%u)\n", This, bufferEm);
|
||||
EnterCriticalSection(&This->critSect);
|
||||
if (bufferEm) {
|
||||
FIXME("buffering not implemented\n");
|
||||
return E_NOTIMPL;
|
||||
if (This->bufferLen < 0)
|
||||
This->bufferLen = 0;
|
||||
}
|
||||
else
|
||||
This->bufferLen = -1;
|
||||
LeaveCriticalSection(&This->critSect);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -789,10 +825,29 @@ SampleGrabber_ISampleGrabber_SetBufferSamples(ISampleGrabber *iface, BOOL buffer
|
|||
static HRESULT WINAPI
|
||||
SampleGrabber_ISampleGrabber_GetCurrentBuffer(ISampleGrabber *iface, LONG *bufSize, LONG *buffer)
|
||||
{
|
||||
FIXME("(%p, %p): stub\n", bufSize, buffer);
|
||||
SG_Impl *This = impl_from_ISampleGrabber(iface);
|
||||
HRESULT ret = S_OK;
|
||||
TRACE("(%p)->(%p, %p)\n", This, bufSize, buffer);
|
||||
if (!bufSize)
|
||||
return E_POINTER;
|
||||
return E_INVALIDARG;
|
||||
EnterCriticalSection(&This->critSect);
|
||||
if (!This->pin_in.pair)
|
||||
ret = VFW_E_NOT_CONNECTED;
|
||||
else if (This->bufferLen < 0)
|
||||
ret = E_INVALIDARG;
|
||||
else if (This->bufferLen == 0)
|
||||
ret = VFW_E_WRONG_STATE;
|
||||
else {
|
||||
if (buffer) {
|
||||
if (*bufSize >= This->bufferLen)
|
||||
CopyMemory(buffer, This->bufferData, This->bufferLen);
|
||||
else
|
||||
ret = E_OUTOFMEMORY;
|
||||
}
|
||||
*bufSize = This->bufferLen;
|
||||
}
|
||||
LeaveCriticalSection(&This->critSect);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* ISampleGrabber */
|
||||
|
@ -896,8 +951,7 @@ SampleGrabber_IMemInputPin_Receive(IMemInputPin *iface, IMediaSample *sample)
|
|||
return E_POINTER;
|
||||
if ((This->state != State_Running) || (This->oneShot == OneShot_Past))
|
||||
return S_FALSE;
|
||||
if (This->grabberIface)
|
||||
SampleGrabber_callback(This, sample);
|
||||
SampleGrabber_callback(This, sample);
|
||||
hr = This->memOutput ? IMemInputPin_Receive(This->memOutput, sample) : S_OK;
|
||||
if (This->oneShot == OneShot_Wait) {
|
||||
This->oneShot = OneShot_Past;
|
||||
|
@ -913,16 +967,14 @@ static HRESULT WINAPI
|
|||
SampleGrabber_IMemInputPin_ReceiveMultiple(IMemInputPin *iface, IMediaSample **samples, LONG nSamples, LONG *nProcessed)
|
||||
{
|
||||
SG_Impl *This = impl_from_IMemInputPin(iface);
|
||||
LONG idx;
|
||||
TRACE("(%p)->(%p, %u, %p) output = %p, grabber = %p\n", This, samples, nSamples, nProcessed, This->memOutput, This->grabberIface);
|
||||
if (!samples || !nProcessed)
|
||||
return E_POINTER;
|
||||
if ((This->state != State_Running) || (This->oneShot == OneShot_Past))
|
||||
return S_FALSE;
|
||||
if (This->grabberIface) {
|
||||
LONG idx;
|
||||
for (idx = 0; idx < nSamples; idx++)
|
||||
SampleGrabber_callback(This, samples[idx]);
|
||||
}
|
||||
for (idx = 0; idx < nSamples; idx++)
|
||||
SampleGrabber_callback(This, samples[idx]);
|
||||
return This->memOutput ? IMemInputPin_ReceiveMultiple(This->memOutput, samples, nSamples, nProcessed) : S_OK;
|
||||
}
|
||||
|
||||
|
@ -1048,6 +1100,10 @@ SampleGrabber_In_IPin_ReceiveConnection(IPin *iface, IPin *connector, const AM_M
|
|||
debugstr_guid(&type->majortype), debugstr_guid(&type->subtype),
|
||||
type->lSampleSize,
|
||||
debugstr_guid(&type->formattype), type->cbFormat);
|
||||
if (!IsEqualGUID(&type->formattype, &FORMAT_None) &&
|
||||
!IsEqualGUID(&type->formattype, &GUID_NULL) &&
|
||||
!type->pbFormat)
|
||||
return VFW_E_INVALIDMEDIATYPE;
|
||||
if (!IsEqualGUID(&This->sg->mtype.majortype,&GUID_NULL) &&
|
||||
!IsEqualGUID(&This->sg->mtype.majortype,&type->majortype))
|
||||
return VFW_E_TYPE_NOT_ACCEPTED;
|
||||
|
@ -1058,10 +1114,6 @@ SampleGrabber_In_IPin_ReceiveConnection(IPin *iface, IPin *connector, const AM_M
|
|||
!IsEqualGUID(&This->sg->mtype.formattype,&FORMAT_None) &&
|
||||
!IsEqualGUID(&This->sg->mtype.formattype,&type->formattype))
|
||||
return VFW_E_TYPE_NOT_ACCEPTED;
|
||||
if (!IsEqualGUID(&type->formattype, &FORMAT_None) &&
|
||||
!IsEqualGUID(&type->formattype, &GUID_NULL) &&
|
||||
!type->pbFormat)
|
||||
return VFW_E_TYPE_NOT_ACCEPTED;
|
||||
if (This->sg->mtype.pbFormat)
|
||||
CoTaskMemFree(This->sg->mtype.pbFormat);
|
||||
This->sg->mtype = *type;
|
||||
|
@ -1212,7 +1264,7 @@ SampleGrabber_IPin_EnumMediaTypes(IPin *iface, IEnumMediaTypes **mtypes)
|
|||
TRACE("(%p)->(%p)\n", This, mtypes);
|
||||
if (!mtypes)
|
||||
return E_POINTER;
|
||||
*mtypes = mediaenum_create(&This->sg->mtype);
|
||||
*mtypes = mediaenum_create(This->sg->pin_in.pair ? &This->sg->mtype : (const AM_MEDIA_TYPE *)NULL);
|
||||
return *mtypes ? S_OK : E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
|
@ -1401,6 +1453,8 @@ HRESULT SampleGrabber_create(IUnknown *pUnkOuter, LPVOID *ppv)
|
|||
obj->pin_out.name = pin_out_name;
|
||||
obj->pin_out.sg = obj;
|
||||
obj->pin_out.pair = NULL;
|
||||
InitializeCriticalSection(&obj->critSect);
|
||||
obj->critSect.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": SG_Impl.critSect");
|
||||
obj->info.achName[0] = 0;
|
||||
obj->info.pGraph = NULL;
|
||||
obj->state = State_Stopped;
|
||||
|
@ -1413,6 +1467,8 @@ HRESULT SampleGrabber_create(IUnknown *pUnkOuter, LPVOID *ppv)
|
|||
obj->grabberIface = NULL;
|
||||
obj->grabberMethod = -1;
|
||||
obj->oneShot = OneShot_None;
|
||||
obj->bufferLen = -1;
|
||||
obj->bufferData = NULL;
|
||||
*ppv = obj;
|
||||
|
||||
return S_OK;
|
||||
|
|
|
@ -479,11 +479,16 @@ static HRESULT WINAPI FilterMapper2_UnregisterFilter(
|
|||
static HRESULT FM2_WriteFriendlyName(IPropertyBag * pPropBag, LPCWSTR szName)
|
||||
{
|
||||
VARIANT var;
|
||||
HRESULT ret;
|
||||
BSTR value;
|
||||
|
||||
V_VT(&var) = VT_BSTR;
|
||||
V_UNION(&var, bstrVal) = (BSTR)szName;
|
||||
V_UNION(&var, bstrVal) = value = SysAllocString(szName);
|
||||
|
||||
return IPropertyBag_Write(pPropBag, wszFriendlyName, &var);
|
||||
ret = IPropertyBag_Write(pPropBag, wszFriendlyName, &var);
|
||||
SysFreeString(value);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static HRESULT FM2_WriteClsid(IPropertyBag * pPropBag, REFCLSID clsid)
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
LIBRARY "idndl.dll"
|
||||
|
||||
EXPORTS
|
||||
DownlevelGetLocaleScripts = DownlevelGetLocaleScripts@12 @1
|
||||
DownlevelGetStringScripts@20 = kernel32.GetStringScripts @2
|
||||
DownlevelVerifyScripts@20 = kernel32.VerifyScripts @3
|
|
@ -7,5 +7,5 @@
|
|||
</group>
|
||||
<redefine name="WINVER">0x600</redefine>
|
||||
<file>idndl.cpp</file>
|
||||
<importlibrary definition="idndl.def" />
|
||||
<importlibrary definition="idndl.spec" />
|
||||
</module>
|
||||
|
|
|
@ -259,7 +259,7 @@ DbgUiConvertStateChangeStructure(IN PDBGUI_WAIT_STATE_CHANGE WaitStateChange,
|
|||
/* Save the image name from the TIB */
|
||||
DebugEvent->u.LoadDll.lpImageName =
|
||||
((PTEB)ThreadBasicInfo.TebBaseAddress)->
|
||||
Tib.ArbitraryUserPointer;
|
||||
NtTib.ArbitraryUserPointer;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -79,8 +79,8 @@ KiUserCallbackDispatcher(ULONG Index,
|
|||
ULONG ArgumentLength)
|
||||
{
|
||||
/* Return with the result of the callback function */
|
||||
USER_CALL *KernelCallbackTable = NtCurrentPeb()->KernelCallbackTable;
|
||||
ZwCallbackReturn(NULL,
|
||||
0,
|
||||
((USER_CALL)(NtCurrentPeb()->KernelCallbackTable[Index]))
|
||||
(Argument, ArgumentLength));
|
||||
KernelCallbackTable[Index](Argument, ArgumentLength));
|
||||
}
|
||||
|
|
|
@ -343,8 +343,6 @@ LdrpInit2(PCONTEXT Context,
|
|||
/* initalize peb lock support */
|
||||
RtlInitializeCriticalSection(&PebLock);
|
||||
Peb->FastPebLock = &PebLock;
|
||||
Peb->FastPebLockRoutine = (PPEBLOCKROUTINE)RtlEnterCriticalSection;
|
||||
Peb->FastPebUnlockRoutine = (PPEBLOCKROUTINE)RtlLeaveCriticalSection;
|
||||
|
||||
/* initialize tls bitmaps */
|
||||
RtlInitializeBitMap(&TlsBitMap, Peb->TlsBitmapBits, TLS_MINIMUM_AVAILABLE);
|
||||
|
|
|
@ -2299,8 +2299,8 @@ LdrpLoadModule(IN PWSTR SearchPath OPTIONAL,
|
|||
/* Map the dll into the process */
|
||||
ViewSize = 0;
|
||||
ImageBase = 0;
|
||||
ArbitraryUserPointer = NtCurrentTeb()->Tib.ArbitraryUserPointer;
|
||||
NtCurrentTeb()->Tib.ArbitraryUserPointer = FullDosName.Buffer;
|
||||
ArbitraryUserPointer = NtCurrentTeb()->NtTib.ArbitraryUserPointer;
|
||||
NtCurrentTeb()->NtTib.ArbitraryUserPointer = FullDosName.Buffer;
|
||||
Status = NtMapViewOfSection(SectionHandle,
|
||||
NtCurrentProcess(),
|
||||
&ImageBase,
|
||||
|
@ -2311,7 +2311,7 @@ LdrpLoadModule(IN PWSTR SearchPath OPTIONAL,
|
|||
ViewShare,
|
||||
0,
|
||||
PAGE_READONLY);
|
||||
NtCurrentTeb()->Tib.ArbitraryUserPointer = ArbitraryUserPointer;
|
||||
NtCurrentTeb()->NtTib.ArbitraryUserPointer = ArbitraryUserPointer;
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("map view of section failed (Status 0x%08lx)\n", Status);
|
||||
|
|
|
@ -83,7 +83,7 @@ VOID NTAPI
|
|||
RtlAcquirePebLock(VOID)
|
||||
{
|
||||
PPEB Peb = NtCurrentPeb ();
|
||||
Peb->FastPebLockRoutine (Peb->FastPebLock);
|
||||
RtlEnterCriticalSection(Peb->FastPebLock);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -93,7 +93,7 @@ VOID NTAPI
|
|||
RtlReleasePebLock(VOID)
|
||||
{
|
||||
PPEB Peb = NtCurrentPeb ();
|
||||
Peb->FastPebUnlockRoutine (Peb->FastPebLock);
|
||||
RtlLeaveCriticalSection(Peb->FastPebLock);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -201,11 +201,24 @@ RtlpCaptureStackLimits(IN ULONG_PTR Ebp,
|
|||
IN ULONG_PTR *StackEnd)
|
||||
{
|
||||
/* FIXME: Verify */
|
||||
*StackBegin = (ULONG_PTR)NtCurrentTeb()->Tib.StackLimit;
|
||||
*StackEnd = (ULONG_PTR)NtCurrentTeb()->Tib.StackBase;
|
||||
*StackBegin = (ULONG_PTR)NtCurrentTeb()->NtTib.StackLimit;
|
||||
*StackEnd = (ULONG_PTR)NtCurrentTeb()->NtTib.StackBase;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#ifdef _AMD64_
|
||||
VOID
|
||||
NTAPI
|
||||
RtlpGetStackLimits(
|
||||
OUT PULONG_PTR LowLimit,
|
||||
OUT PULONG_PTR HighLimit)
|
||||
{
|
||||
*LowLimit = (ULONG_PTR)NtCurrentTeb()->NtTib.StackLimit;
|
||||
*HighLimit = (ULONG_PTR)NtCurrentTeb()->NtTib.StackBase;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
RtlIsThreadWithinLoaderCallout(VOID)
|
||||
|
|
|
@ -16,8 +16,7 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
/* $Id: acledit.c 35011 2008-08-01 16:29:40Z sginsberg $
|
||||
*
|
||||
/*
|
||||
* PROJECT: ReactOS Access Control List Editor
|
||||
* FILE: lib/acledit/acledit.c
|
||||
* PURPOSE: Access Control List Editor
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/* $Id: stubs.c 35011 2008-08-01 16:29:40Z sginsberg $
|
||||
*
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS Access Control List Editor
|
||||
* FILE: lib/acledit/stubs.c
|
||||
|
|
|
@ -42,9 +42,9 @@ static VOID CloseDefaultKeys(VOID);
|
|||
NtClose(Handle); \
|
||||
}
|
||||
#define IsPredefKey(HKey) \
|
||||
(((ULONG)(HKey) & 0xF0000000) == 0x80000000)
|
||||
(((ULONG_PTR)(HKey) & 0xF0000000) == 0x80000000)
|
||||
#define GetPredefKeyIndex(HKey) \
|
||||
((ULONG)(HKey) & 0x0FFFFFFF)
|
||||
((ULONG_PTR)(HKey) & 0x0FFFFFFF)
|
||||
|
||||
static NTSTATUS OpenClassesRootKey(PHANDLE KeyHandle);
|
||||
static NTSTATUS OpenLocalMachineKey (PHANDLE KeyHandle);
|
||||
|
|
|
@ -289,7 +289,7 @@ CheckNtMartaPresent(VOID)
|
|||
{
|
||||
DWORD ErrorCode;
|
||||
|
||||
if (InterlockedCompareExchangePointer(&NtMarta,
|
||||
if (InterlockedCompareExchangePointer((PVOID)&NtMarta,
|
||||
NULL,
|
||||
NULL) == NULL)
|
||||
{
|
||||
|
@ -300,7 +300,7 @@ CheckNtMartaPresent(VOID)
|
|||
if (ErrorCode == ERROR_SUCCESS)
|
||||
{
|
||||
/* try change the NtMarta pointer */
|
||||
if (InterlockedCompareExchangePointer(&NtMarta,
|
||||
if (InterlockedCompareExchangePointer((PVOID)&NtMarta,
|
||||
&NtMartaStatic,
|
||||
NULL) != NULL)
|
||||
{
|
||||
|
@ -329,7 +329,7 @@ CheckNtMartaPresent(VOID)
|
|||
VOID
|
||||
UnloadNtMarta(VOID)
|
||||
{
|
||||
if (InterlockedExchangePointer(&NtMarta,
|
||||
if (InterlockedExchangePointer((PVOID)&NtMarta,
|
||||
NULL) != NULL)
|
||||
{
|
||||
FreeLibrary(NtMartaStatic.hDllInstance);
|
||||
|
|
|
@ -86,7 +86,7 @@ capCreateCaptureWindowW(LPCWSTR lpszWindowName,
|
|||
nWidth,
|
||||
nHeight,
|
||||
hWnd,
|
||||
(HMENU)nID,
|
||||
ULongToHandle(nID),
|
||||
hInstance,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
@ -1030,14 +1030,14 @@ HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving)
|
|||
* First filter is named "All multimedia files" and its filter is a
|
||||
* collection of all possible extensions except "*.*".
|
||||
*/
|
||||
if (RegOpenKeyW(HKEY_CLASSES_ROOT, szAVIFileExtensions, &hKey) != S_OK) {
|
||||
if (RegOpenKeyW(HKEY_CLASSES_ROOT, szAVIFileExtensions, &hKey) != ERROR_SUCCESS) {
|
||||
HeapFree(GetProcessHeap(), 0, lp);
|
||||
return AVIERR_ERROR;
|
||||
}
|
||||
for (n = 0;RegEnumKeyW(hKey, n, szFileExt, sizeof(szFileExt)/sizeof(szFileExt[0])) == S_OK;n++) {
|
||||
for (n = 0;RegEnumKeyW(hKey, n, szFileExt, sizeof(szFileExt)/sizeof(szFileExt[0])) == ERROR_SUCCESS;n++) {
|
||||
/* get CLSID to extension */
|
||||
size = sizeof(szValue);
|
||||
if (RegQueryValueW(hKey, szFileExt, szValue, &size) != S_OK)
|
||||
if (RegQueryValueW(hKey, szFileExt, szValue, &size) != ERROR_SUCCESS)
|
||||
break;
|
||||
|
||||
/* search if the CLSID is already known */
|
||||
|
@ -1078,7 +1078,7 @@ HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving)
|
|||
RegCloseKey(hKey);
|
||||
|
||||
/* 2. get descriptions for the CLSIDs and fill out szFilter */
|
||||
if (RegOpenKeyW(HKEY_CLASSES_ROOT, szClsid, &hKey) != S_OK) {
|
||||
if (RegOpenKeyW(HKEY_CLASSES_ROOT, szClsid, &hKey) != ERROR_SUCCESS) {
|
||||
HeapFree(GetProcessHeap(), 0, lp);
|
||||
return AVIERR_ERROR;
|
||||
}
|
||||
|
@ -1086,7 +1086,7 @@ HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving)
|
|||
/* first the description */
|
||||
if (n != 0) {
|
||||
size = sizeof(szValue);
|
||||
if (RegQueryValueW(hKey, lp[n].szClsid, szValue, &size) == S_OK) {
|
||||
if (RegQueryValueW(hKey, lp[n].szClsid, szValue, &size) == ERROR_SUCCESS) {
|
||||
size = lstrlenW(szValue);
|
||||
lstrcpynW(szFilter, szValue, cbFilter);
|
||||
}
|
||||
|
|
66
dll/win32/batt/batt.c
Normal file
66
dll/win32/batt/batt.c
Normal file
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* PROJECT: ReactOS system libraries
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: dll\win32\batt\batt.c
|
||||
* PURPOSE: Battery Class installers
|
||||
* PROGRAMMERS: Copyright 2010 Eric Kohl
|
||||
*/
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
#include <setupapi.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
DllMain(HINSTANCE hinstDll,
|
||||
DWORD dwReason,
|
||||
LPVOID reserved)
|
||||
{
|
||||
switch (dwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
DisableThreadLibraryCalls(hinstDll);
|
||||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
DWORD
|
||||
WINAPI
|
||||
BatteryClassCoInstaller(IN DI_FUNCTION InstallFunction,
|
||||
IN HDEVINFO DeviceInfoSet,
|
||||
IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL)
|
||||
{
|
||||
switch (InstallFunction)
|
||||
{
|
||||
default:
|
||||
DPRINT("Install function %u ignored\n", InstallFunction);
|
||||
return ERROR_DI_DO_DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DWORD
|
||||
WINAPI
|
||||
BatteryClassInstall(IN DI_FUNCTION InstallFunction,
|
||||
IN HDEVINFO DeviceInfoSet,
|
||||
IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL)
|
||||
{
|
||||
switch (InstallFunction)
|
||||
{
|
||||
default:
|
||||
DPRINT("Install function %u ignored\n", InstallFunction);
|
||||
return ERROR_DI_DO_DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
/* EOF */
|
9
dll/win32/batt/batt.rbuild
Normal file
9
dll/win32/batt/batt.rbuild
Normal file
|
@ -0,0 +1,9 @@
|
|||
<module name="batt" type="win32dll" baseaddress="${BASEADDRESS_BATT}" installbase="system32" installname="batt.dll" unicode="yes">
|
||||
<importlibrary definition="batt.spec" />
|
||||
<include base="batt">.</include>
|
||||
<library>setupapi</library>
|
||||
<library>kernel32</library>
|
||||
<library>ntdll</library>
|
||||
<file>batt.c</file>
|
||||
<file>batt.rc</file>
|
||||
</module>
|
13
dll/win32/batt/batt.rc
Normal file
13
dll/win32/batt/batt.rc
Normal file
|
@ -0,0 +1,13 @@
|
|||
#include <windows.h>
|
||||
#include "resource.h"
|
||||
|
||||
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||
|
||||
#define REACTOS_VERSION_DLL
|
||||
#define REACTOS_STR_FILE_DESCRIPTION "Battery Class Installer\0"
|
||||
#define REACTOS_STR_INTERNAL_NAME "batt\0"
|
||||
#define REACTOS_STR_ORIGINAL_FILENAME "batt.dll\0"
|
||||
#include <reactos/version.rc>
|
||||
|
||||
|
||||
IDI_BATTERY ICON "resources/battery.ico"
|
3
dll/win32/batt/batt.spec
Normal file
3
dll/win32/batt/batt.spec
Normal file
|
@ -0,0 +1,3 @@
|
|||
@ stdcall BatteryClassCoInstaller(long ptr ptr)
|
||||
@ stdcall BatteryClassInstall(long ptr ptr)
|
||||
|
1
dll/win32/batt/resource.h
Normal file
1
dll/win32/batt/resource.h
Normal file
|
@ -0,0 +1 @@
|
|||
#define IDI_BATTERY 2
|
BIN
dll/win32/batt/resources/battery.ico
Normal file
BIN
dll/win32/batt/resources/battery.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 39 KiB |
|
@ -244,7 +244,7 @@ CallClient(
|
|||
DWORD_PTR parameter1,
|
||||
DWORD_PTR parameter2)
|
||||
{
|
||||
DPRINT("Calling client - callback 0x%x mmhandle 0x%x\n", (int) device_info->callback, device_info->mme_handle);
|
||||
DPRINT("Calling client - callback 0x%x mmhandle 0x%x\n", device_info->callback, device_info->mme_handle);
|
||||
return DriverCallback(device_info->callback,
|
||||
HIWORD(device_info->flags),
|
||||
device_info->mme_handle,
|
||||
|
|
|
@ -416,8 +416,8 @@ HRESULT STDMETHODCALLTYPE CMenuCallback::CallbackSM(LPSMDATA psmd, UINT uMsg, WP
|
|||
if ((infoPtr->dwMask & SMIM_FLAGS) != 0)
|
||||
if (psmd->uId == FCIDM_MENU_FAVORITES)
|
||||
infoPtr->dwFlags |= SMIF_DROPCASCADE;
|
||||
else
|
||||
infoPtr->dwFlags |= SMIF_TRACKPOPUP;
|
||||
else{
|
||||
infoPtr->dwFlags |= SMIF_TRACKPOPUP;}
|
||||
if ((infoPtr->dwMask & SMIM_ICON) != 0)
|
||||
infoPtr->iIcon = -1;
|
||||
}
|
||||
|
|
|
@ -1306,6 +1306,78 @@ static void CRYPT_CheckChainNameConstraints(PCERT_SIMPLE_CHAIN chain)
|
|||
}
|
||||
}
|
||||
|
||||
/* Gets cert's policies info, if any. Free with LocalFree. */
|
||||
static CERT_POLICIES_INFO *CRYPT_GetPolicies(PCCERT_CONTEXT cert)
|
||||
{
|
||||
PCERT_EXTENSION ext;
|
||||
CERT_POLICIES_INFO *policies = NULL;
|
||||
|
||||
ext = CertFindExtension(szOID_KEY_USAGE, cert->pCertInfo->cExtension,
|
||||
cert->pCertInfo->rgExtension);
|
||||
if (ext)
|
||||
{
|
||||
DWORD size;
|
||||
|
||||
CryptDecodeObjectEx(X509_ASN_ENCODING, X509_CERT_POLICIES,
|
||||
ext->Value.pbData, ext->Value.cbData, CRYPT_DECODE_ALLOC_FLAG, NULL,
|
||||
&policies, &size);
|
||||
}
|
||||
return policies;
|
||||
}
|
||||
|
||||
static void CRYPT_CheckPolicies(CERT_POLICIES_INFO *policies, CERT_INFO *cert,
|
||||
DWORD *errorStatus)
|
||||
{
|
||||
DWORD i;
|
||||
|
||||
for (i = 0; i < policies->cPolicyInfo; i++)
|
||||
{
|
||||
/* For now, the only accepted policy identifier is the anyPolicy
|
||||
* identifier.
|
||||
* FIXME: the policy identifiers should be compared against the
|
||||
* cert's certificate policies extension, subject to the policy
|
||||
* mappings extension, and the policy constraints extension.
|
||||
* See RFC 5280, sections 4.2.1.4, 4.2.1.5, and 4.2.1.11.
|
||||
*/
|
||||
if (strcmp(policies->rgPolicyInfo[i].pszPolicyIdentifier,
|
||||
szOID_ANY_CERT_POLICY))
|
||||
{
|
||||
FIXME("unsupported policy %s\n",
|
||||
policies->rgPolicyInfo[i].pszPolicyIdentifier);
|
||||
*errorStatus |= CERT_TRUST_INVALID_POLICY_CONSTRAINTS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void CRYPT_CheckChainPolicies(PCERT_SIMPLE_CHAIN chain)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
for (i = chain->cElement - 1; i > 0; i--)
|
||||
{
|
||||
CERT_POLICIES_INFO *policies;
|
||||
|
||||
if ((policies = CRYPT_GetPolicies(chain->rgpElement[i]->pCertContext)))
|
||||
{
|
||||
for (j = i - 1; j >= 0; j--)
|
||||
{
|
||||
DWORD errorStatus = 0;
|
||||
|
||||
CRYPT_CheckPolicies(policies,
|
||||
chain->rgpElement[j]->pCertContext->pCertInfo, &errorStatus);
|
||||
if (errorStatus)
|
||||
{
|
||||
chain->rgpElement[i]->TrustStatus.dwErrorStatus |=
|
||||
errorStatus;
|
||||
CRYPT_CombineTrustStatus(&chain->TrustStatus,
|
||||
&chain->rgpElement[i]->TrustStatus);
|
||||
}
|
||||
}
|
||||
LocalFree(policies);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static LPWSTR name_value_to_str(const CERT_NAME_BLOB *name)
|
||||
{
|
||||
DWORD len = cert_name_to_str_with_indent(X509_ASN_ENCODING, 0, name,
|
||||
|
@ -1739,6 +1811,8 @@ static BOOL CRYPT_CriticalExtensionsSupported(PCCERT_CONTEXT cert)
|
|||
ret = TRUE;
|
||||
else if (!strcmp(oid, szOID_SUBJECT_ALT_NAME2))
|
||||
ret = TRUE;
|
||||
else if (!strcmp(oid, szOID_CERT_POLICIES))
|
||||
ret = TRUE;
|
||||
else if (!strcmp(oid, szOID_ENHANCED_KEY_USAGE))
|
||||
ret = TRUE;
|
||||
else
|
||||
|
@ -1883,6 +1957,7 @@ static void CRYPT_CheckSimpleChain(PCertificateChainEngine engine,
|
|||
&chain->rgpElement[i]->TrustStatus);
|
||||
}
|
||||
CRYPT_CheckChainNameConstraints(chain);
|
||||
CRYPT_CheckChainPolicies(chain);
|
||||
if (CRYPT_IsCertificateSelfSigned(rootElement->pCertContext))
|
||||
{
|
||||
rootElement->TrustStatus.dwInfoStatus |=
|
||||
|
|
|
@ -64,8 +64,8 @@ HCRYPTPROV CRYPT_GetDefaultProvider(void)
|
|||
{
|
||||
HCRYPTPROV prov;
|
||||
|
||||
if (!CryptAcquireContextW(&prov, NULL, MS_ENHANCED_PROV_W, PROV_RSA_FULL,
|
||||
CRYPT_VERIFYCONTEXT))
|
||||
if (!CryptAcquireContextW(&prov, NULL, MS_ENH_RSA_AES_PROV_W,
|
||||
PROV_RSA_AES, CRYPT_VERIFYCONTEXT))
|
||||
return hDefProv;
|
||||
InterlockedCompareExchangePointer((PVOID *)&hDefProv, (PVOID)prov,
|
||||
NULL);
|
||||
|
|
|
@ -1067,6 +1067,9 @@ static const WCHAR rc2[] = { 'r','c','2',0 };
|
|||
static const WCHAR rc4[] = { 'r','c','4',0 };
|
||||
static const WCHAR sha[] = { 's','h','a',0 };
|
||||
static const WCHAR sha1[] = { 's','h','a','1',0 };
|
||||
static const WCHAR sha256[] = { 's','h','a','2','5','6',0 };
|
||||
static const WCHAR sha384[] = { 's','h','a','3','8','4',0 };
|
||||
static const WCHAR sha512[] = { 's','h','a','5','1','2',0 };
|
||||
static const WCHAR RSA[] = { 'R','S','A',0 };
|
||||
static const WCHAR RSA_KEYX[] = { 'R','S','A','_','K','E','Y','X',0 };
|
||||
static const WCHAR RSA_SIGN[] = { 'R','S','A','_','S','I','G','N',0 };
|
||||
|
@ -1086,6 +1089,9 @@ static const WCHAR shaDSA[] = { 's','h','a','D','S','A',0 };
|
|||
static const WCHAR sha1DSA[] = { 's','h','a','1','D','S','A',0 };
|
||||
static const WCHAR shaRSA[] = { 's','h','a','R','S','A',0 };
|
||||
static const WCHAR sha1RSA[] = { 's','h','a','1','R','S','A',0 };
|
||||
static const WCHAR sha256RSA[] = { 's','h','a','2','5','6','R','S','A',0 };
|
||||
static const WCHAR sha384RSA[] = { 's','h','a','3','8','4','R','S','A',0 };
|
||||
static const WCHAR sha512RSA[] = { 's','h','a','5','1','2','R','S','A',0 };
|
||||
static const WCHAR mosaicUpdatedSig[] =
|
||||
{ 'm','o','s','a','i','c','U','p','d','a','t','e','d','S','i','g',0 };
|
||||
static const WCHAR CN[] = { 'C','N',0 };
|
||||
|
@ -1189,6 +1195,9 @@ static const struct OIDInfoConstructor {
|
|||
{ 3, szOID_PKIX_NO_SIGNATURE, CALG_NO_SIGN, NO_SIGN, NULL },
|
||||
|
||||
{ 4, szOID_RSA_SHA1RSA, CALG_SHA1, sha1RSA, &rsaSignBlob },
|
||||
{ 4, szOID_RSA_SHA256RSA, CALG_SHA_256, sha256RSA, &rsaSignBlob },
|
||||
{ 4, szOID_RSA_SHA384RSA, CALG_SHA_384, sha384RSA, &rsaSignBlob },
|
||||
{ 4, szOID_RSA_SHA512RSA, CALG_SHA_512, sha512RSA, &rsaSignBlob },
|
||||
{ 4, szOID_RSA_MD5RSA, CALG_MD5, md5RSA, &rsaSignBlob },
|
||||
{ 4, szOID_X957_SHA1DSA, CALG_SHA1, sha1DSA, &dssSignBlob },
|
||||
{ 4, szOID_OIWSEC_sha1RSASign, CALG_SHA1, sha1RSA, &rsaSignBlob },
|
||||
|
|
|
@ -313,6 +313,36 @@ enum module_type
|
|||
};
|
||||
|
||||
struct process;
|
||||
struct module;
|
||||
|
||||
/* a module can be made of several debug information formats, so we have to
|
||||
* support them all
|
||||
*/
|
||||
enum format_info
|
||||
{
|
||||
DFI_ELF,
|
||||
DFI_PE,
|
||||
DFI_MACHO,
|
||||
DFI_DWARF,
|
||||
DFI_LAST
|
||||
};
|
||||
|
||||
struct module_format
|
||||
{
|
||||
struct module* module;
|
||||
void (*remove)(struct process* pcs, struct module_format* modfmt);
|
||||
void (*loc_compute)(struct process* pcs,
|
||||
const struct module_format* modfmt,
|
||||
const struct symt_function* func,
|
||||
struct location* loc);
|
||||
union
|
||||
{
|
||||
struct elf_module_info* elf_info;
|
||||
struct dwarf2_module_info_s* dwarf2_info;
|
||||
struct pe_module_info* pe_info;
|
||||
struct macho_module_info* macho_info;
|
||||
} u;
|
||||
};
|
||||
|
||||
struct module
|
||||
{
|
||||
|
@ -324,10 +354,7 @@ struct module
|
|||
unsigned short is_virtual : 1;
|
||||
|
||||
/* specific information for debug types */
|
||||
struct elf_module_info* elf_info;
|
||||
struct dwarf2_module_info_s*dwarf2_info;
|
||||
|
||||
struct macho_module_info* macho_info;
|
||||
struct module_format* format_info[DFI_LAST];
|
||||
|
||||
/* memory allocation pool */
|
||||
struct pool pool;
|
||||
|
@ -340,10 +367,6 @@ struct module
|
|||
unsigned sorttab_size;
|
||||
struct symt_ht** addr_sorttab;
|
||||
struct hash_table ht_symbols;
|
||||
void (*loc_compute)(struct process* pcs,
|
||||
const struct module* module,
|
||||
const struct symt_function* func,
|
||||
struct location* loc);
|
||||
|
||||
/* types */
|
||||
struct hash_table ht_types;
|
||||
|
@ -471,11 +494,10 @@ extern DWORD calc_crc32(int fd);
|
|||
typedef BOOL (*enum_modules_cb)(const WCHAR*, unsigned long addr, void* user);
|
||||
|
||||
/* elf_module.c */
|
||||
#define ELF_NO_MAP ((const void*)-1)
|
||||
extern BOOL elf_enum_modules(HANDLE hProc, enum_modules_cb, void*);
|
||||
extern BOOL elf_fetch_file_info(const WCHAR* name, DWORD* base, DWORD* size, DWORD* checksum);
|
||||
struct elf_file_map;
|
||||
extern BOOL elf_load_debug_info(struct module* module, struct elf_file_map* fmap);
|
||||
struct image_file_map;
|
||||
extern BOOL elf_load_debug_info(struct module* module, struct image_file_map* fmap);
|
||||
extern struct module*
|
||||
elf_load_module(struct process* pcs, const WCHAR* name, unsigned long);
|
||||
extern BOOL elf_read_wine_loader_dbg_info(struct process* pcs);
|
||||
|
@ -565,11 +587,7 @@ extern BOOL stabs_parse(struct module* module, unsigned long load_offset
|
|||
/* dwarf.c */
|
||||
extern BOOL dwarf2_parse(struct module* module, unsigned long load_offset,
|
||||
const struct elf_thunk_area* thunks,
|
||||
const unsigned char* debug, unsigned int debug_size,
|
||||
const unsigned char* abbrev, unsigned int abbrev_size,
|
||||
const unsigned char* str, unsigned int str_size,
|
||||
const unsigned char* line, unsigned int line_size,
|
||||
const unsigned char* loclist, unsigned int loclist_size);
|
||||
struct image_file_map* fmap);
|
||||
|
||||
/* stack.c */
|
||||
extern BOOL sw_read_mem(struct cpu_stack_walk* csw, DWORD64 addr, void* ptr, DWORD sz);
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "oleauto.h"
|
||||
|
||||
#include "dbghelp_private.h"
|
||||
#include "image_private.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
|
@ -139,6 +140,7 @@ struct attribute
|
|||
union
|
||||
{
|
||||
unsigned long uvalue;
|
||||
ULONGLONG lluvalue;
|
||||
long svalue;
|
||||
const char* string;
|
||||
struct dwarf2_block block;
|
||||
|
@ -157,6 +159,7 @@ typedef struct dwarf2_section_s
|
|||
{
|
||||
const unsigned char* address;
|
||||
unsigned size;
|
||||
DWORD_PTR rva;
|
||||
} dwarf2_section_t;
|
||||
|
||||
enum dwarf2_sections {section_debug, section_string, section_abbrev, section_line, section_max};
|
||||
|
@ -512,9 +515,8 @@ static void dwarf2_fill_attr(const dwarf2_parse_context_t* ctx,
|
|||
break;
|
||||
|
||||
case DW_FORM_data8:
|
||||
attr->u.block.size = 8;
|
||||
attr->u.block.ptr = data;
|
||||
data += 8;
|
||||
attr->u.lluvalue = dwarf2_get_u8(data);
|
||||
TRACE("data8<%s>\n", wine_dbgstr_longlong(attr->u.uvalue));
|
||||
break;
|
||||
|
||||
case DW_FORM_ref1:
|
||||
|
@ -1480,6 +1482,11 @@ static void dwarf2_parse_variable(dwarf2_subprogram_t* subpgm,
|
|||
v.n1.n2.n3.lVal = value.u.uvalue;
|
||||
break;
|
||||
|
||||
case DW_FORM_data8:
|
||||
v.n1.n2.vt = VT_UI8;
|
||||
v.n1.n2.n3.llVal = value.u.lluvalue;
|
||||
break;
|
||||
|
||||
case DW_FORM_sdata:
|
||||
v.n1.n2.vt = VT_I4;
|
||||
v.n1.n2.n3.lVal = value.u.svalue;
|
||||
|
@ -1511,12 +1518,6 @@ static void dwarf2_parse_variable(dwarf2_subprogram_t* subpgm,
|
|||
}
|
||||
break;
|
||||
|
||||
case DW_FORM_data8:
|
||||
v.n1.n2.vt = VT_I1 | VT_BYREF;
|
||||
v.n1.n2.n3.byref = pool_alloc(&subpgm->ctx->module->pool, value.u.block.size);
|
||||
memcpy(v.n1.n2.n3.byref, value.u.block.ptr, value.u.block.size);
|
||||
break;
|
||||
|
||||
default:
|
||||
FIXME("Unsupported form for const value %s (%lx)\n",
|
||||
name.u.string, value.form);
|
||||
|
@ -1952,7 +1953,7 @@ static BOOL dwarf2_parse_line_numbers(const dwarf2_section_t* sections,
|
|||
const char** p;
|
||||
|
||||
/* section with line numbers stripped */
|
||||
if (sections[section_line].address == ELF_NO_MAP)
|
||||
if (sections[section_line].address == IMAGE_NO_MAP)
|
||||
return FALSE;
|
||||
|
||||
traverse.data = sections[section_line].address + offset;
|
||||
|
@ -2211,7 +2212,7 @@ static BOOL dwarf2_parse_compilation_unit(const dwarf2_section_t* sections,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static BOOL dwarf2_lookup_loclist(const struct module* module, const BYTE* start,
|
||||
static BOOL dwarf2_lookup_loclist(const struct module_format* modfmt, const BYTE* start,
|
||||
unsigned long ip,
|
||||
dwarf2_traverse_context_t* lctx)
|
||||
{
|
||||
|
@ -2219,7 +2220,7 @@ static BOOL dwarf2_lookup_loclist(const struct module* module, const BYTE* start
|
|||
const BYTE* ptr = start;
|
||||
DWORD len;
|
||||
|
||||
while (ptr < module->dwarf2_info->debug_loc.address + module->dwarf2_info->debug_loc.size)
|
||||
while (ptr < modfmt->u.dwarf2_info->debug_loc.address + modfmt->u.dwarf2_info->debug_loc.size)
|
||||
{
|
||||
beg = dwarf2_get_u4(ptr); ptr += 4;
|
||||
end = dwarf2_get_u4(ptr); ptr += 4;
|
||||
|
@ -2240,7 +2241,7 @@ static BOOL dwarf2_lookup_loclist(const struct module* module, const BYTE* start
|
|||
}
|
||||
|
||||
static enum location_error loc_compute_frame(struct process* pcs,
|
||||
const struct module* module,
|
||||
const struct module_format* modfmt,
|
||||
const struct symt_function* func,
|
||||
DWORD ip, struct location* frame)
|
||||
{
|
||||
|
@ -2266,8 +2267,8 @@ static enum location_error loc_compute_frame(struct process* pcs,
|
|||
break;
|
||||
case loc_dwarf2_location_list:
|
||||
WARN("Searching loclist for %s\n", func->hash_elt.name);
|
||||
if (!dwarf2_lookup_loclist(module,
|
||||
module->dwarf2_info->debug_loc.address + pframe->offset,
|
||||
if (!dwarf2_lookup_loclist(modfmt,
|
||||
modfmt->u.dwarf2_info->debug_loc.address + pframe->offset,
|
||||
ip, &lctx))
|
||||
return loc_err_out_of_scope;
|
||||
if ((err = compute_location(&lctx, frame, pcs->handle, NULL)) < 0) return err;
|
||||
|
@ -2289,7 +2290,7 @@ static enum location_error loc_compute_frame(struct process* pcs,
|
|||
}
|
||||
|
||||
static void dwarf2_location_compute(struct process* pcs,
|
||||
const struct module* module,
|
||||
const struct module_format* modfmt,
|
||||
const struct symt_function* func,
|
||||
struct location* loc)
|
||||
{
|
||||
|
@ -2308,14 +2309,14 @@ static void dwarf2_location_compute(struct process* pcs,
|
|||
/* instruction pointer relative to compiland's start */
|
||||
ip = pcs->ctx_frame.InstructionOffset - ((struct symt_compiland*)func->container)->address;
|
||||
|
||||
if ((err = loc_compute_frame(pcs, module, func, ip, &frame)) == 0)
|
||||
if ((err = loc_compute_frame(pcs, modfmt, func, ip, &frame)) == 0)
|
||||
{
|
||||
switch (loc->kind)
|
||||
{
|
||||
case loc_dwarf2_location_list:
|
||||
/* Then, if the variable has a location list, find it !! */
|
||||
if (dwarf2_lookup_loclist(module,
|
||||
module->dwarf2_info->debug_loc.address + loc->offset,
|
||||
if (dwarf2_lookup_loclist(modfmt,
|
||||
modfmt->u.dwarf2_info->debug_loc.address + loc->offset,
|
||||
ip, &lctx))
|
||||
goto do_compute;
|
||||
err = loc_err_out_of_scope;
|
||||
|
@ -2350,56 +2351,115 @@ static void dwarf2_location_compute(struct process* pcs,
|
|||
}
|
||||
}
|
||||
|
||||
static void dwarf2_module_remove(struct process* pcs, struct module_format* modfmt)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, modfmt->u.dwarf2_info);
|
||||
HeapFree(GetProcessHeap(), 0, modfmt);
|
||||
}
|
||||
|
||||
static inline BOOL dwarf2_init_section(dwarf2_section_t* section, struct image_file_map* fmap,
|
||||
const char* sectname, struct image_section_map* ism)
|
||||
{
|
||||
struct image_section_map local_ism;
|
||||
|
||||
if (!ism) ism = &local_ism;
|
||||
if (!image_find_section(fmap, sectname, ism))
|
||||
{
|
||||
section->address = NULL;
|
||||
section->size = 0;
|
||||
section->rva = 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
section->address = (const BYTE*)image_map_section(ism);
|
||||
section->size = image_get_map_size(ism);
|
||||
section->rva = image_get_map_rva(ism);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL dwarf2_parse(struct module* module, unsigned long load_offset,
|
||||
const struct elf_thunk_area* thunks,
|
||||
const unsigned char* debug, unsigned int debug_size,
|
||||
const unsigned char* abbrev, unsigned int abbrev_size,
|
||||
const unsigned char* str, unsigned int str_size,
|
||||
const unsigned char* line, unsigned int line_size,
|
||||
const unsigned char* loclist, unsigned int loclist_size)
|
||||
struct image_file_map* fmap)
|
||||
{
|
||||
dwarf2_section_t section[section_max];
|
||||
unsigned char* ptr;
|
||||
dwarf2_traverse_context_t mod_ctx;
|
||||
struct image_section_map debug_sect, debug_str_sect, debug_abbrev_sect,
|
||||
debug_line_sect, debug_loclist_sect;
|
||||
BOOL ret = TRUE;
|
||||
struct module_format* dwarf2_modfmt;
|
||||
|
||||
mod_ctx.start_data = mod_ctx.data = debug;
|
||||
mod_ctx.end_data = debug + debug_size;
|
||||
if (!dwarf2_init_section(§ion[section_debug], fmap, ".debug_info", &debug_sect))
|
||||
{
|
||||
/* no Dwarf debug info here, so there's no error */
|
||||
return TRUE;
|
||||
}
|
||||
dwarf2_init_section(§ion[section_abbrev], fmap, ".debug_abbrev", &debug_abbrev_sect);
|
||||
dwarf2_init_section(§ion[section_string], fmap, ".debug_str", &debug_str_sect);
|
||||
dwarf2_init_section(§ion[section_line], fmap, ".debug_line", &debug_line_sect);
|
||||
|
||||
module->loc_compute = dwarf2_location_compute;
|
||||
if (section[section_debug].address == IMAGE_NO_MAP ||
|
||||
section[section_abbrev].address == IMAGE_NO_MAP ||
|
||||
section[section_string].address == IMAGE_NO_MAP)
|
||||
{
|
||||
ret = FALSE;
|
||||
goto leave;
|
||||
}
|
||||
|
||||
section[section_debug].address = debug;
|
||||
section[section_debug].size = debug_size;
|
||||
section[section_abbrev].address = abbrev;
|
||||
section[section_abbrev].size = abbrev_size;
|
||||
section[section_string].address = str;
|
||||
section[section_string].size = str_size;
|
||||
section[section_line].address = line;
|
||||
section[section_line].size = line_size;
|
||||
if (fmap->modtype == DMT_ELF)
|
||||
{
|
||||
/* debug info might have a different base address than .so file
|
||||
* when elf file is prelinked after splitting off debug info
|
||||
* adjust symbol base addresses accordingly
|
||||
*/
|
||||
load_offset += fmap->u.elf.elf_start - debug_sect.fmap->u.elf.elf_start;
|
||||
}
|
||||
|
||||
if (loclist_size)
|
||||
TRACE("Loading Dwarf2 information for %s\n", debugstr_w(module->module.ModuleName));
|
||||
|
||||
mod_ctx.start_data = mod_ctx.data = section[section_debug].address;
|
||||
mod_ctx.end_data = mod_ctx.data + section[section_debug].size;
|
||||
|
||||
|
||||
dwarf2_modfmt = HeapAlloc(GetProcessHeap(), 0, sizeof(*dwarf2_modfmt));
|
||||
if (!dwarf2_modfmt) return FALSE;
|
||||
dwarf2_modfmt->module = module;
|
||||
dwarf2_modfmt->remove = dwarf2_module_remove;
|
||||
dwarf2_modfmt->loc_compute = dwarf2_location_compute;
|
||||
dwarf2_modfmt->u.dwarf2_info = NULL;
|
||||
dwarf2_modfmt->module->format_info[DFI_DWARF] = dwarf2_modfmt;
|
||||
|
||||
image_find_section(fmap, ".debug_loc", &debug_loclist_sect);
|
||||
if (image_get_map_size(&debug_loclist_sect))
|
||||
{
|
||||
/* initialize the dwarf2 specific info block for this module.
|
||||
* As we'll need later on the .debug_loc section content, we copy it in
|
||||
* the module structure for later reuse
|
||||
* As we'll need later the .debug_loc section content, we won't unmap this
|
||||
* section upon existing this function
|
||||
*/
|
||||
module->dwarf2_info = HeapAlloc(GetProcessHeap(), 0, sizeof(*module->dwarf2_info) + loclist_size);
|
||||
if (!module->dwarf2_info) return FALSE;
|
||||
ptr = (unsigned char*)(module->dwarf2_info + 1);
|
||||
memcpy(ptr, loclist, loclist_size);
|
||||
module->dwarf2_info->debug_loc.address = ptr;
|
||||
module->dwarf2_info->debug_loc.size = loclist_size;
|
||||
dwarf2_modfmt->u.dwarf2_info = HeapAlloc(GetProcessHeap(), 0,
|
||||
sizeof(*dwarf2_modfmt->u.dwarf2_info));
|
||||
if (!dwarf2_modfmt->u.dwarf2_info) goto leave;
|
||||
dwarf2_modfmt->u.dwarf2_info->debug_loc.address = (const BYTE*)image_map_section(&debug_loclist_sect);
|
||||
dwarf2_modfmt->u.dwarf2_info->debug_loc.size = image_get_map_size(&debug_loclist_sect);
|
||||
}
|
||||
else image_unmap_section(&debug_loclist_sect);
|
||||
|
||||
while (mod_ctx.data < mod_ctx.end_data)
|
||||
{
|
||||
dwarf2_parse_compilation_unit(section, module, thunks, &mod_ctx, load_offset);
|
||||
dwarf2_parse_compilation_unit(section, dwarf2_modfmt->module, thunks, &mod_ctx, load_offset);
|
||||
}
|
||||
module->module.SymType = SymDia;
|
||||
module->module.CVSig = 'D' | ('W' << 8) | ('A' << 16) | ('R' << 24);
|
||||
dwarf2_modfmt->module->module.SymType = SymDia;
|
||||
dwarf2_modfmt->module->module.CVSig = 'D' | ('W' << 8) | ('A' << 16) | ('R' << 24);
|
||||
/* FIXME: we could have a finer grain here */
|
||||
module->module.GlobalSymbols = TRUE;
|
||||
module->module.TypeInfo = TRUE;
|
||||
module->module.SourceIndexed = TRUE;
|
||||
module->module.Publics = TRUE;
|
||||
return TRUE;
|
||||
dwarf2_modfmt->module->module.GlobalSymbols = TRUE;
|
||||
dwarf2_modfmt->module->module.TypeInfo = TRUE;
|
||||
dwarf2_modfmt->module->module.SourceIndexed = TRUE;
|
||||
dwarf2_modfmt->module->module.Publics = TRUE;
|
||||
|
||||
leave:
|
||||
image_unmap_section(&debug_sect);
|
||||
image_unmap_section(&debug_abbrev_sect);
|
||||
image_unmap_section(&debug_str_sect);
|
||||
image_unmap_section(&debug_line_sect);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -48,40 +48,11 @@
|
|||
|
||||
#include "dbghelp_private.h"
|
||||
|
||||
#ifdef HAVE_ELF_H
|
||||
# include <elf.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_ELF32_H
|
||||
# include <sys/elf32.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_EXEC_ELF_H
|
||||
# include <sys/exec_elf.h>
|
||||
#endif
|
||||
#if !defined(DT_NUM)
|
||||
# if defined(DT_COUNT)
|
||||
# define DT_NUM DT_COUNT
|
||||
# else
|
||||
/* this seems to be a satisfactory value on Solaris, which doesn't support this AFAICT */
|
||||
# define DT_NUM 24
|
||||
# endif
|
||||
#endif
|
||||
#ifdef HAVE_LINK_H
|
||||
# include <link.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_LINK_H
|
||||
# include <sys/link.h>
|
||||
#endif
|
||||
#include "image_private.h"
|
||||
|
||||
#include "wine/library.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
struct elf_module_info
|
||||
{
|
||||
DWORD_PTR elf_addr;
|
||||
unsigned short elf_mark : 1,
|
||||
elf_loader : 1;
|
||||
};
|
||||
|
||||
#ifdef __ELF__
|
||||
|
||||
#define ELF_INFO_DEBUG_HEADER 0x0001
|
||||
|
@ -98,44 +69,6 @@ struct elf_info
|
|||
const WCHAR* module_name; /* OUT found module name (if ELF_INFO_NAME is set) */
|
||||
};
|
||||
|
||||
#ifdef _WIN64
|
||||
#define Elf_Ehdr Elf64_Ehdr
|
||||
#define Elf_Shdr Elf64_Shdr
|
||||
#define Elf_Phdr Elf64_Phdr
|
||||
#define Elf_Dyn Elf64_Dyn
|
||||
#define Elf_Sym Elf64_Sym
|
||||
#else
|
||||
#define Elf_Ehdr Elf32_Ehdr
|
||||
#define Elf_Shdr Elf32_Shdr
|
||||
#define Elf_Phdr Elf32_Phdr
|
||||
#define Elf_Dyn Elf32_Dyn
|
||||
#define Elf_Sym Elf32_Sym
|
||||
#endif
|
||||
|
||||
/* structure holding information while handling an ELF image
|
||||
* allows one by one section mapping for memory savings
|
||||
*/
|
||||
struct elf_file_map
|
||||
{
|
||||
Elf_Ehdr elfhdr;
|
||||
size_t elf_size;
|
||||
size_t elf_start;
|
||||
struct
|
||||
{
|
||||
Elf_Shdr shdr;
|
||||
const char* mapped;
|
||||
}* sect;
|
||||
int fd;
|
||||
const char* shstrtab;
|
||||
struct elf_file_map* alternate; /* another ELF file (linked to this one) */
|
||||
};
|
||||
|
||||
struct elf_section_map
|
||||
{
|
||||
struct elf_file_map* fmap;
|
||||
long sidx;
|
||||
};
|
||||
|
||||
struct symtab_elt
|
||||
{
|
||||
struct hash_table_elt ht_elt;
|
||||
|
@ -152,28 +85,39 @@ struct elf_thunk_area
|
|||
unsigned long rva_end;
|
||||
};
|
||||
|
||||
struct elf_module_info
|
||||
{
|
||||
unsigned long elf_addr;
|
||||
unsigned short elf_mark : 1,
|
||||
elf_loader : 1;
|
||||
struct image_file_map file_map;
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* elf_map_section
|
||||
*
|
||||
* Maps a single section into memory from an ELF file
|
||||
*/
|
||||
static const char* elf_map_section(struct elf_section_map* esm)
|
||||
const char* elf_map_section(struct image_section_map* ism)
|
||||
{
|
||||
struct elf_file_map* fmap = &ism->fmap->u.elf;
|
||||
|
||||
unsigned pgsz = getpagesize();
|
||||
unsigned ofst, size;
|
||||
|
||||
if (esm->sidx < 0 || esm->sidx >= esm->fmap->elfhdr.e_shnum ||
|
||||
esm->fmap->sect[esm->sidx].shdr.sh_type == SHT_NOBITS)
|
||||
return ELF_NO_MAP;
|
||||
assert(ism->fmap->modtype == DMT_ELF);
|
||||
if (ism->sidx < 0 || ism->sidx >= ism->fmap->u.elf.elfhdr.e_shnum ||
|
||||
fmap->sect[ism->sidx].shdr.sh_type == SHT_NOBITS)
|
||||
return IMAGE_NO_MAP;
|
||||
|
||||
/* align required information on page size (we assume pagesize is a power of 2) */
|
||||
ofst = esm->fmap->sect[esm->sidx].shdr.sh_offset & ~(pgsz - 1);
|
||||
size = ((esm->fmap->sect[esm->sidx].shdr.sh_offset +
|
||||
esm->fmap->sect[esm->sidx].shdr.sh_size + pgsz - 1) & ~(pgsz - 1)) - ofst;
|
||||
esm->fmap->sect[esm->sidx].mapped = mmap(NULL, size, PROT_READ, MAP_PRIVATE,
|
||||
esm->fmap->fd, ofst);
|
||||
if (esm->fmap->sect[esm->sidx].mapped == ELF_NO_MAP) return ELF_NO_MAP;
|
||||
return esm->fmap->sect[esm->sidx].mapped + (esm->fmap->sect[esm->sidx].shdr.sh_offset & (pgsz - 1));
|
||||
ofst = fmap->sect[ism->sidx].shdr.sh_offset & ~(pgsz - 1);
|
||||
size = ((fmap->sect[ism->sidx].shdr.sh_offset +
|
||||
fmap->sect[ism->sidx].shdr.sh_size + pgsz - 1) & ~(pgsz - 1)) - ofst;
|
||||
fmap->sect[ism->sidx].mapped = mmap(NULL, size, PROT_READ, MAP_PRIVATE,
|
||||
fmap->fd, ofst);
|
||||
if (fmap->sect[ism->sidx].mapped == IMAGE_NO_MAP) return IMAGE_NO_MAP;
|
||||
return fmap->sect[ism->sidx].mapped + (fmap->sect[ism->sidx].shdr.sh_offset & (pgsz - 1));
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
|
@ -182,32 +126,34 @@ static const char* elf_map_section(struct elf_section_map* esm)
|
|||
* Finds a section by name (and type) into memory from an ELF file
|
||||
* or its alternate if any
|
||||
*/
|
||||
static BOOL elf_find_section(struct elf_file_map* fmap, const char* name,
|
||||
unsigned sht, struct elf_section_map* esm)
|
||||
BOOL elf_find_section(struct image_file_map* _fmap, const char* name,
|
||||
unsigned sht, struct image_section_map* ism)
|
||||
{
|
||||
struct elf_file_map* fmap;
|
||||
unsigned i;
|
||||
|
||||
while (fmap)
|
||||
while (_fmap)
|
||||
{
|
||||
if (fmap->shstrtab == ELF_NO_MAP)
|
||||
fmap = &_fmap->u.elf;
|
||||
if (fmap->shstrtab == IMAGE_NO_MAP)
|
||||
{
|
||||
struct elf_section_map hdr_esm = {fmap, fmap->elfhdr.e_shstrndx};
|
||||
if ((fmap->shstrtab = elf_map_section(&hdr_esm)) == ELF_NO_MAP) break;
|
||||
struct image_section_map hdr_ism = {_fmap, fmap->elfhdr.e_shstrndx};
|
||||
if ((fmap->shstrtab = elf_map_section(&hdr_ism)) == IMAGE_NO_MAP) break;
|
||||
}
|
||||
for (i = 0; i < fmap->elfhdr.e_shnum; i++)
|
||||
{
|
||||
if (strcmp(fmap->shstrtab + fmap->sect[i].shdr.sh_name, name) == 0 &&
|
||||
(sht == SHT_NULL || sht == fmap->sect[i].shdr.sh_type))
|
||||
{
|
||||
esm->fmap = fmap;
|
||||
esm->sidx = i;
|
||||
ism->fmap = _fmap;
|
||||
ism->sidx = i;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
fmap = fmap->alternate;
|
||||
_fmap = fmap->alternate;
|
||||
}
|
||||
esm->fmap = NULL;
|
||||
esm->sidx = -1;
|
||||
ism->fmap = NULL;
|
||||
ism->sidx = -1;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -216,46 +162,67 @@ static BOOL elf_find_section(struct elf_file_map* fmap, const char* name,
|
|||
*
|
||||
* Unmaps a single section from memory
|
||||
*/
|
||||
static void elf_unmap_section(struct elf_section_map* esm)
|
||||
void elf_unmap_section(struct image_section_map* ism)
|
||||
{
|
||||
if (esm->sidx >= 0 && esm->sidx < esm->fmap->elfhdr.e_shnum && esm->fmap->sect[esm->sidx].mapped != ELF_NO_MAP)
|
||||
struct elf_file_map* fmap = &ism->fmap->u.elf;
|
||||
|
||||
if (ism->sidx >= 0 && ism->sidx < fmap->elfhdr.e_shnum && fmap->sect[ism->sidx].mapped != IMAGE_NO_MAP)
|
||||
{
|
||||
unsigned pgsz = getpagesize();
|
||||
unsigned ofst, size;
|
||||
|
||||
ofst = esm->fmap->sect[esm->sidx].shdr.sh_offset & ~(pgsz - 1);
|
||||
size = ((esm->fmap->sect[esm->sidx].shdr.sh_offset +
|
||||
esm->fmap->sect[esm->sidx].shdr.sh_size + pgsz - 1) & ~(pgsz - 1)) - ofst;
|
||||
if (munmap((char*)esm->fmap->sect[esm->sidx].mapped, size) < 0)
|
||||
ofst = fmap->sect[ism->sidx].shdr.sh_offset & ~(pgsz - 1);
|
||||
size = ((fmap->sect[ism->sidx].shdr.sh_offset +
|
||||
fmap->sect[ism->sidx].shdr.sh_size + pgsz - 1) & ~(pgsz - 1)) - ofst;
|
||||
if (munmap((char*)fmap->sect[ism->sidx].mapped, size) < 0)
|
||||
WARN("Couldn't unmap the section\n");
|
||||
esm->fmap->sect[esm->sidx].mapped = ELF_NO_MAP;
|
||||
fmap->sect[ism->sidx].mapped = IMAGE_NO_MAP;
|
||||
}
|
||||
}
|
||||
|
||||
static void elf_end_find(struct elf_file_map* fmap)
|
||||
static void elf_end_find(struct image_file_map* fmap)
|
||||
{
|
||||
struct elf_section_map esm;
|
||||
struct image_section_map ism;
|
||||
|
||||
while (fmap)
|
||||
{
|
||||
esm.fmap = fmap;
|
||||
esm.sidx = fmap->elfhdr.e_shstrndx;
|
||||
elf_unmap_section(&esm);
|
||||
fmap->shstrtab = ELF_NO_MAP;
|
||||
fmap = fmap->alternate;
|
||||
ism.fmap = fmap;
|
||||
ism.sidx = fmap->u.elf.elfhdr.e_shstrndx;
|
||||
elf_unmap_section(&ism);
|
||||
fmap->u.elf.shstrtab = IMAGE_NO_MAP;
|
||||
fmap = fmap->u.elf.alternate;
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* elf_get_map_rva
|
||||
*
|
||||
* Get the RVA of an ELF section
|
||||
*/
|
||||
DWORD_PTR elf_get_map_rva(const struct image_section_map* ism)
|
||||
{
|
||||
if (ism->sidx < 0 || ism->sidx >= ism->fmap->u.elf.elfhdr.e_shnum)
|
||||
return 0;
|
||||
return ism->fmap->u.elf.sect[ism->sidx].shdr.sh_addr - ism->fmap->u.elf.elf_start;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* elf_get_map_size
|
||||
*
|
||||
* Get the size of an ELF section
|
||||
*/
|
||||
static inline unsigned elf_get_map_size(const struct elf_section_map* esm)
|
||||
unsigned elf_get_map_size(const struct image_section_map* ism)
|
||||
{
|
||||
if (esm->sidx < 0 || esm->sidx >= esm->fmap->elfhdr.e_shnum)
|
||||
if (ism->sidx < 0 || ism->sidx >= ism->fmap->u.elf.elfhdr.e_shnum)
|
||||
return 0;
|
||||
return esm->fmap->sect[esm->sidx].shdr.sh_size;
|
||||
return ism->fmap->u.elf.sect[ism->sidx].shdr.sh_size;
|
||||
}
|
||||
|
||||
static inline void elf_reset_file_map(struct image_file_map* fmap)
|
||||
{
|
||||
fmap->u.elf.fd = -1;
|
||||
fmap->u.elf.shstrtab = IMAGE_NO_MAP;
|
||||
fmap->u.elf.alternate = NULL;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
|
@ -263,7 +230,7 @@ static inline unsigned elf_get_map_size(const struct elf_section_map* esm)
|
|||
*
|
||||
* Maps an ELF file into memory (and checks it's a real ELF file)
|
||||
*/
|
||||
static BOOL elf_map_file(const WCHAR* filenameW, struct elf_file_map* fmap)
|
||||
static BOOL elf_map_file(const WCHAR* filenameW, struct image_file_map* fmap)
|
||||
{
|
||||
static const BYTE elf_signature[4] = { ELFMAG0, ELFMAG1, ELFMAG2, ELFMAG3 };
|
||||
struct stat statbuf;
|
||||
|
@ -278,56 +245,55 @@ static BOOL elf_map_file(const WCHAR* filenameW, struct elf_file_map* fmap)
|
|||
if (!(filename = HeapAlloc(GetProcessHeap(), 0, len))) return FALSE;
|
||||
WideCharToMultiByte(CP_UNIXCP, 0, filenameW, -1, filename, len, NULL, NULL);
|
||||
|
||||
fmap->fd = -1;
|
||||
fmap->shstrtab = ELF_NO_MAP;
|
||||
fmap->alternate = NULL;
|
||||
elf_reset_file_map(fmap);
|
||||
|
||||
fmap->modtype = DMT_ELF;
|
||||
/* check that the file exists, and that the module hasn't been loaded yet */
|
||||
if (stat(filename, &statbuf) == -1 || S_ISDIR(statbuf.st_mode)) goto done;
|
||||
|
||||
/* Now open the file, so that we can mmap() it. */
|
||||
if ((fmap->fd = open(filename, O_RDONLY)) == -1) goto done;
|
||||
if ((fmap->u.elf.fd = open(filename, O_RDONLY)) == -1) goto done;
|
||||
|
||||
if (read(fmap->fd, &fmap->elfhdr, sizeof(fmap->elfhdr)) != sizeof(fmap->elfhdr))
|
||||
if (read(fmap->u.elf.fd, &fmap->u.elf.elfhdr, sizeof(fmap->u.elf.elfhdr)) != sizeof(fmap->u.elf.elfhdr))
|
||||
goto done;
|
||||
/* and check for an ELF header */
|
||||
if (memcmp(fmap->elfhdr.e_ident,
|
||||
if (memcmp(fmap->u.elf.elfhdr.e_ident,
|
||||
elf_signature, sizeof(elf_signature))) goto done;
|
||||
/* and check 32 vs 64 size according to current machine */
|
||||
#ifdef _WIN64
|
||||
if (fmap->elfhdr.e_ident[EI_CLASS] != ELFCLASS64) goto done;
|
||||
if (fmap->u.elf.elfhdr.e_ident[EI_CLASS] != ELFCLASS64) goto done;
|
||||
#else
|
||||
if (fmap->elfhdr.e_ident[EI_CLASS] != ELFCLASS32) goto done;
|
||||
if (fmap->u.elf.elfhdr.e_ident[EI_CLASS] != ELFCLASS32) goto done;
|
||||
#endif
|
||||
fmap->sect = HeapAlloc(GetProcessHeap(), 0,
|
||||
fmap->elfhdr.e_shnum * sizeof(fmap->sect[0]));
|
||||
if (!fmap->sect) goto done;
|
||||
fmap->u.elf.sect = HeapAlloc(GetProcessHeap(), 0,
|
||||
fmap->u.elf.elfhdr.e_shnum * sizeof(fmap->u.elf.sect[0]));
|
||||
if (!fmap->u.elf.sect) goto done;
|
||||
|
||||
lseek(fmap->fd, fmap->elfhdr.e_shoff, SEEK_SET);
|
||||
for (i = 0; i < fmap->elfhdr.e_shnum; i++)
|
||||
lseek(fmap->u.elf.fd, fmap->u.elf.elfhdr.e_shoff, SEEK_SET);
|
||||
for (i = 0; i < fmap->u.elf.elfhdr.e_shnum; i++)
|
||||
{
|
||||
read(fmap->fd, &fmap->sect[i].shdr, sizeof(fmap->sect[i].shdr));
|
||||
fmap->sect[i].mapped = ELF_NO_MAP;
|
||||
read(fmap->u.elf.fd, &fmap->u.elf.sect[i].shdr, sizeof(fmap->u.elf.sect[i].shdr));
|
||||
fmap->u.elf.sect[i].mapped = IMAGE_NO_MAP;
|
||||
}
|
||||
|
||||
/* grab size of module once loaded in memory */
|
||||
lseek(fmap->fd, fmap->elfhdr.e_phoff, SEEK_SET);
|
||||
fmap->elf_size = 0;
|
||||
fmap->elf_start = ~0L;
|
||||
for (i = 0; i < fmap->elfhdr.e_phnum; i++)
|
||||
lseek(fmap->u.elf.fd, fmap->u.elf.elfhdr.e_phoff, SEEK_SET);
|
||||
fmap->u.elf.elf_size = 0;
|
||||
fmap->u.elf.elf_start = ~0L;
|
||||
for (i = 0; i < fmap->u.elf.elfhdr.e_phnum; i++)
|
||||
{
|
||||
if (read(fmap->fd, &phdr, sizeof(phdr)) == sizeof(phdr) &&
|
||||
if (read(fmap->u.elf.fd, &phdr, sizeof(phdr)) == sizeof(phdr) &&
|
||||
phdr.p_type == PT_LOAD)
|
||||
{
|
||||
tmp = (phdr.p_vaddr + phdr.p_memsz + page_mask) & ~page_mask;
|
||||
if (fmap->elf_size < tmp) fmap->elf_size = tmp;
|
||||
if (phdr.p_vaddr < fmap->elf_start) fmap->elf_start = phdr.p_vaddr;
|
||||
if (fmap->u.elf.elf_size < tmp) fmap->u.elf.elf_size = tmp;
|
||||
if (phdr.p_vaddr < fmap->u.elf.elf_start) fmap->u.elf.elf_start = phdr.p_vaddr;
|
||||
}
|
||||
}
|
||||
/* if non relocatable ELF, then remove fixed address from computation
|
||||
* otherwise, all addresses are zero based and start has no effect
|
||||
*/
|
||||
fmap->elf_size -= fmap->elf_start;
|
||||
fmap->u.elf.elf_size -= fmap->u.elf.elf_start;
|
||||
ret = TRUE;
|
||||
done:
|
||||
HeapFree(GetProcessHeap(), 0, filename);
|
||||
|
@ -339,25 +305,31 @@ done:
|
|||
*
|
||||
* Unmaps an ELF file from memory (previously mapped with elf_map_file)
|
||||
*/
|
||||
static void elf_unmap_file(struct elf_file_map* fmap)
|
||||
static void elf_unmap_file(struct image_file_map* fmap)
|
||||
{
|
||||
while (fmap)
|
||||
{
|
||||
if (fmap->fd != -1)
|
||||
if (fmap->u.elf.fd != -1)
|
||||
{
|
||||
struct elf_section_map esm;
|
||||
esm.fmap = fmap;
|
||||
for (esm.sidx = 0; esm.sidx < fmap->elfhdr.e_shnum; esm.sidx++)
|
||||
struct image_section_map ism;
|
||||
ism.fmap = fmap;
|
||||
for (ism.sidx = 0; ism.sidx < fmap->u.elf.elfhdr.e_shnum; ism.sidx++)
|
||||
{
|
||||
elf_unmap_section(&esm);
|
||||
elf_unmap_section(&ism);
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, fmap->sect);
|
||||
close(fmap->fd);
|
||||
HeapFree(GetProcessHeap(), 0, fmap->u.elf.sect);
|
||||
close(fmap->u.elf.fd);
|
||||
}
|
||||
fmap = fmap->alternate;
|
||||
fmap = fmap->u.elf.alternate;
|
||||
}
|
||||
}
|
||||
|
||||
static void elf_module_remove(struct process* pcs, struct module_format* modfmt)
|
||||
{
|
||||
elf_unmap_file(&modfmt->u.elf_info->file_map);
|
||||
HeapFree(GetProcessHeap(), 0, modfmt);
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* elf_is_in_thunk_area
|
||||
*
|
||||
|
@ -382,8 +354,8 @@ int elf_is_in_thunk_area(unsigned long addr,
|
|||
*
|
||||
* creating an internal hash table to ease use ELF symtab information lookup
|
||||
*/
|
||||
static void elf_hash_symtab(struct module* module, struct pool* pool,
|
||||
struct hash_table* ht_symtab, struct elf_file_map* fmap,
|
||||
static void elf_hash_symtab(struct module* module, struct pool* pool,
|
||||
struct hash_table* ht_symtab, struct image_file_map* fmap,
|
||||
struct elf_thunk_area* thunks)
|
||||
{
|
||||
int i, j, nsym;
|
||||
|
@ -393,16 +365,20 @@ static void elf_hash_symtab(struct module* module, struct pool* pool,
|
|||
const char* ptr;
|
||||
const Elf_Sym* symp;
|
||||
struct symtab_elt* ste;
|
||||
struct elf_section_map esm, esm_str;
|
||||
struct image_section_map ism, ism_str;
|
||||
|
||||
if (!elf_find_section(fmap, ".symtab", SHT_SYMTAB, &esm) &&
|
||||
!elf_find_section(fmap, ".dynsym", SHT_DYNSYM, &esm)) return;
|
||||
if ((symp = (const Elf_Sym*)elf_map_section(&esm)) == ELF_NO_MAP) return;
|
||||
esm_str.fmap = fmap;
|
||||
esm_str.sidx = fmap->sect[esm.sidx].shdr.sh_link;
|
||||
if ((strp = elf_map_section(&esm_str)) == ELF_NO_MAP) return;
|
||||
if (!elf_find_section(fmap, ".symtab", SHT_SYMTAB, &ism) &&
|
||||
!elf_find_section(fmap, ".dynsym", SHT_DYNSYM, &ism)) return;
|
||||
if ((symp = (const Elf_Sym*)image_map_section(&ism)) == IMAGE_NO_MAP) return;
|
||||
ism_str.fmap = ism.fmap;
|
||||
ism_str.sidx = fmap->u.elf.sect[ism.sidx].shdr.sh_link;
|
||||
if ((strp = image_map_section(&ism_str)) == IMAGE_NO_MAP)
|
||||
{
|
||||
image_unmap_section(&ism);
|
||||
return;
|
||||
}
|
||||
|
||||
nsym = elf_get_map_size(&esm) / sizeof(*symp);
|
||||
nsym = image_get_map_size(&ism) / sizeof(*symp);
|
||||
|
||||
for (j = 0; thunks[j].symname; j++)
|
||||
thunks[j].rva_start = thunks[j].rva_end = 0;
|
||||
|
@ -567,6 +543,7 @@ static void elf_finish_stabs_info(struct module* module, const struct hash_table
|
|||
void* ptr;
|
||||
struct symt_ht* sym;
|
||||
const Elf_Sym* symp;
|
||||
struct elf_module_info* elf_info = module->format_info[DFI_ELF]->u.elf_info;
|
||||
|
||||
hash_table_iter_init(&module->ht_symbols, &hti, NULL);
|
||||
while ((ptr = hash_table_iter_up(&hti)))
|
||||
|
@ -575,7 +552,7 @@ static void elf_finish_stabs_info(struct module* module, const struct hash_table
|
|||
switch (sym->symt.tag)
|
||||
{
|
||||
case SymTagFunction:
|
||||
if (((struct symt_function*)sym)->address != module->elf_info->elf_addr &&
|
||||
if (((struct symt_function*)sym)->address != elf_info->elf_addr &&
|
||||
((struct symt_function*)sym)->size)
|
||||
{
|
||||
break;
|
||||
|
@ -584,18 +561,17 @@ static void elf_finish_stabs_info(struct module* module, const struct hash_table
|
|||
((struct symt_function*)sym)->container);
|
||||
if (symp)
|
||||
{
|
||||
if (((struct symt_function*)sym)->address != module->elf_info->elf_addr &&
|
||||
((struct symt_function*)sym)->address != module->elf_info->elf_addr + symp->st_value)
|
||||
if (((struct symt_function*)sym)->address != elf_info->elf_addr &&
|
||||
((struct symt_function*)sym)->address != elf_info->elf_addr + symp->st_value)
|
||||
FIXME("Changing address for %p/%s!%s from %08lx to %08lx\n",
|
||||
sym, debugstr_w(module->module.ModuleName), sym->hash_elt.name,
|
||||
((struct symt_function*)sym)->address, module->elf_info->elf_addr + symp->st_value);
|
||||
((struct symt_function*)sym)->address, elf_info->elf_addr + symp->st_value);
|
||||
if (((struct symt_function*)sym)->size && ((struct symt_function*)sym)->size != symp->st_size)
|
||||
FIXME("Changing size for %p/%s!%s from %08lx to %08x\n",
|
||||
sym, debugstr_w(module->module.ModuleName), sym->hash_elt.name,
|
||||
((struct symt_function*)sym)->size, (unsigned int)symp->st_size);
|
||||
|
||||
((struct symt_function*)sym)->address = module->elf_info->elf_addr +
|
||||
symp->st_value;
|
||||
((struct symt_function*)sym)->address = elf_info->elf_addr + symp->st_value;
|
||||
((struct symt_function*)sym)->size = symp->st_size;
|
||||
} else
|
||||
FIXME("Couldn't find %s!%s\n",
|
||||
|
@ -606,19 +582,18 @@ static void elf_finish_stabs_info(struct module* module, const struct hash_table
|
|||
{
|
||||
case DataIsGlobal:
|
||||
case DataIsFileStatic:
|
||||
if (((struct symt_data*)sym)->u.var.offset != module->elf_info->elf_addr)
|
||||
if (((struct symt_data*)sym)->u.var.offset != elf_info->elf_addr)
|
||||
break;
|
||||
symp = elf_lookup_symtab(module, symtab, sym->hash_elt.name,
|
||||
((struct symt_data*)sym)->container);
|
||||
if (symp)
|
||||
{
|
||||
if (((struct symt_data*)sym)->u.var.offset != module->elf_info->elf_addr &&
|
||||
((struct symt_data*)sym)->u.var.offset != module->elf_info->elf_addr + symp->st_value)
|
||||
if (((struct symt_data*)sym)->u.var.offset != elf_info->elf_addr &&
|
||||
((struct symt_data*)sym)->u.var.offset != elf_info->elf_addr + symp->st_value)
|
||||
FIXME("Changing address for %p/%s!%s from %08lx to %08lx\n",
|
||||
sym, debugstr_w(module->module.ModuleName), sym->hash_elt.name,
|
||||
((struct symt_function*)sym)->address, module->elf_info->elf_addr + symp->st_value);
|
||||
((struct symt_data*)sym)->u.var.offset = module->elf_info->elf_addr +
|
||||
symp->st_value;
|
||||
((struct symt_function*)sym)->address, elf_info->elf_addr + symp->st_value);
|
||||
((struct symt_data*)sym)->u.var.offset = elf_info->elf_addr + symp->st_value;
|
||||
((struct symt_data*)sym)->kind = (ELF32_ST_BIND(symp->st_info) == STB_LOCAL) ?
|
||||
DataIsFileStatic : DataIsGlobal;
|
||||
} else
|
||||
|
@ -656,7 +631,7 @@ static int elf_new_wine_thunks(struct module* module, const struct hash_table* h
|
|||
{
|
||||
if (ste->used) continue;
|
||||
|
||||
addr = module->elf_info->elf_addr + ste->symp->st_value;
|
||||
addr = module->format_info[DFI_ELF]->u.elf_info->elf_addr + ste->symp->st_value;
|
||||
|
||||
j = elf_is_in_thunk_area(ste->symp->st_value, thunks);
|
||||
if (j >= 0) /* thunk found */
|
||||
|
@ -748,20 +723,20 @@ static int elf_new_public_symbols(struct module* module, const struct hash_table
|
|||
while ((ste = hash_table_iter_up(&hti)))
|
||||
{
|
||||
symt_new_public(module, ste->compiland, ste->ht_elt.name,
|
||||
module->elf_info->elf_addr + ste->symp->st_value,
|
||||
module->format_info[DFI_ELF]->u.elf_info->elf_addr + ste->symp->st_value,
|
||||
ste->symp->st_size);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL elf_check_debug_link(const WCHAR* file, struct elf_file_map* fmap, DWORD crc)
|
||||
static BOOL elf_check_debug_link(const WCHAR* file, struct image_file_map* fmap, DWORD crc)
|
||||
{
|
||||
BOOL ret;
|
||||
if (!elf_map_file(file, fmap)) return FALSE;
|
||||
if (!(ret = crc == calc_crc32(fmap->fd)))
|
||||
if (!(ret = crc == calc_crc32(fmap->u.elf.fd)))
|
||||
{
|
||||
WARN("Bad CRC for file %s (got %08x while expecting %08x)\n",
|
||||
debugstr_w(file), calc_crc32(fmap->fd), crc);
|
||||
debugstr_w(file), calc_crc32(fmap->u.elf.fd), crc);
|
||||
elf_unmap_file(fmap);
|
||||
}
|
||||
return ret;
|
||||
|
@ -786,7 +761,7 @@ static BOOL elf_check_debug_link(const WCHAR* file, struct elf_file_map* fmap, D
|
|||
* is the global debug file directory, and execdir has been turned
|
||||
* into a relative path)." (from GDB manual)
|
||||
*/
|
||||
static BOOL elf_locate_debug_link(struct elf_file_map* fmap, const char* filename,
|
||||
static BOOL elf_locate_debug_link(struct image_file_map* fmap, const char* filename,
|
||||
const WCHAR* loaded_file, DWORD crc)
|
||||
{
|
||||
static const WCHAR globalDebugDirW[] = {'/','u','s','r','/','l','i','b','/','d','e','b','u','g','/'};
|
||||
|
@ -795,7 +770,7 @@ static BOOL elf_locate_debug_link(struct elf_file_map* fmap, const char* filenam
|
|||
size_t filename_len;
|
||||
WCHAR* p = NULL;
|
||||
WCHAR* slash;
|
||||
struct elf_file_map* fmap_link = NULL;
|
||||
struct image_file_map* fmap_link = NULL;
|
||||
|
||||
fmap_link = HeapAlloc(GetProcessHeap(), 0, sizeof(*fmap_link));
|
||||
if (!fmap_link) return FALSE;
|
||||
|
@ -838,7 +813,7 @@ static BOOL elf_locate_debug_link(struct elf_file_map* fmap, const char* filenam
|
|||
found:
|
||||
TRACE("Located debug information file %s at %s\n", filename, debugstr_w(p));
|
||||
HeapFree(GetProcessHeap(), 0, p);
|
||||
fmap->alternate = fmap_link;
|
||||
fmap->u.elf.alternate = fmap_link;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -848,7 +823,7 @@ found:
|
|||
* Parses a .gnu_debuglink section and loads the debug info from
|
||||
* the external file specified there.
|
||||
*/
|
||||
static BOOL elf_debuglink_parse(struct elf_file_map* fmap, const struct module* module,
|
||||
static BOOL elf_debuglink_parse(struct image_file_map* fmap, const struct module* module,
|
||||
const BYTE* debuglink)
|
||||
{
|
||||
/* The content of a debug link section is:
|
||||
|
@ -877,8 +852,8 @@ static BOOL elf_debuglink_parse(struct elf_file_map* fmap, const struct module*
|
|||
* read or parsed)
|
||||
* 1 on success
|
||||
*/
|
||||
static BOOL elf_load_debug_info_from_map(struct module* module,
|
||||
struct elf_file_map* fmap,
|
||||
static BOOL elf_load_debug_info_from_map(struct module* module,
|
||||
struct image_file_map* fmap,
|
||||
struct pool* pool,
|
||||
struct hash_table* ht_symtab)
|
||||
{
|
||||
|
@ -901,18 +876,16 @@ static BOOL elf_load_debug_info_from_map(struct module* module,
|
|||
|
||||
if (!(dbghelp_options & SYMOPT_PUBLICS_ONLY))
|
||||
{
|
||||
struct elf_section_map stab_sect, stabstr_sect;
|
||||
struct elf_section_map debug_sect, debug_str_sect, debug_abbrev_sect,
|
||||
debug_line_sect, debug_loclist_sect;
|
||||
struct elf_section_map debuglink_sect;
|
||||
struct image_section_map stab_sect, stabstr_sect;
|
||||
struct image_section_map debuglink_sect;
|
||||
|
||||
/* if present, add the .gnu_debuglink file as an alternate to current one */
|
||||
if (elf_find_section(fmap, ".gnu_debuglink", SHT_NULL, &debuglink_sect))
|
||||
{
|
||||
const BYTE* dbg_link;
|
||||
|
||||
dbg_link = (const BYTE*)elf_map_section(&debuglink_sect);
|
||||
if (dbg_link != ELF_NO_MAP)
|
||||
dbg_link = (const BYTE*)image_map_section(&debuglink_sect);
|
||||
if (dbg_link != IMAGE_NO_MAP)
|
||||
{
|
||||
lret = elf_debuglink_parse(fmap, module, dbg_link);
|
||||
if (!lret)
|
||||
|
@ -920,7 +893,7 @@ static BOOL elf_load_debug_info_from_map(struct module* module,
|
|||
debugstr_w(module->module.ModuleName));
|
||||
ret = ret || lret;
|
||||
}
|
||||
elf_unmap_section(&debuglink_sect);
|
||||
image_unmap_section(&debuglink_sect);
|
||||
}
|
||||
if (elf_find_section(fmap, ".stab", SHT_NULL, &stab_sect) &&
|
||||
elf_find_section(fmap, ".stabstr", SHT_NULL, &stabstr_sect))
|
||||
|
@ -928,14 +901,14 @@ static BOOL elf_load_debug_info_from_map(struct module* module,
|
|||
const char* stab;
|
||||
const char* stabstr;
|
||||
|
||||
stab = elf_map_section(&stab_sect);
|
||||
stabstr = elf_map_section(&stabstr_sect);
|
||||
if (stab != ELF_NO_MAP && stabstr != ELF_NO_MAP)
|
||||
stab = image_map_section(&stab_sect);
|
||||
stabstr = image_map_section(&stabstr_sect);
|
||||
if (stab != IMAGE_NO_MAP && stabstr != IMAGE_NO_MAP)
|
||||
{
|
||||
/* OK, now just parse all of the stabs. */
|
||||
lret = stabs_parse(module, module->elf_info->elf_addr,
|
||||
stab, elf_get_map_size(&stab_sect),
|
||||
stabstr, elf_get_map_size(&stabstr_sect),
|
||||
lret = stabs_parse(module, module->format_info[DFI_ELF]->u.elf_info->elf_addr,
|
||||
stab, image_get_map_size(&stab_sect),
|
||||
stabstr, image_get_map_size(&stabstr_sect),
|
||||
NULL, NULL);
|
||||
if (lret)
|
||||
/* and fill in the missing information for stabs */
|
||||
|
@ -945,57 +918,12 @@ static BOOL elf_load_debug_info_from_map(struct module* module,
|
|||
ret = ret || lret;
|
||||
}
|
||||
else lret = FALSE;
|
||||
elf_unmap_section(&stab_sect);
|
||||
elf_unmap_section(&stabstr_sect);
|
||||
}
|
||||
if (elf_find_section(fmap, ".debug_info", SHT_NULL, &debug_sect))
|
||||
{
|
||||
/* Dwarf 2 debug information */
|
||||
const BYTE* dw2_debug;
|
||||
const BYTE* dw2_debug_abbrev;
|
||||
const BYTE* dw2_debug_str;
|
||||
const BYTE* dw2_debug_line;
|
||||
const BYTE* dw2_debug_loclist;
|
||||
|
||||
/* debug info might have a different base address than .so file
|
||||
* when elf file is prelinked after splitting off debug info
|
||||
* adjust symbol base addresses accordingly
|
||||
*/
|
||||
unsigned long load_offset = module->elf_info->elf_addr +
|
||||
fmap->elf_start - debug_sect.fmap->elf_start;
|
||||
|
||||
TRACE("Loading Dwarf2 information for %s\n", debugstr_w(module->module.ModuleName));
|
||||
|
||||
elf_find_section(fmap, ".debug_str", SHT_NULL, &debug_str_sect);
|
||||
elf_find_section(fmap, ".debug_abbrev", SHT_NULL, &debug_abbrev_sect);
|
||||
elf_find_section(fmap, ".debug_line", SHT_NULL, &debug_line_sect);
|
||||
elf_find_section(fmap, ".debug_loc", SHT_NULL, &debug_loclist_sect);
|
||||
|
||||
dw2_debug = (const BYTE*)elf_map_section(&debug_sect);
|
||||
dw2_debug_abbrev = (const BYTE*)elf_map_section(&debug_abbrev_sect);
|
||||
dw2_debug_str = (const BYTE*)elf_map_section(&debug_str_sect);
|
||||
dw2_debug_line = (const BYTE*)elf_map_section(&debug_line_sect);
|
||||
dw2_debug_loclist = (const BYTE*)elf_map_section(&debug_loclist_sect);
|
||||
if (dw2_debug != ELF_NO_MAP && dw2_debug_abbrev != ELF_NO_MAP && dw2_debug_str != ELF_NO_MAP)
|
||||
{
|
||||
/* OK, now just parse dwarf2 debug infos. */
|
||||
lret = dwarf2_parse(module, load_offset, thunks,
|
||||
dw2_debug, elf_get_map_size(&debug_sect),
|
||||
dw2_debug_abbrev, elf_get_map_size(&debug_abbrev_sect),
|
||||
dw2_debug_str, elf_get_map_size(&debug_str_sect),
|
||||
dw2_debug_line, elf_get_map_size(&debug_line_sect),
|
||||
dw2_debug_loclist, elf_get_map_size(&debug_loclist_sect));
|
||||
|
||||
if (!lret)
|
||||
WARN("Couldn't correctly read dwarf2\n");
|
||||
ret = ret || lret;
|
||||
}
|
||||
elf_unmap_section(&debug_sect);
|
||||
elf_unmap_section(&debug_abbrev_sect);
|
||||
elf_unmap_section(&debug_str_sect);
|
||||
elf_unmap_section(&debug_line_sect);
|
||||
elf_unmap_section(&debug_loclist_sect);
|
||||
image_unmap_section(&stab_sect);
|
||||
image_unmap_section(&stabstr_sect);
|
||||
}
|
||||
lret = dwarf2_parse(module, module->format_info[DFI_ELF]->u.elf_info->elf_addr,
|
||||
thunks, fmap);
|
||||
ret = ret || lret;
|
||||
}
|
||||
if (strstrW(module->module.ModuleName, S_ElfW) ||
|
||||
!strcmpW(module->module.ModuleName, S_WineLoaderW))
|
||||
|
@ -1015,14 +943,15 @@ static BOOL elf_load_debug_info_from_map(struct module* module,
|
|||
*
|
||||
* Loads ELF debugging information from the module image file.
|
||||
*/
|
||||
BOOL elf_load_debug_info(struct module* module, struct elf_file_map* fmap)
|
||||
BOOL elf_load_debug_info(struct module* module, struct image_file_map* fmap)
|
||||
{
|
||||
BOOL ret = TRUE;
|
||||
struct pool pool;
|
||||
struct hash_table ht_symtab;
|
||||
struct elf_file_map my_fmap;
|
||||
BOOL ret = TRUE;
|
||||
struct pool pool;
|
||||
struct hash_table ht_symtab;
|
||||
struct image_file_map my_fmap;
|
||||
struct module_format* modfmt;
|
||||
|
||||
if (module->type != DMT_ELF || !module->elf_info)
|
||||
if (module->type != DMT_ELF || !(modfmt = module->format_info[DFI_ELF]) || !modfmt->u.elf_info)
|
||||
{
|
||||
ERR("Bad elf module '%s'\n", debugstr_w(module->module.LoadedImageName));
|
||||
return FALSE;
|
||||
|
@ -1039,6 +968,12 @@ BOOL elf_load_debug_info(struct module* module, struct elf_file_map* fmap)
|
|||
if (ret)
|
||||
ret = elf_load_debug_info_from_map(module, fmap, &pool, &ht_symtab);
|
||||
|
||||
if (ret)
|
||||
{
|
||||
modfmt->u.elf_info->file_map = *fmap;
|
||||
elf_reset_file_map(fmap);
|
||||
}
|
||||
|
||||
pool_destroy(&pool);
|
||||
if (fmap == &my_fmap) elf_unmap_file(fmap);
|
||||
return ret;
|
||||
|
@ -1052,12 +987,12 @@ BOOL elf_load_debug_info(struct module* module, struct elf_file_map* fmap)
|
|||
BOOL elf_fetch_file_info(const WCHAR* name, DWORD* base,
|
||||
DWORD* size, DWORD* checksum)
|
||||
{
|
||||
struct elf_file_map fmap;
|
||||
struct image_file_map fmap;
|
||||
|
||||
if (!elf_map_file(name, &fmap)) return FALSE;
|
||||
if (base) *base = fmap.elf_start;
|
||||
*size = fmap.elf_size;
|
||||
*checksum = calc_crc32(fmap.fd);
|
||||
if (base) *base = fmap.u.elf.elf_start;
|
||||
*size = fmap.u.elf.elf_size;
|
||||
*checksum = calc_crc32(fmap.u.elf.fd);
|
||||
elf_unmap_file(&fmap);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1076,8 +1011,8 @@ BOOL elf_fetch_file_info(const WCHAR* name, DWORD* base,
|
|||
static BOOL elf_load_file(struct process* pcs, const WCHAR* filename,
|
||||
unsigned long load_offset, struct elf_info* elf_info)
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
struct elf_file_map fmap;
|
||||
BOOL ret = FALSE;
|
||||
struct image_file_map fmap;
|
||||
|
||||
TRACE("Processing elf file '%s' at %08lx\n", debugstr_w(filename), load_offset);
|
||||
|
||||
|
@ -1087,10 +1022,10 @@ static BOOL elf_load_file(struct process* pcs, const WCHAR* filename,
|
|||
* this thing. We need the main executable header, and the section
|
||||
* table.
|
||||
*/
|
||||
if (!fmap.elf_start && !load_offset)
|
||||
if (!fmap.u.elf.elf_start && !load_offset)
|
||||
ERR("Relocatable ELF %s, but no load address. Loading at 0x0000000\n",
|
||||
debugstr_w(filename));
|
||||
if (fmap.elf_start && load_offset)
|
||||
if (fmap.u.elf.elf_start && load_offset)
|
||||
{
|
||||
WARN("Non-relocatable ELF %s, but load address of 0x%08lx supplied. "
|
||||
"Assuming load address is corrupt\n", debugstr_w(filename), load_offset);
|
||||
|
@ -1099,12 +1034,12 @@ static BOOL elf_load_file(struct process* pcs, const WCHAR* filename,
|
|||
|
||||
if (elf_info->flags & ELF_INFO_DEBUG_HEADER)
|
||||
{
|
||||
struct elf_section_map esm;
|
||||
struct image_section_map ism;
|
||||
|
||||
if (elf_find_section(&fmap, ".dynamic", SHT_DYNAMIC, &esm))
|
||||
if (elf_find_section(&fmap, ".dynamic", SHT_DYNAMIC, &ism))
|
||||
{
|
||||
Elf_Dyn dyn;
|
||||
char* ptr = (char*)fmap.sect[esm.sidx].shdr.sh_addr;
|
||||
char* ptr = (char*)fmap.u.elf.sect[ism.sidx].shdr.sh_addr;
|
||||
unsigned long len;
|
||||
|
||||
do
|
||||
|
@ -1126,29 +1061,40 @@ static BOOL elf_load_file(struct process* pcs, const WCHAR* filename,
|
|||
|
||||
if (elf_info->flags & ELF_INFO_MODULE)
|
||||
{
|
||||
struct elf_module_info *elf_module_info =
|
||||
HeapAlloc(GetProcessHeap(), 0, sizeof(struct elf_module_info));
|
||||
if (!elf_module_info) goto leave;
|
||||
struct elf_module_info *elf_module_info;
|
||||
struct module_format* modfmt;
|
||||
|
||||
modfmt = HeapAlloc(GetProcessHeap(), 0,
|
||||
sizeof(struct module_format) + sizeof(struct elf_module_info));
|
||||
if (!modfmt) goto leave;
|
||||
elf_info->module = module_new(pcs, filename, DMT_ELF, FALSE,
|
||||
(load_offset) ? load_offset : fmap.elf_start,
|
||||
fmap.elf_size, 0, calc_crc32(fmap.fd));
|
||||
(load_offset) ? load_offset : fmap.u.elf.elf_start,
|
||||
fmap.u.elf.elf_size, 0, calc_crc32(fmap.u.elf.fd));
|
||||
if (!elf_info->module)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, elf_module_info);
|
||||
HeapFree(GetProcessHeap(), 0, modfmt);
|
||||
goto leave;
|
||||
}
|
||||
elf_info->module->elf_info = elf_module_info;
|
||||
elf_info->module->elf_info->elf_addr = load_offset;
|
||||
elf_module_info = (void*)(modfmt + 1);
|
||||
elf_info->module->format_info[DFI_ELF] = modfmt;
|
||||
modfmt->module = elf_info->module;
|
||||
modfmt->remove = elf_module_remove;
|
||||
modfmt->loc_compute = NULL;
|
||||
modfmt->u.elf_info = elf_module_info;
|
||||
|
||||
elf_module_info->elf_addr = load_offset;
|
||||
|
||||
if (dbghelp_options & SYMOPT_DEFERRED_LOADS)
|
||||
{
|
||||
elf_info->module->module.SymType = SymDeferred;
|
||||
elf_module_info->file_map = fmap;
|
||||
elf_reset_file_map(&fmap);
|
||||
ret = TRUE;
|
||||
}
|
||||
else ret = elf_load_debug_info(elf_info->module, &fmap);
|
||||
|
||||
elf_info->module->elf_info->elf_mark = 1;
|
||||
elf_info->module->elf_info->elf_loader = 0;
|
||||
elf_module_info->elf_mark = 1;
|
||||
elf_module_info->elf_loader = 0;
|
||||
} else ret = TRUE;
|
||||
|
||||
if (elf_info->flags & ELF_INFO_NAME)
|
||||
|
@ -1260,7 +1206,7 @@ static BOOL elf_search_and_load_file(struct process* pcs, const WCHAR* filename,
|
|||
if ((module = module_is_already_loaded(pcs, filename)))
|
||||
{
|
||||
elf_info->module = module;
|
||||
module->elf_info->elf_mark = 1;
|
||||
elf_info->module->format_info[DFI_ELF]->u.elf_info->elf_mark = 1;
|
||||
return module->module.SymType;
|
||||
}
|
||||
|
||||
|
@ -1352,7 +1298,7 @@ BOOL elf_synchronize_module_list(struct process* pcs)
|
|||
for (module = pcs->lmodules; module; module = module->next)
|
||||
{
|
||||
if (module->type == DMT_ELF && !module->is_virtual)
|
||||
module->elf_info->elf_mark = 0;
|
||||
module->format_info[DFI_ELF]->u.elf_info->elf_mark = 0;
|
||||
}
|
||||
|
||||
es.pcs = pcs;
|
||||
|
@ -1363,14 +1309,19 @@ BOOL elf_synchronize_module_list(struct process* pcs)
|
|||
module = pcs->lmodules;
|
||||
while (module)
|
||||
{
|
||||
if (module->type == DMT_ELF && !module->is_virtual &&
|
||||
!module->elf_info->elf_mark && !module->elf_info->elf_loader)
|
||||
if (module->type == DMT_ELF && !module->is_virtual)
|
||||
{
|
||||
module_remove(pcs, module);
|
||||
/* restart all over */
|
||||
module = pcs->lmodules;
|
||||
struct elf_module_info* elf_info = module->format_info[DFI_ELF]->u.elf_info;
|
||||
|
||||
if (!elf_info->elf_mark && !elf_info->elf_loader)
|
||||
{
|
||||
module_remove(pcs, module);
|
||||
/* restart all over */
|
||||
module = pcs->lmodules;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else module = module->next;
|
||||
module = module->next;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1415,7 +1366,7 @@ BOOL elf_read_wine_loader_dbg_info(struct process* pcs)
|
|||
|
||||
elf_info.flags = ELF_INFO_DEBUG_HEADER | ELF_INFO_MODULE;
|
||||
if (!elf_search_loader(pcs, &elf_info)) return FALSE;
|
||||
elf_info.module->elf_info->elf_loader = 1;
|
||||
elf_info.module->format_info[DFI_ELF]->u.elf_info->elf_loader = 1;
|
||||
module_set_module(elf_info.module, S_WineLoaderW);
|
||||
return (pcs->dbg_hdr_addr = elf_info.dbg_hdr_addr) != 0;
|
||||
}
|
||||
|
@ -1516,6 +1467,30 @@ struct module* elf_load_module(struct process* pcs, const WCHAR* name, unsigned
|
|||
|
||||
#else /* !__ELF__ */
|
||||
|
||||
BOOL elf_find_section(struct image_file_map* fmap, const char* name,
|
||||
unsigned sht, struct image_section_map* ism)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
const char* elf_map_section(struct image_section_map* ism)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void elf_unmap_section(struct image_section_map* ism)
|
||||
{}
|
||||
|
||||
unsigned elf_get_map_size(const struct image_section_map* ism)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD_PTR elf_get_map_rva(const struct image_section_map* ism)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL elf_synchronize_module_list(struct process* pcs)
|
||||
{
|
||||
return FALSE;
|
||||
|
@ -1542,7 +1517,7 @@ struct module* elf_load_module(struct process* pcs, const WCHAR* name, unsigned
|
|||
return NULL;
|
||||
}
|
||||
|
||||
BOOL elf_load_debug_info(struct module* module, struct elf_file_map* fmap)
|
||||
BOOL elf_load_debug_info(struct module* module, struct image_file_map* fmap)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -655,9 +655,10 @@ static int macho_parse_symtab(struct macho_file_map* fmap,
|
|||
sc->stroff, sc->strsize, (const void**)&stab, (const void**)&stabstr))
|
||||
return 0;
|
||||
|
||||
if (!stabs_parse(mdi->module, mdi->module->macho_info->load_addr - fmap->segs_start,
|
||||
stab, sc->nsyms * sizeof(struct nlist),
|
||||
stabstr, sc->strsize, macho_stabs_def_cb, mdi))
|
||||
if (!stabs_parse(mdi->module,
|
||||
mdi->module->format_info[DFI_MACHO]->u.macho_info->load_addr - fmap->segs_start,
|
||||
stab, sc->nsyms * sizeof(struct nlist),
|
||||
stabstr, sc->strsize, macho_stabs_def_cb, mdi))
|
||||
ret = -1;
|
||||
|
||||
macho_unmap_ranges(fmap, sc->symoff, sc->nsyms * sizeof(struct nlist),
|
||||
|
@ -703,7 +704,7 @@ static void macho_finish_stabs(struct module* module, struct hash_table* ht_symt
|
|||
{
|
||||
case SymTagFunction:
|
||||
func = (struct symt_function*)sym;
|
||||
if (func->address == module->macho_info->load_addr)
|
||||
if (func->address == module->format_info[DFI_MACHO]->u.macho_info->load_addr)
|
||||
{
|
||||
TRACE("Adjusting function %p/%s!%s from 0x%08lx to 0x%08lx\n", func,
|
||||
debugstr_w(module->module.ModuleName), sym->hash_elt.name,
|
||||
|
@ -720,7 +721,7 @@ static void macho_finish_stabs(struct module* module, struct hash_table* ht_symt
|
|||
{
|
||||
case DataIsGlobal:
|
||||
case DataIsFileStatic:
|
||||
if (data->u.var.offset == module->macho_info->load_addr)
|
||||
if (data->u.var.offset == module->format_info[DFI_MACHO]->u.macho_info->load_addr)
|
||||
{
|
||||
TRACE("Adjusting data symbol %p/%s!%s from 0x%08lx to 0x%08lx\n",
|
||||
data, debugstr_w(module->module.ModuleName), sym->hash_elt.name,
|
||||
|
@ -879,7 +880,7 @@ BOOL macho_load_debug_info(struct module* module, struct macho_file_map* fmap)
|
|||
|
||||
TRACE("(%p, %p/%d)\n", module, fmap, fmap ? fmap->fd : -1);
|
||||
|
||||
if (module->type != DMT_MACHO || !module->macho_info)
|
||||
if (module->type != DMT_MACHO || !module->format_info[DFI_MACHO]->u.macho_info)
|
||||
{
|
||||
ERR("Bad Mach-O module '%s'\n", debugstr_w(module->module.LoadedImageName));
|
||||
return FALSE;
|
||||
|
@ -963,26 +964,34 @@ static BOOL macho_load_file(struct process* pcs, const WCHAR* filename,
|
|||
|
||||
if (macho_info->flags & MACHO_INFO_MODULE)
|
||||
{
|
||||
struct macho_module_info *macho_module_info =
|
||||
HeapAlloc(GetProcessHeap(), 0, sizeof(struct macho_module_info));
|
||||
if (!macho_module_info) goto leave;
|
||||
struct macho_module_info *macho_module_info;
|
||||
struct module_format* modfmt =
|
||||
HeapAlloc(GetProcessHeap(), 0, sizeof(struct module_format) + sizeof(struct macho_module_info));
|
||||
if (!modfmt) goto leave;
|
||||
macho_info->module = module_new(pcs, filename, DMT_MACHO, FALSE, load_addr,
|
||||
fmap.segs_size, 0, calc_crc32(fmap.fd));
|
||||
if (!macho_info->module)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, macho_module_info);
|
||||
HeapFree(GetProcessHeap(), 0, modfmt);
|
||||
goto leave;
|
||||
}
|
||||
macho_info->module->macho_info = macho_module_info;
|
||||
macho_info->module->macho_info->load_addr = load_addr;
|
||||
macho_module_info = (void*)(modfmt + 1);
|
||||
macho_info->module->format_info[DFI_MACHO] = modfmt;
|
||||
|
||||
modfmt->module = macho_info->module;
|
||||
modfmt->remove = NULL;
|
||||
modfmt->loc_compute = NULL;
|
||||
modfmt->u.macho_info = macho_module_info;
|
||||
|
||||
macho_module_info->load_addr = load_addr;
|
||||
|
||||
if (dbghelp_options & SYMOPT_DEFERRED_LOADS)
|
||||
macho_info->module->module.SymType = SymDeferred;
|
||||
else if (!macho_load_debug_info(macho_info->module, &fmap))
|
||||
ret = FALSE;
|
||||
|
||||
macho_info->module->macho_info->in_use = 1;
|
||||
macho_info->module->macho_info->is_loader = 0;
|
||||
macho_info->module->format_info[DFI_MACHO]->u.macho_info->in_use = 1;
|
||||
macho_info->module->format_info[DFI_MACHO]->u.macho_info->is_loader = 0;
|
||||
TRACE("module = %p\n", macho_info->module);
|
||||
}
|
||||
|
||||
|
@ -1109,7 +1118,7 @@ static BOOL macho_search_and_load_file(struct process* pcs, const WCHAR* filenam
|
|||
if ((module = module_is_already_loaded(pcs, filename)))
|
||||
{
|
||||
macho_info->module = module;
|
||||
module->macho_info->in_use = 1;
|
||||
module->format_info[DFI_MACHO]->u.macho_info->in_use = 1;
|
||||
return module->module.SymType;
|
||||
}
|
||||
|
||||
|
@ -1231,7 +1240,7 @@ BOOL macho_synchronize_module_list(struct process* pcs)
|
|||
for (module = pcs->lmodules; module; module = module->next)
|
||||
{
|
||||
if (module->type == DMT_MACHO && !module->is_virtual)
|
||||
module->macho_info->in_use = 0;
|
||||
module->format_info[DFI_MACHO]->u.macho_info->in_use = 0;
|
||||
}
|
||||
|
||||
ms.pcs = pcs;
|
||||
|
@ -1243,7 +1252,8 @@ BOOL macho_synchronize_module_list(struct process* pcs)
|
|||
while (module)
|
||||
{
|
||||
if (module->type == DMT_MACHO && !module->is_virtual &&
|
||||
!module->macho_info->in_use && !module->macho_info->is_loader)
|
||||
!module->format_info[DFI_MACHO]->u.macho_info->in_use &&
|
||||
!module->format_info[DFI_MACHO]->u.macho_info->is_loader)
|
||||
{
|
||||
module_remove(pcs, module);
|
||||
/* restart all over */
|
||||
|
@ -1297,7 +1307,7 @@ BOOL macho_read_wine_loader_dbg_info(struct process* pcs)
|
|||
TRACE("(%p/%p)\n", pcs, pcs->handle);
|
||||
macho_info.flags = MACHO_INFO_DEBUG_HEADER | MACHO_INFO_MODULE;
|
||||
if (!macho_search_loader(pcs, &macho_info)) return FALSE;
|
||||
macho_info.module->macho_info->is_loader = 1;
|
||||
macho_info.module->format_info[DFI_MACHO]->u.macho_info->is_loader = 1;
|
||||
module_set_module(macho_info.module, S_WineLoaderW);
|
||||
return (pcs->dbg_hdr_addr = macho_info.dbg_hdr_addr) != 0;
|
||||
}
|
||||
|
|
|
@ -126,6 +126,7 @@ struct module* module_new(struct process* pcs, const WCHAR* name,
|
|||
unsigned long stamp, unsigned long checksum)
|
||||
{
|
||||
struct module* module;
|
||||
unsigned i;
|
||||
|
||||
assert(type == DMT_ELF || type == DMT_PE || type == DMT_MACHO);
|
||||
if (!(module = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*module))))
|
||||
|
@ -168,6 +169,7 @@ struct module* module_new(struct process* pcs, const WCHAR* name,
|
|||
|
||||
module->type = type;
|
||||
module->is_virtual = virtual ? TRUE : FALSE;
|
||||
for (i = 0; i < DFI_LAST; i++) module->format_info[i] = NULL;
|
||||
module->sortlist_valid = FALSE;
|
||||
module->sorttab_size = 0;
|
||||
module->addr_sorttab = NULL;
|
||||
|
@ -621,14 +623,21 @@ DWORD64 WINAPI SymLoadModule64(HANDLE hProcess, HANDLE hFile, PCSTR ImageName,
|
|||
*/
|
||||
BOOL module_remove(struct process* pcs, struct module* module)
|
||||
{
|
||||
struct module_format*modfmt;
|
||||
struct module** p;
|
||||
unsigned i;
|
||||
|
||||
TRACE("%s (%p)\n", debugstr_w(module->module.ModuleName), module);
|
||||
|
||||
for (i = 0; i < DFI_LAST; i++)
|
||||
{
|
||||
if ((modfmt = module->format_info[i]) && modfmt->remove)
|
||||
modfmt->remove(pcs, module->format_info[i]);
|
||||
}
|
||||
hash_table_destroy(&module->ht_symbols);
|
||||
hash_table_destroy(&module->ht_types);
|
||||
HeapFree(GetProcessHeap(), 0, module->sources);
|
||||
HeapFree(GetProcessHeap(), 0, module->addr_sorttab);
|
||||
HeapFree(GetProcessHeap(), 0, module->dwarf2_info);
|
||||
pool_destroy(&module->pool);
|
||||
/* native dbghelp doesn't invoke registered callback(,CBA_SYMBOLS_UNLOADED,) here
|
||||
* so do we
|
||||
|
|
|
@ -30,11 +30,239 @@
|
|||
#include <assert.h>
|
||||
|
||||
#include "dbghelp_private.h"
|
||||
#include "image_private.h"
|
||||
#include "winternl.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
|
||||
|
||||
struct pe_module_info
|
||||
{
|
||||
struct image_file_map fmap;
|
||||
};
|
||||
|
||||
static void* pe_map_full(struct image_file_map* fmap, IMAGE_NT_HEADERS** nth)
|
||||
{
|
||||
if (!fmap->u.pe.full_map)
|
||||
{
|
||||
fmap->u.pe.full_map = MapViewOfFile(fmap->u.pe.hMap, FILE_MAP_READ, 0, 0, 0);
|
||||
}
|
||||
if (fmap->u.pe.full_map)
|
||||
{
|
||||
if (nth) *nth = RtlImageNtHeader(fmap->u.pe.full_map);
|
||||
fmap->u.pe.full_count++;
|
||||
return fmap->u.pe.full_map;
|
||||
}
|
||||
return IMAGE_NO_MAP;
|
||||
}
|
||||
|
||||
static void pe_unmap_full(struct image_file_map* fmap)
|
||||
{
|
||||
if (fmap->u.pe.full_count && !--fmap->u.pe.full_count)
|
||||
{
|
||||
UnmapViewOfFile(fmap->u.pe.full_map);
|
||||
fmap->u.pe.full_map = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* pe_map_section
|
||||
*
|
||||
* Maps a single section into memory from an PE file
|
||||
*/
|
||||
const char* pe_map_section(struct image_section_map* ism)
|
||||
{
|
||||
void* mapping;
|
||||
struct pe_file_map* fmap = &ism->fmap->u.pe;
|
||||
|
||||
if (ism->sidx >= 0 && ism->sidx < fmap->ntheader.FileHeader.NumberOfSections &&
|
||||
fmap->sect[ism->sidx].mapped == IMAGE_NO_MAP)
|
||||
{
|
||||
IMAGE_NT_HEADERS* nth;
|
||||
/* FIXME: that's rather drastic, but that will do for now
|
||||
* that's ok if the full file map exists, but we could be less agressive otherwise and
|
||||
* only map the relevant section
|
||||
*/
|
||||
if ((mapping = pe_map_full(ism->fmap, &nth)))
|
||||
{
|
||||
fmap->sect[ism->sidx].mapped = RtlImageRvaToVa(nth, mapping,
|
||||
fmap->sect[ism->sidx].shdr.VirtualAddress,
|
||||
NULL);
|
||||
return fmap->sect[ism->sidx].mapped;
|
||||
}
|
||||
}
|
||||
return IMAGE_NO_MAP;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* pe_find_section
|
||||
*
|
||||
* Finds a section by name (and type) into memory from an PE file
|
||||
* or its alternate if any
|
||||
*/
|
||||
BOOL pe_find_section(struct image_file_map* fmap, const char* name,
|
||||
struct image_section_map* ism)
|
||||
{
|
||||
const char* sectname;
|
||||
unsigned i;
|
||||
char tmp[IMAGE_SIZEOF_SHORT_NAME + 1];
|
||||
|
||||
for (i = 0; i < fmap->u.pe.ntheader.FileHeader.NumberOfSections; i++)
|
||||
{
|
||||
sectname = (const char*)fmap->u.pe.sect[i].shdr.Name;
|
||||
/* long section names start with a '/' (at least on MinGW32) */
|
||||
if (sectname[0] == '/' && fmap->u.pe.strtable)
|
||||
sectname = fmap->u.pe.strtable + atoi(sectname + 1);
|
||||
else
|
||||
{
|
||||
/* the section name may not be null terminated */
|
||||
sectname = memcpy(tmp, sectname, IMAGE_SIZEOF_SHORT_NAME);
|
||||
tmp[IMAGE_SIZEOF_SHORT_NAME] = '\0';
|
||||
}
|
||||
if (!strcasecmp(sectname, name))
|
||||
{
|
||||
ism->fmap = fmap;
|
||||
ism->sidx = i;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
ism->fmap = NULL;
|
||||
ism->sidx = -1;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* pe_unmap_section
|
||||
*
|
||||
* Unmaps a single section from memory
|
||||
*/
|
||||
void pe_unmap_section(struct image_section_map* ism)
|
||||
{
|
||||
if (ism->sidx >= 0 && ism->sidx < ism->fmap->u.pe.ntheader.FileHeader.NumberOfSections &&
|
||||
ism->fmap->u.pe.sect[ism->sidx].mapped != IMAGE_NO_MAP)
|
||||
{
|
||||
pe_unmap_full(ism->fmap);
|
||||
ism->fmap->u.pe.sect[ism->sidx].mapped = IMAGE_NO_MAP;
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* pe_get_map_rva
|
||||
*
|
||||
* Get the RVA of an PE section
|
||||
*/
|
||||
DWORD_PTR pe_get_map_rva(const struct image_section_map* ism)
|
||||
{
|
||||
if (ism->sidx < 0 || ism->sidx >= ism->fmap->u.pe.ntheader.FileHeader.NumberOfSections)
|
||||
return 0;
|
||||
return ism->fmap->u.pe.sect[ism->sidx].shdr.VirtualAddress;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* pe_get_map_size
|
||||
*
|
||||
* Get the size of an PE section
|
||||
*/
|
||||
unsigned pe_get_map_size(const struct image_section_map* ism)
|
||||
{
|
||||
if (ism->sidx < 0 || ism->sidx >= ism->fmap->u.pe.ntheader.FileHeader.NumberOfSections)
|
||||
return 0;
|
||||
return ism->fmap->u.pe.sect[ism->sidx].shdr.SizeOfRawData;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* pe_map_file
|
||||
*
|
||||
* Maps an PE file into memory (and checks it's a real PE file)
|
||||
*/
|
||||
static BOOL pe_map_file(HANDLE file, struct image_file_map* fmap, enum module_type mt)
|
||||
{
|
||||
void* mapping;
|
||||
|
||||
fmap->modtype = mt;
|
||||
fmap->u.pe.hMap = CreateFileMappingW(file, NULL, PAGE_READONLY, 0, 0, NULL);
|
||||
if (fmap->u.pe.hMap == 0) return FALSE;
|
||||
fmap->u.pe.full_count = 0;
|
||||
fmap->u.pe.full_map = NULL;
|
||||
if (!(mapping = pe_map_full(fmap, NULL))) goto error;
|
||||
|
||||
switch (mt)
|
||||
{
|
||||
case DMT_PE:
|
||||
{
|
||||
IMAGE_NT_HEADERS* nthdr;
|
||||
IMAGE_SECTION_HEADER* section;
|
||||
unsigned i;
|
||||
|
||||
if (!(nthdr = RtlImageNtHeader(mapping))) goto error;
|
||||
memcpy(&fmap->u.pe.ntheader, nthdr, sizeof(fmap->u.pe.ntheader));
|
||||
section = (IMAGE_SECTION_HEADER*)
|
||||
((char*)&nthdr->OptionalHeader + nthdr->FileHeader.SizeOfOptionalHeader);
|
||||
fmap->u.pe.sect = HeapAlloc(GetProcessHeap(), 0,
|
||||
nthdr->FileHeader.NumberOfSections * sizeof(fmap->u.pe.sect[0]));
|
||||
if (!fmap->u.pe.sect) goto error;
|
||||
for (i = 0; i < nthdr->FileHeader.NumberOfSections; i++)
|
||||
{
|
||||
memcpy(&fmap->u.pe.sect[i].shdr, section + i, sizeof(IMAGE_SECTION_HEADER));
|
||||
fmap->u.pe.sect[i].mapped = IMAGE_NO_MAP;
|
||||
}
|
||||
if (nthdr->FileHeader.PointerToSymbolTable && nthdr->FileHeader.NumberOfSymbols)
|
||||
{
|
||||
/* FIXME ugly: should rather map the relevant content instead of copying it */
|
||||
const char* src = (const char*)mapping +
|
||||
nthdr->FileHeader.PointerToSymbolTable +
|
||||
nthdr->FileHeader.NumberOfSymbols * sizeof(IMAGE_SYMBOL);
|
||||
char* dst;
|
||||
DWORD sz = *(DWORD*)src;
|
||||
|
||||
if ((dst = HeapAlloc(GetProcessHeap(), 0, sz)))
|
||||
memcpy(dst, src, sz);
|
||||
fmap->u.pe.strtable = dst;
|
||||
}
|
||||
else fmap->u.pe.strtable = NULL;
|
||||
}
|
||||
break;
|
||||
default: assert(0); goto error;
|
||||
}
|
||||
pe_unmap_full(fmap);
|
||||
|
||||
return TRUE;
|
||||
error:
|
||||
pe_unmap_full(fmap);
|
||||
CloseHandle(fmap->u.pe.hMap);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* pe_unmap_file
|
||||
*
|
||||
* Unmaps an PE file from memory (previously mapped with pe_map_file)
|
||||
*/
|
||||
static void pe_unmap_file(struct image_file_map* fmap)
|
||||
{
|
||||
if (fmap->u.pe.hMap != 0)
|
||||
{
|
||||
struct image_section_map ism;
|
||||
ism.fmap = fmap;
|
||||
for (ism.sidx = 0; ism.sidx < fmap->u.pe.ntheader.FileHeader.NumberOfSections; ism.sidx++)
|
||||
{
|
||||
pe_unmap_section(&ism);
|
||||
}
|
||||
while (fmap->u.pe.full_count) pe_unmap_full(fmap);
|
||||
HeapFree(GetProcessHeap(), 0, fmap->u.pe.sect);
|
||||
HeapFree(GetProcessHeap(), 0, (void*)fmap->u.pe.strtable); /* FIXME ugly (see pe_map_file) */
|
||||
CloseHandle(fmap->u.pe.hMap);
|
||||
fmap->u.pe.hMap = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void pe_module_remove(struct process* pcs, struct module_format* modfmt)
|
||||
{
|
||||
pe_unmap_file(&modfmt->u.pe_info->fmap);
|
||||
HeapFree(GetProcessHeap(), 0, modfmt);
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* pe_locate_with_coff_symbol_table
|
||||
*
|
||||
|
@ -43,37 +271,35 @@ WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
|
|||
* Mingw32 requires this for stabs debug information as address for global variables isn't filled in
|
||||
* (this is similar to what is done in elf_module.c when using the .symtab ELF section)
|
||||
*/
|
||||
static BOOL pe_locate_with_coff_symbol_table(struct module* module, IMAGE_NT_HEADERS* nth, void* mapping)
|
||||
static BOOL pe_locate_with_coff_symbol_table(struct module* module)
|
||||
{
|
||||
struct image_file_map* fmap = &module->format_info[DFI_PE]->u.pe_info->fmap;
|
||||
const IMAGE_SYMBOL* isym;
|
||||
int i, numsym, naux;
|
||||
const char* strtable;
|
||||
char tmp[9];
|
||||
const char* name;
|
||||
struct hash_table_iter hti;
|
||||
void* ptr;
|
||||
struct symt_data* sym;
|
||||
const IMAGE_SECTION_HEADER* sect;
|
||||
const char* mapping;
|
||||
|
||||
numsym = nth->FileHeader.NumberOfSymbols;
|
||||
if (!nth->FileHeader.PointerToSymbolTable || !numsym)
|
||||
numsym = fmap->u.pe.ntheader.FileHeader.NumberOfSymbols;
|
||||
if (!fmap->u.pe.ntheader.FileHeader.PointerToSymbolTable || !numsym)
|
||||
return TRUE;
|
||||
isym = (const IMAGE_SYMBOL*)((char*)mapping + nth->FileHeader.PointerToSymbolTable);
|
||||
/* FIXME: no way to get strtable size */
|
||||
strtable = (const char*)&isym[numsym];
|
||||
sect = IMAGE_FIRST_SECTION(nth);
|
||||
if (!(mapping = pe_map_full(fmap, NULL))) return FALSE;
|
||||
isym = (const IMAGE_SYMBOL*)(mapping + fmap->u.pe.ntheader.FileHeader.PointerToSymbolTable);
|
||||
|
||||
for (i = 0; i < numsym; i+= naux, isym += naux)
|
||||
{
|
||||
if (isym->StorageClass == IMAGE_SYM_CLASS_EXTERNAL &&
|
||||
isym->SectionNumber > 0 && isym->SectionNumber <= nth->FileHeader.NumberOfSections)
|
||||
isym->SectionNumber > 0 && isym->SectionNumber <= fmap->u.pe.ntheader.FileHeader.NumberOfSections)
|
||||
{
|
||||
if (isym->N.Name.Short)
|
||||
{
|
||||
name = memcpy(tmp, isym->N.ShortName, 8);
|
||||
tmp[8] = '\0';
|
||||
}
|
||||
else name = strtable + isym->N.Name.Long;
|
||||
else name = fmap->u.pe.strtable + isym->N.Name.Long;
|
||||
if (name[0] == '_') name++;
|
||||
hash_table_iter_init(&module->ht_symbols, &hti, name);
|
||||
while ((ptr = hash_table_iter_up(&hti)))
|
||||
|
@ -86,15 +312,17 @@ static BOOL pe_locate_with_coff_symbol_table(struct module* module, IMAGE_NT_HEA
|
|||
TRACE("Changing absolute address for %d.%s: %lx -> %s\n",
|
||||
isym->SectionNumber, name, sym->u.var.offset,
|
||||
wine_dbgstr_longlong(module->module.BaseOfImage +
|
||||
sect[isym->SectionNumber - 1].VirtualAddress + isym->Value));
|
||||
fmap->u.pe.sect[isym->SectionNumber - 1].shdr.VirtualAddress +
|
||||
isym->Value));
|
||||
sym->u.var.offset = module->module.BaseOfImage +
|
||||
sect[isym->SectionNumber - 1].VirtualAddress + isym->Value;
|
||||
fmap->u.pe.sect[isym->SectionNumber - 1].shdr.VirtualAddress + isym->Value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
naux = isym->NumberOfAuxSymbols + 1;
|
||||
}
|
||||
pe_unmap_full(fmap);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -103,8 +331,9 @@ static BOOL pe_locate_with_coff_symbol_table(struct module* module, IMAGE_NT_HEA
|
|||
*
|
||||
* Load public symbols out of the COFF symbol table (if any).
|
||||
*/
|
||||
static BOOL pe_load_coff_symbol_table(struct module* module, IMAGE_NT_HEADERS* nth, void* mapping)
|
||||
static BOOL pe_load_coff_symbol_table(struct module* module)
|
||||
{
|
||||
struct image_file_map* fmap = &module->format_info[DFI_PE]->u.pe_info->fmap;
|
||||
const IMAGE_SYMBOL* isym;
|
||||
int i, numsym, naux;
|
||||
const char* strtable;
|
||||
|
@ -113,14 +342,16 @@ static BOOL pe_load_coff_symbol_table(struct module* module, IMAGE_NT_HEADERS* n
|
|||
const char* lastfilename = NULL;
|
||||
struct symt_compiland* compiland = NULL;
|
||||
const IMAGE_SECTION_HEADER* sect;
|
||||
const char* mapping;
|
||||
|
||||
numsym = nth->FileHeader.NumberOfSymbols;
|
||||
if (!nth->FileHeader.PointerToSymbolTable || !numsym)
|
||||
numsym = fmap->u.pe.ntheader.FileHeader.NumberOfSymbols;
|
||||
if (!fmap->u.pe.ntheader.FileHeader.PointerToSymbolTable || !numsym)
|
||||
return TRUE;
|
||||
isym = (const IMAGE_SYMBOL*)((char*)mapping + nth->FileHeader.PointerToSymbolTable);
|
||||
if (!(mapping = pe_map_full(fmap, NULL))) return FALSE;
|
||||
isym = (const IMAGE_SYMBOL*)((char*)mapping + fmap->u.pe.ntheader.FileHeader.PointerToSymbolTable);
|
||||
/* FIXME: no way to get strtable size */
|
||||
strtable = (const char*)&isym[numsym];
|
||||
sect = IMAGE_FIRST_SECTION(nth);
|
||||
sect = IMAGE_FIRST_SECTION(&fmap->u.pe.ntheader);
|
||||
|
||||
for (i = 0; i < numsym; i+= naux, isym += naux)
|
||||
{
|
||||
|
@ -130,7 +361,7 @@ static BOOL pe_load_coff_symbol_table(struct module* module, IMAGE_NT_HEADERS* n
|
|||
compiland = NULL;
|
||||
}
|
||||
if (isym->StorageClass == IMAGE_SYM_CLASS_EXTERNAL &&
|
||||
isym->SectionNumber > 0 && isym->SectionNumber <= nth->FileHeader.NumberOfSections)
|
||||
isym->SectionNumber > 0 && isym->SectionNumber <= fmap->u.pe.ntheader.FileHeader.NumberOfSections)
|
||||
{
|
||||
if (isym->N.Name.Short)
|
||||
{
|
||||
|
@ -143,9 +374,12 @@ static BOOL pe_load_coff_symbol_table(struct module* module, IMAGE_NT_HEADERS* n
|
|||
if (!compiland && lastfilename)
|
||||
compiland = symt_new_compiland(module, 0,
|
||||
source_new(module, NULL, lastfilename));
|
||||
symt_new_public(module, compiland, name,
|
||||
module->module.BaseOfImage + sect[isym->SectionNumber - 1].VirtualAddress + isym->Value,
|
||||
1);
|
||||
|
||||
if (!(dbghelp_options & SYMOPT_NO_PUBLICS))
|
||||
symt_new_public(module, compiland, name,
|
||||
module->module.BaseOfImage + sect[isym->SectionNumber - 1].VirtualAddress +
|
||||
isym->Value,
|
||||
1);
|
||||
}
|
||||
naux = isym->NumberOfAuxSymbols + 1;
|
||||
}
|
||||
|
@ -155,6 +389,7 @@ static BOOL pe_load_coff_symbol_table(struct module* module, IMAGE_NT_HEADERS* n
|
|||
module->module.TypeInfo = FALSE;
|
||||
module->module.SourceIndexed = FALSE;
|
||||
module->module.Publics = TRUE;
|
||||
pe_unmap_full(fmap);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -176,30 +411,30 @@ static inline DWORD pe_get_sect_size(IMAGE_SECTION_HEADER* sect)
|
|||
* look for stabs information in PE header (it's how the mingw compiler provides
|
||||
* its debugging information)
|
||||
*/
|
||||
static BOOL pe_load_stabs(const struct process* pcs, struct module* module,
|
||||
void* mapping, IMAGE_NT_HEADERS* nth)
|
||||
static BOOL pe_load_stabs(const struct process* pcs, struct module* module)
|
||||
{
|
||||
IMAGE_SECTION_HEADER* section;
|
||||
IMAGE_SECTION_HEADER* sect_stabs = NULL;
|
||||
IMAGE_SECTION_HEADER* sect_stabstr = NULL;
|
||||
int i;
|
||||
struct image_file_map* fmap = &module->format_info[DFI_PE]->u.pe_info->fmap;
|
||||
struct image_section_map sect_stabs, sect_stabstr;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
section = (IMAGE_SECTION_HEADER*)
|
||||
((char*)&nth->OptionalHeader + nth->FileHeader.SizeOfOptionalHeader);
|
||||
for (i = 0; i < nth->FileHeader.NumberOfSections; i++, section++)
|
||||
if (pe_find_section(fmap, ".stab", §_stabs) && pe_find_section(fmap, ".stabstr", §_stabstr))
|
||||
{
|
||||
if (!strcasecmp((const char*)section->Name, ".stab")) sect_stabs = section;
|
||||
else if (!strncasecmp((const char*)section->Name, ".stabstr", 8)) sect_stabstr = section;
|
||||
}
|
||||
if (sect_stabs && sect_stabstr)
|
||||
{
|
||||
ret = stabs_parse(module,
|
||||
module->module.BaseOfImage - nth->OptionalHeader.ImageBase,
|
||||
pe_get_sect(nth, mapping, sect_stabs), pe_get_sect_size(sect_stabs),
|
||||
pe_get_sect(nth, mapping, sect_stabstr), pe_get_sect_size(sect_stabstr),
|
||||
NULL, NULL);
|
||||
if (ret) pe_locate_with_coff_symbol_table(module, nth, mapping);
|
||||
const char* stab;
|
||||
const char* stabstr;
|
||||
|
||||
stab = image_map_section(§_stabs);
|
||||
stabstr = image_map_section(§_stabstr);
|
||||
if (stab != IMAGE_NO_MAP && stabstr != IMAGE_NO_MAP)
|
||||
{
|
||||
ret = stabs_parse(module,
|
||||
module->module.BaseOfImage - fmap->u.pe.ntheader.OptionalHeader.ImageBase,
|
||||
stab, image_get_map_size(§_stabs),
|
||||
stabstr, image_get_map_size(§_stabstr),
|
||||
NULL, NULL);
|
||||
}
|
||||
image_unmap_section(§_stabs);
|
||||
image_unmap_section(§_stabstr);
|
||||
if (ret) pe_locate_with_coff_symbol_table(module);
|
||||
}
|
||||
TRACE("%s the STABS debug info\n", ret ? "successfully loaded" : "failed to load");
|
||||
|
||||
|
@ -212,51 +447,15 @@ static BOOL pe_load_stabs(const struct process* pcs, struct module* module,
|
|||
* look for dwarf information in PE header (it's also a way for the mingw compiler
|
||||
* to provide its debugging information)
|
||||
*/
|
||||
static BOOL pe_load_dwarf(const struct process* pcs, struct module* module,
|
||||
void* mapping, IMAGE_NT_HEADERS* nth)
|
||||
static BOOL pe_load_dwarf(struct module* module)
|
||||
{
|
||||
IMAGE_SECTION_HEADER* section;
|
||||
IMAGE_SECTION_HEADER* sect_debuginfo = NULL;
|
||||
IMAGE_SECTION_HEADER* sect_debugstr = NULL;
|
||||
IMAGE_SECTION_HEADER* sect_debugabbrev = NULL;
|
||||
IMAGE_SECTION_HEADER* sect_debugline = NULL;
|
||||
IMAGE_SECTION_HEADER* sect_debugloc = NULL;
|
||||
int i;
|
||||
const char* strtable;
|
||||
const char* sectname;
|
||||
struct image_file_map* fmap = &module->format_info[DFI_PE]->u.pe_info->fmap;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
if (nth->FileHeader.PointerToSymbolTable && nth->FileHeader.NumberOfSymbols)
|
||||
/* FIXME: no way to get strtable size */
|
||||
strtable = (const char*)mapping + nth->FileHeader.PointerToSymbolTable +
|
||||
nth->FileHeader.NumberOfSymbols * sizeof(IMAGE_SYMBOL);
|
||||
else strtable = NULL;
|
||||
|
||||
section = (IMAGE_SECTION_HEADER*)
|
||||
((char*)&nth->OptionalHeader + nth->FileHeader.SizeOfOptionalHeader);
|
||||
for (i = 0; i < nth->FileHeader.NumberOfSections; i++, section++)
|
||||
{
|
||||
sectname = (const char*)section->Name;
|
||||
/* long section names start with a '/' (at least on MinGW32) */
|
||||
if (*sectname == '/' && strtable)
|
||||
sectname = strtable + atoi(sectname + 1);
|
||||
if (!strcasecmp(sectname, ".debug_info")) sect_debuginfo = section;
|
||||
else if (!strcasecmp(sectname, ".debug_str")) sect_debugstr = section;
|
||||
else if (!strcasecmp(sectname, ".debug_abbrev")) sect_debugabbrev = section;
|
||||
else if (!strcasecmp(sectname, ".debug_line")) sect_debugline = section;
|
||||
else if (!strcasecmp(sectname, ".debug_loc")) sect_debugloc = section;
|
||||
}
|
||||
if (sect_debuginfo)
|
||||
{
|
||||
ret = dwarf2_parse(module,
|
||||
module->module.BaseOfImage - nth->OptionalHeader.ImageBase,
|
||||
NULL, /* FIXME: some thunks to deal with ? */
|
||||
pe_get_sect(nth, mapping, sect_debuginfo), pe_get_sect_size(sect_debuginfo),
|
||||
pe_get_sect(nth, mapping, sect_debugabbrev), pe_get_sect_size(sect_debugabbrev),
|
||||
pe_get_sect(nth, mapping, sect_debugstr), pe_get_sect_size(sect_debugstr),
|
||||
pe_get_sect(nth, mapping, sect_debugline), pe_get_sect_size(sect_debugline),
|
||||
pe_get_sect(nth, mapping, sect_debugloc), pe_get_sect_size(sect_debugloc));
|
||||
}
|
||||
ret = dwarf2_parse(module,
|
||||
module->module.BaseOfImage - fmap->u.pe.ntheader.OptionalHeader.ImageBase,
|
||||
NULL, /* FIXME: some thunks to deal with ? */
|
||||
fmap);
|
||||
TRACE("%s the DWARF debug info\n", ret ? "successfully loaded" : "failed to load");
|
||||
|
||||
return ret;
|
||||
|
@ -314,19 +513,21 @@ static BOOL pe_load_dbg_file(const struct process* pcs, struct module* module,
|
|||
*
|
||||
* Process MSC debug information in PE file.
|
||||
*/
|
||||
static BOOL pe_load_msc_debug_info(const struct process* pcs,
|
||||
struct module* module,
|
||||
void* mapping, const IMAGE_NT_HEADERS* nth)
|
||||
static BOOL pe_load_msc_debug_info(const struct process* pcs, struct module* module)
|
||||
{
|
||||
struct image_file_map* fmap = &module->format_info[DFI_PE]->u.pe_info->fmap;
|
||||
BOOL ret = FALSE;
|
||||
const IMAGE_DATA_DIRECTORY* dir;
|
||||
const IMAGE_DEBUG_DIRECTORY*dbg = NULL;
|
||||
int nDbg;
|
||||
void* mapping;
|
||||
IMAGE_NT_HEADERS* nth;
|
||||
|
||||
if (!(mapping = pe_map_full(fmap, &nth))) return FALSE;
|
||||
/* Read in debug directory */
|
||||
dir = nth->OptionalHeader.DataDirectory + IMAGE_DIRECTORY_ENTRY_DEBUG;
|
||||
nDbg = dir->Size / sizeof(IMAGE_DEBUG_DIRECTORY);
|
||||
if (!nDbg) return FALSE;
|
||||
if (!nDbg) goto done;
|
||||
|
||||
dbg = RtlImageRvaToVa(nth, mapping, dir->VirtualAddress, NULL);
|
||||
|
||||
|
@ -353,26 +554,29 @@ static BOOL pe_load_msc_debug_info(const struct process* pcs,
|
|||
const IMAGE_SECTION_HEADER *sectp = (const IMAGE_SECTION_HEADER*)((const char*)&nth->OptionalHeader + nth->FileHeader.SizeOfOptionalHeader);
|
||||
/* Debug info is embedded into PE module */
|
||||
ret = pe_load_debug_directory(pcs, module, mapping, sectp,
|
||||
nth->FileHeader.NumberOfSections, dbg, nDbg);
|
||||
nth->FileHeader.NumberOfSections, dbg, nDbg);
|
||||
}
|
||||
|
||||
done:
|
||||
pe_unmap_full(fmap);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* pe_load_export_debug_info
|
||||
*/
|
||||
static BOOL pe_load_export_debug_info(const struct process* pcs,
|
||||
struct module* module,
|
||||
void* mapping, const IMAGE_NT_HEADERS* nth)
|
||||
static BOOL pe_load_export_debug_info(const struct process* pcs, struct module* module)
|
||||
{
|
||||
struct image_file_map* fmap = &module->format_info[DFI_PE]->u.pe_info->fmap;
|
||||
unsigned int i;
|
||||
const IMAGE_EXPORT_DIRECTORY* exports;
|
||||
DWORD base = module->module.BaseOfImage;
|
||||
DWORD size;
|
||||
IMAGE_NT_HEADERS* nth;
|
||||
void* mapping;
|
||||
|
||||
if (dbghelp_options & SYMOPT_NO_PUBLICS) return TRUE;
|
||||
|
||||
if (!(mapping = pe_map_full(fmap, &nth))) return FALSE;
|
||||
#if 0
|
||||
/* Add start of DLL (better use the (yet unimplemented) Exe SymTag for this) */
|
||||
/* FIXME: module.ModuleName isn't correctly set yet if it's passed in SymLoadModule */
|
||||
|
@ -435,6 +639,8 @@ static BOOL pe_load_export_debug_info(const struct process* pcs,
|
|||
/* no real debug info, only entry points */
|
||||
if (module->module.SymType == SymDeferred)
|
||||
module->module.SymType = SymExport;
|
||||
pe_unmap_full(fmap);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -445,39 +651,21 @@ static BOOL pe_load_export_debug_info(const struct process* pcs,
|
|||
BOOL pe_load_debug_info(const struct process* pcs, struct module* module)
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
HANDLE hFile;
|
||||
HANDLE hMap;
|
||||
void* mapping;
|
||||
IMAGE_NT_HEADERS* nth;
|
||||
|
||||
hFile = CreateFileW(module->module.LoadedImageName, GENERIC_READ, FILE_SHARE_READ,
|
||||
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (hFile == INVALID_HANDLE_VALUE) return ret;
|
||||
if ((hMap = CreateFileMappingW(hFile, NULL, PAGE_READONLY, 0, 0, NULL)) != 0)
|
||||
if (!(dbghelp_options & SYMOPT_PUBLICS_ONLY))
|
||||
{
|
||||
if ((mapping = MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0)) != NULL)
|
||||
{
|
||||
nth = RtlImageNtHeader(mapping);
|
||||
|
||||
if (!(dbghelp_options & SYMOPT_PUBLICS_ONLY))
|
||||
{
|
||||
ret = pe_load_stabs(pcs, module, mapping, nth) ||
|
||||
pe_load_dwarf(pcs, module, mapping, nth) ||
|
||||
pe_load_msc_debug_info(pcs, module, mapping, nth) ||
|
||||
pe_load_coff_symbol_table(module, nth, mapping);
|
||||
/* if we still have no debug info (we could only get SymExport at this
|
||||
* point), then do the SymExport except if we have an ELF container,
|
||||
* in which case we'll rely on the export's on the ELF side
|
||||
*/
|
||||
}
|
||||
/* FIXME shouldn't we check that? if (!module_get_debug(pcs, module))l */
|
||||
if (pe_load_export_debug_info(pcs, module, mapping, nth) && !ret)
|
||||
ret = TRUE;
|
||||
UnmapViewOfFile(mapping);
|
||||
}
|
||||
CloseHandle(hMap);
|
||||
ret = pe_load_stabs(pcs, module);
|
||||
ret = pe_load_dwarf(module) || ret;
|
||||
ret = pe_load_msc_debug_info(pcs, module) || ret;
|
||||
ret = ret || pe_load_coff_symbol_table(module); /* FIXME */
|
||||
/* if we still have no debug info (we could only get SymExport at this
|
||||
* point), then do the SymExport except if we have an ELF container,
|
||||
* in which case we'll rely on the export's on the ELF side
|
||||
*/
|
||||
}
|
||||
CloseHandle(hFile);
|
||||
/* FIXME shouldn't we check that? if (!module_get_debug(pcs, module)) */
|
||||
if (pe_load_export_debug_info(pcs, module) && !ret)
|
||||
ret = TRUE;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -489,15 +677,14 @@ BOOL pe_load_debug_info(const struct process* pcs, struct module* module)
|
|||
struct module* pe_load_native_module(struct process* pcs, const WCHAR* name,
|
||||
HANDLE hFile, DWORD base, DWORD size)
|
||||
{
|
||||
struct module* module = NULL;
|
||||
BOOL opened = FALSE;
|
||||
HANDLE hMap;
|
||||
WCHAR loaded_name[MAX_PATH];
|
||||
struct module* module = NULL;
|
||||
BOOL opened = FALSE;
|
||||
struct module_format* modfmt;
|
||||
WCHAR loaded_name[MAX_PATH];
|
||||
|
||||
loaded_name[0] = '\0';
|
||||
if (!hFile)
|
||||
{
|
||||
|
||||
assert(name);
|
||||
|
||||
if ((hFile = FindExecutableImageExW(name, pcs->search_path, loaded_name, NULL, NULL)) == NULL)
|
||||
|
@ -507,37 +694,37 @@ struct module* pe_load_native_module(struct process* pcs, const WCHAR* name,
|
|||
else if (name) strcpyW(loaded_name, name);
|
||||
else if (dbghelp_options & SYMOPT_DEFERRED_LOADS)
|
||||
FIXME("Trouble ahead (no module name passed in deferred mode)\n");
|
||||
|
||||
if ((hMap = CreateFileMappingW(hFile, NULL, PAGE_READONLY, 0, 0, NULL)) != NULL)
|
||||
if (!(modfmt = HeapAlloc(GetProcessHeap(), 0, sizeof(struct module_format) + sizeof(struct pe_module_info))))
|
||||
return NULL;
|
||||
modfmt->u.pe_info = (struct pe_module_info*)(modfmt + 1);
|
||||
if (pe_map_file(hFile, &modfmt->u.pe_info->fmap, DMT_PE))
|
||||
{
|
||||
void* mapping;
|
||||
if (!base) base = modfmt->u.pe_info->fmap.u.pe.ntheader.OptionalHeader.ImageBase;
|
||||
if (!size) size = modfmt->u.pe_info->fmap.u.pe.ntheader.OptionalHeader.SizeOfImage;
|
||||
|
||||
if ((mapping = MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0)) != NULL)
|
||||
module = module_new(pcs, loaded_name, DMT_PE, FALSE, base, size,
|
||||
modfmt->u.pe_info->fmap.u.pe.ntheader.FileHeader.TimeDateStamp,
|
||||
modfmt->u.pe_info->fmap.u.pe.ntheader.OptionalHeader.CheckSum);
|
||||
if (module)
|
||||
{
|
||||
IMAGE_NT_HEADERS* nth = RtlImageNtHeader(mapping);
|
||||
modfmt->module = module;
|
||||
modfmt->remove = pe_module_remove;
|
||||
modfmt->loc_compute = NULL;
|
||||
|
||||
if (nth)
|
||||
{
|
||||
if (!base) base = nth->OptionalHeader.ImageBase;
|
||||
if (!size) size = nth->OptionalHeader.SizeOfImage;
|
||||
|
||||
module = module_new(pcs, loaded_name, DMT_PE, FALSE, base, size,
|
||||
nth->FileHeader.TimeDateStamp,
|
||||
nth->OptionalHeader.CheckSum);
|
||||
if (module)
|
||||
{
|
||||
if (dbghelp_options & SYMOPT_DEFERRED_LOADS)
|
||||
module->module.SymType = SymDeferred;
|
||||
else
|
||||
pe_load_debug_info(pcs, module);
|
||||
}
|
||||
else
|
||||
ERR("could not load the module '%s'\n", debugstr_w(loaded_name));
|
||||
}
|
||||
UnmapViewOfFile(mapping);
|
||||
module->format_info[DFI_PE] = modfmt;
|
||||
if (dbghelp_options & SYMOPT_DEFERRED_LOADS)
|
||||
module->module.SymType = SymDeferred;
|
||||
else
|
||||
pe_load_debug_info(pcs, module);
|
||||
}
|
||||
else
|
||||
{
|
||||
ERR("could not load the module '%s'\n", debugstr_w(loaded_name));
|
||||
pe_unmap_file(&modfmt->u.pe_info->fmap);
|
||||
}
|
||||
CloseHandle(hMap);
|
||||
}
|
||||
if (!module) HeapFree(GetProcessHeap(), 0, modfmt);
|
||||
|
||||
if (opened) CloseHandle(hFile);
|
||||
|
||||
return module;
|
||||
|
|
|
@ -693,8 +693,20 @@ static void symt_fill_sym_info(struct module_pair* pair,
|
|||
struct location loc = data->u.var;
|
||||
|
||||
if (loc.kind >= loc_user)
|
||||
pair->effective->loc_compute(pair->pcs, pair->effective, func, &loc);
|
||||
{
|
||||
unsigned i;
|
||||
struct module_format* modfmt;
|
||||
|
||||
for (i = 0; i < DFI_LAST; i++)
|
||||
{
|
||||
modfmt = pair->effective->format_info[i];
|
||||
if (modfmt && modfmt->loc_compute)
|
||||
{
|
||||
modfmt->loc_compute(pair->pcs, modfmt, func, &loc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (loc.kind)
|
||||
{
|
||||
case loc_error:
|
||||
|
|
|
@ -52,6 +52,15 @@ HRESULT WINAPI CreateInstallReferenceEnum(IInstallReferenceEnum **ppRefEnum,
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* CreateApplicationContext (FUSION.@)
|
||||
*/
|
||||
HRESULT WINAPI CreateApplicationContext(IAssemblyName *name, void *ctx)
|
||||
{
|
||||
FIXME("%p, %p\n", name, ctx);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT (WINAPI *pGetCORVersion)(LPWSTR pbuffer, DWORD cchBuffer,
|
||||
DWORD *dwLength);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
@ stub CopyPDBs
|
||||
@ stdcall ClearDownloadCache()
|
||||
@ stub CreateApplicationContext
|
||||
@ stdcall CreateApplicationContext(ptr ptr)
|
||||
@ stdcall CreateAssemblyCache(ptr long)
|
||||
@ stdcall CreateAssemblyEnum(ptr ptr ptr long ptr)
|
||||
@ stdcall CreateAssemblyNameObject(ptr wstr long ptr)
|
||||
|
|
|
@ -865,7 +865,10 @@ GpStatus WINGDIPAPI GdipCreateTextureIA(GpImage *image,
|
|||
|
||||
(*texture)->brush.gdibrush = CreateBrushIndirect(&(*texture)->brush.lb);
|
||||
(*texture)->brush.bt = BrushTypeTextureFill;
|
||||
(*texture)->wrap = imageattr->wrap;
|
||||
if (imageattr)
|
||||
(*texture)->wrap = imageattr->wrap;
|
||||
else
|
||||
(*texture)->wrap = WrapModeTile;
|
||||
(*texture)->image = new_image;
|
||||
|
||||
exit:
|
||||
|
|
|
@ -2108,6 +2108,8 @@ GpStatus WINGDIPAPI GdipGetMetafileHeaderFromMetafile(GpMetafile * metafile,
|
|||
if(!(calls++))
|
||||
FIXME("not implemented\n");
|
||||
|
||||
memset(header, 0, sizeof(MetafileHeader));
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
||||
|
@ -2194,6 +2196,7 @@ struct image_format_dimension image_format_dimensions[] =
|
|||
{NULL}
|
||||
};
|
||||
|
||||
/* FIXME: Need to handle multi-framed images */
|
||||
GpStatus WINGDIPAPI GdipImageGetFrameCount(GpImage *image,
|
||||
GDIPCONST GUID* dimensionID, UINT* count)
|
||||
{
|
||||
|
@ -2201,13 +2204,15 @@ GpStatus WINGDIPAPI GdipImageGetFrameCount(GpImage *image,
|
|||
|
||||
TRACE("(%p,%s,%p)\n", image, debugstr_guid(dimensionID), count);
|
||||
|
||||
if(!image || !dimensionID || !count)
|
||||
if(!image || !count)
|
||||
return InvalidParameter;
|
||||
|
||||
if(!(calls++))
|
||||
FIXME("not implemented\n");
|
||||
FIXME("returning frame count of 1\n");
|
||||
|
||||
return NotImplemented;
|
||||
*count = 1;
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipImageGetFrameDimensionsCount(GpImage *image,
|
||||
|
|
|
@ -155,6 +155,9 @@ static HRESULT WINAPI IHlinkBC_SetBrowseWindowInfo(IHlinkBrowseContext* iface,
|
|||
HlinkBCImpl *This = (HlinkBCImpl*)iface;
|
||||
TRACE("(%p)->(%p)\n", This, phlbwi);
|
||||
|
||||
if(!phlbwi)
|
||||
return E_INVALIDARG;
|
||||
|
||||
heap_free(This->BrowseWindowInfo);
|
||||
This->BrowseWindowInfo = heap_alloc(phlbwi->cbSize);
|
||||
memcpy(This->BrowseWindowInfo, phlbwi, phlbwi->cbSize);
|
||||
|
@ -165,8 +168,18 @@ static HRESULT WINAPI IHlinkBC_SetBrowseWindowInfo(IHlinkBrowseContext* iface,
|
|||
static HRESULT WINAPI IHlinkBC_GetBrowseWindowInfo(IHlinkBrowseContext* iface,
|
||||
HLBWINFO *phlbwi)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
HlinkBCImpl *This = (HlinkBCImpl*)iface;
|
||||
TRACE("(%p)->(%p)\n", This, phlbwi);
|
||||
|
||||
if(!phlbwi)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if(!This->BrowseWindowInfo)
|
||||
phlbwi->cbSize = 0;
|
||||
else
|
||||
memcpy(phlbwi, This->BrowseWindowInfo, This->BrowseWindowInfo->cbSize);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IHlinkBC_SetInitialHlink(IHlinkBrowseContext* iface,
|
||||
|
|
|
@ -99,6 +99,8 @@ HRESULT WINAPI HlinkCreateFromString( LPCWSTR pwzTarget, LPCWSTR pwzLocation,
|
|||
{
|
||||
IHlink *hl = NULL;
|
||||
HRESULT r = S_OK;
|
||||
WCHAR *hash, *tgt;
|
||||
const WCHAR *loc;
|
||||
|
||||
TRACE("%s %s %s %p %i %p %s %p\n", debugstr_w(pwzTarget),
|
||||
debugstr_w(pwzLocation), debugstr_w(pwzFriendlyName), pihlsite,
|
||||
|
@ -108,8 +110,44 @@ HRESULT WINAPI HlinkCreateFromString( LPCWSTR pwzTarget, LPCWSTR pwzLocation,
|
|||
if (FAILED(r))
|
||||
return r;
|
||||
|
||||
IHlink_SetStringReference(hl, HLINKSETF_TARGET | HLINKSETF_LOCATION,
|
||||
pwzTarget, pwzLocation);
|
||||
if (pwzTarget)
|
||||
{
|
||||
hash = strchrW(pwzTarget, '#');
|
||||
if (hash)
|
||||
{
|
||||
if (hash == pwzTarget)
|
||||
tgt = NULL;
|
||||
else
|
||||
{
|
||||
int tgt_len = hash - pwzTarget;
|
||||
tgt = heap_alloc((tgt_len + 1) * sizeof(WCHAR));
|
||||
if (!tgt)
|
||||
return E_OUTOFMEMORY;
|
||||
memcpy(tgt, pwzTarget, tgt_len * sizeof(WCHAR));
|
||||
tgt[tgt_len] = 0;
|
||||
}
|
||||
if (!pwzLocation)
|
||||
loc = hash + 1;
|
||||
else
|
||||
loc = pwzLocation;
|
||||
}
|
||||
else
|
||||
{
|
||||
tgt = hlink_strdupW(pwzTarget);
|
||||
if (!tgt)
|
||||
return E_OUTOFMEMORY;
|
||||
loc = pwzLocation;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tgt = NULL;
|
||||
loc = pwzLocation;
|
||||
}
|
||||
|
||||
IHlink_SetStringReference(hl, HLINKSETF_TARGET | HLINKSETF_LOCATION, tgt, loc);
|
||||
|
||||
heap_free(tgt);
|
||||
|
||||
if (pwzFriendlyName)
|
||||
IHlink_SetFriendlyName(hl, pwzFriendlyName);
|
||||
|
|
|
@ -291,7 +291,9 @@ static HRESULT WINAPI IHlink_fnSetStringReference(IHlink* iface,
|
|||
if (grfHLSETF & HLINKSETF_LOCATION)
|
||||
{
|
||||
heap_free(This->Location);
|
||||
This->Location = hlink_strdupW( pwzLocation );
|
||||
This->Location = NULL;
|
||||
if (pwzLocation && *pwzLocation)
|
||||
This->Location = hlink_strdupW( pwzLocation );
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
# include <resolv.h>
|
||||
#endif
|
||||
|
||||
#undef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x500
|
||||
#define WIN32_NO_STATUS
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
|
|
|
@ -58,7 +58,7 @@ NTAPI
|
|||
RtlAllocateHeap (
|
||||
HANDLE Heap,
|
||||
ULONG Flags,
|
||||
ULONG Size
|
||||
SIZE_T Size
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
|
|
|
@ -402,6 +402,12 @@ DllMain(HANDLE hDll,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
#undef InterlockedIncrement
|
||||
#undef InterlockedDecrement
|
||||
#undef InterlockedExchange
|
||||
#undef InterlockedExchangeAdd
|
||||
#undef InterlockedCompareExchange
|
||||
|
||||
LONG
|
||||
WINAPI
|
||||
InterlockedIncrement(IN OUT LONG volatile *lpAddend)
|
||||
|
|
|
@ -400,11 +400,11 @@ TH32CreateSnapshotSectionInitialize(DWORD dwFlags,
|
|||
|
||||
ProcessListEntry->dwSize = sizeof(PROCESSENTRY32W);
|
||||
ProcessListEntry->cntUsage = 0; /* no longer used */
|
||||
ProcessListEntry->th32ProcessID = (ULONG)ProcessInfo->UniqueProcessId;
|
||||
ProcessListEntry->th32ProcessID = (ULONG_PTR)ProcessInfo->UniqueProcessId;
|
||||
ProcessListEntry->th32DefaultHeapID = 0; /* no longer used */
|
||||
ProcessListEntry->th32ModuleID = 0; /* no longer used */
|
||||
ProcessListEntry->cntThreads = ProcessInfo->NumberOfThreads;
|
||||
ProcessListEntry->th32ParentProcessID = (ULONG)ProcessInfo->InheritedFromUniqueProcessId;
|
||||
ProcessListEntry->th32ParentProcessID = (ULONG_PTR)ProcessInfo->InheritedFromUniqueProcessId;
|
||||
ProcessListEntry->pcPriClassBase = ProcessInfo->BasePriority;
|
||||
ProcessListEntry->dwFlags = 0; /* no longer used */
|
||||
if(ProcessInfo->ImageName.Buffer != NULL)
|
||||
|
@ -447,8 +447,8 @@ TH32CreateSnapshotSectionInitialize(DWORD dwFlags,
|
|||
{
|
||||
ThreadListEntry->dwSize = sizeof(THREADENTRY32);
|
||||
ThreadListEntry->cntUsage = 0; /* no longer used */
|
||||
ThreadListEntry->th32ThreadID = (ULONG)ThreadInfo->ClientId.UniqueThread;
|
||||
ThreadListEntry->th32OwnerProcessID = (ULONG)ThreadInfo->ClientId.UniqueProcess;
|
||||
ThreadListEntry->th32ThreadID = (ULONG_PTR)ThreadInfo->ClientId.UniqueThread;
|
||||
ThreadListEntry->th32OwnerProcessID = (ULONG_PTR)ThreadInfo->ClientId.UniqueProcess;
|
||||
ThreadListEntry->tpBasePri = ThreadInfo->BasePriority;
|
||||
ThreadListEntry->tpDeltaPri = 0; /* no longer used */
|
||||
ThreadListEntry->dwFlags = 0; /* no longer used */
|
||||
|
|
|
@ -55,4 +55,30 @@ InitializeCriticalSectionAndSpinCount(OUT LPCRITICAL_SECTION lpCriticalSection,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL WINAPI InitializeCriticalSectionEx(OUT LPCRITICAL_SECTION lpCriticalSection,
|
||||
IN DWORD dwSpinCount,
|
||||
IN DWORD flags )
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
/* FIXME: Flags ignored */
|
||||
|
||||
/* Initialize the critical section */
|
||||
Status = RtlInitializeCriticalSectionAndSpinCount(
|
||||
(PRTL_CRITICAL_SECTION)lpCriticalSection,
|
||||
dwSpinCount);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* Set failure code */
|
||||
SetLastErrorByStatus(Status);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Success */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -47,9 +47,9 @@ ConvertFiberToThread(VOID)
|
|||
pTeb->HasFiberData = FALSE;
|
||||
|
||||
/* free the fiber */
|
||||
if (pTeb->Tib.FiberData != NULL)
|
||||
if(pTeb->NtTib.FiberData != NULL)
|
||||
{
|
||||
RtlFreeHeap(GetProcessHeap(), 0, pTeb->Tib.FiberData);
|
||||
RtlFreeHeap(GetProcessHeap(), 0, pTeb->NtTib.FiberData);
|
||||
}
|
||||
|
||||
/* success */
|
||||
|
@ -69,7 +69,7 @@ ConvertThreadToFiberEx(LPVOID lpParameter,
|
|||
DPRINT1("Converting Thread to Fiber\n");
|
||||
|
||||
/* the current thread is already a fiber */
|
||||
if(pTeb->HasFiberData && pTeb->Tib.FiberData) return pTeb->Tib.FiberData;
|
||||
if(pTeb->HasFiberData && pTeb->NtTib.FiberData) return pTeb->NtTib.FiberData;
|
||||
|
||||
/* allocate the fiber */
|
||||
pfCurFiber = (PFIBER)RtlAllocateHeap(GetProcessHeap(),
|
||||
|
@ -85,9 +85,9 @@ ConvertThreadToFiberEx(LPVOID lpParameter,
|
|||
|
||||
/* copy some contextual data from the thread to the fiber */
|
||||
pfCurFiber->Parameter = lpParameter;
|
||||
pfCurFiber->ExceptionList = pTeb->Tib.ExceptionList;
|
||||
pfCurFiber->StackBase = pTeb->Tib.StackBase;
|
||||
pfCurFiber->StackLimit = pTeb->Tib.StackLimit;
|
||||
pfCurFiber->ExceptionList = pTeb->NtTib.ExceptionList;
|
||||
pfCurFiber->StackBase = pTeb->NtTib.StackBase;
|
||||
pfCurFiber->StackLimit = pTeb->NtTib.StackLimit;
|
||||
pfCurFiber->DeallocationStack = pTeb->DeallocationStack;
|
||||
pfCurFiber->FlsData = pTeb->FlsData;
|
||||
pfCurFiber->GuaranteedStackBytes = pTeb->GuaranteedStackBytes;
|
||||
|
@ -101,7 +101,7 @@ ConvertThreadToFiberEx(LPVOID lpParameter,
|
|||
}
|
||||
|
||||
/* associate the fiber to the current thread */
|
||||
pTeb->Tib.FiberData = pfCurFiber;
|
||||
pTeb->NtTib.FiberData = pfCurFiber;
|
||||
pTeb->HasFiberData = TRUE;
|
||||
|
||||
/* success */
|
||||
|
@ -227,7 +227,7 @@ DeleteFiber(LPVOID lpFiber)
|
|||
RtlFreeHeap(GetProcessHeap(), 0, lpFiber);
|
||||
|
||||
/* the fiber is deleting itself: let the system deallocate the stack */
|
||||
if(NtCurrentTeb()->Tib.FiberData == lpFiber) ExitThread(1);
|
||||
if(NtCurrentTeb()->NtTib.FiberData == lpFiber) ExitThread(1);
|
||||
|
||||
/* deallocate the stack */
|
||||
NtFreeVirtualMemory(NtCurrentProcess(),
|
||||
|
|
|
@ -72,4 +72,3 @@ FONT 8, "MS Shell Dlg"
|
|||
PUSHBUTTON "OK", IDOK, 40, 65, 45, 15, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
|
||||
PUSHBUTTON "Abbrechen", IDCANCEL, 115, 65, 45, 15, WS_GROUP | WS_TABSTOP
|
||||
}
|
||||
#pragma code_page(default)
|
||||
|
|
|
@ -72,4 +72,3 @@ FONT 8, "MS Shell Dlg"
|
|||
PUSHBUTTON "OK", IDOK, 40, 65, 45, 15, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
|
||||
PUSHBUTTON "Annuler", IDCANCEL, 115, 65, 45, 15, WS_GROUP | WS_TABSTOP
|
||||
}
|
||||
#pragma code_page(default)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue