mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 12:23:31 +00:00
Sync with trunk head.
svn path=/branches/header-work/; revision=46444
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly
|
||||
xmlns="urn:schemas-microsoft-com:asm.v1"
|
||||
manifestVersion="1.0">
|
||||
<assemblyIdentity
|
||||
name="DevCpp.Apps.Paint"
|
||||
processorArchitecture="amd64"
|
||||
version="1.0.0.0"
|
||||
type="win32"/>
|
||||
<description>Paint</description>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="amd64"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
</assembly>
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
{
|
||||
@@ -88,7 +90,6 @@ CControlNode::QueryInterface(
|
||||
HRESULT
|
||||
WINAPI
|
||||
CControlNode_fnConstructor(
|
||||
HANDLE hFile,
|
||||
IBaseFilter * pFilter,
|
||||
ULONG NodeType,
|
||||
ULONG PinId,
|
||||
@@ -99,6 +100,7 @@ CControlNode_fnConstructor(
|
||||
HRESULT hr;
|
||||
IPin * pPin = NULL;
|
||||
IKsObject * pObject = NULL;
|
||||
HANDLE hFile = INVALID_HANDLE_VALUE;
|
||||
|
||||
// store pin id
|
||||
swprintf(Buffer, L"%u", PinId);
|
||||
|
||||
@@ -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
|
||||
@@ -476,7 +480,7 @@ CBDADeviceControl::GetControlNode(ULONG ulInputPinId, ULONG ulOutputPinId, ULONG
|
||||
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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
@@ -73,15 +77,6 @@ CBDAPinControl::QueryInterface(
|
||||
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
|
||||
|
||||
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,26 +241,13 @@ 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;
|
||||
@@ -209,8 +279,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 +296,73 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 +370,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;
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
@@ -101,4 +101,6 @@ CBDADigitalDemodulator_fnConstructor(
|
||||
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
|
||||
{
|
||||
|
||||
@@ -0,0 +1,624 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS WDM Streaming ActiveMovie Proxy
|
||||
* FILE: dll/directx/ksproxy/allocator.cpp
|
||||
* PURPOSE: IKsAllocator interface
|
||||
*
|
||||
* PROGRAMMERS: Johannes Anderwald ([email protected])
|
||||
*/
|
||||
#include "precomp.h"
|
||||
|
||||
const GUID IID_IKsAllocatorEx = {0x091bb63a, 0x603f, 0x11d1, {0xb0, 0x67, 0x00, 0xa0, 0xc9, 0x06, 0x28, 0x02}};
|
||||
const GUID IID_IKsAllocator = {0x8da64899, 0xc0d9, 0x11d0, {0x84, 0x13, 0x00, 0x00, 0xf8, 0x22, 0xfe, 0x8a}};
|
||||
|
||||
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()
|
||||
{
|
||||
InterlockedIncrement(&m_Ref);
|
||||
return m_Ref;
|
||||
}
|
||||
STDMETHODIMP_(ULONG) Release()
|
||||
{
|
||||
InterlockedDecrement(&m_Ref);
|
||||
|
||||
if (!m_Ref)
|
||||
{
|
||||
delete this;
|
||||
return 0;
|
||||
}
|
||||
return m_Ref;
|
||||
}
|
||||
//IKsAllocator
|
||||
HANDLE STDMETHODCALLTYPE KsGetAllocatorHandle();
|
||||
KSALLOCATORMODE STDMETHODCALLTYPE KsGetAllocatorMode();
|
||||
HRESULT STDMETHODCALLTYPE KsGetAllocatorStatus(PKSSTREAMALLOCATOR_STATUS AllocatorStatus);
|
||||
VOID STDMETHODCALLTYPE KsSetAllocatorMode(KSALLOCATORMODE Mode);
|
||||
|
||||
//IKsAllocatorEx
|
||||
PALLOCATOR_PROPERTIES_EX STDMETHODCALLTYPE KsGetProperties();
|
||||
VOID STDMETHODCALLTYPE KsSetProperties(PALLOCATOR_PROPERTIES_EX Properties);
|
||||
VOID STDMETHODCALLTYPE KsSetAllocatorHandle(HANDLE AllocatorHandle);
|
||||
HANDLE STDMETHODCALLTYPE KsCreateAllocatorAndGetHandle(IKsPin* KsPin);
|
||||
|
||||
//IMemAllocator
|
||||
HRESULT STDMETHODCALLTYPE SetProperties(ALLOCATOR_PROPERTIES *pRequest, ALLOCATOR_PROPERTIES *pActual);
|
||||
HRESULT STDMETHODCALLTYPE GetProperties(ALLOCATOR_PROPERTIES *pProps);
|
||||
HRESULT STDMETHODCALLTYPE Commit();
|
||||
HRESULT STDMETHODCALLTYPE Decommit();
|
||||
HRESULT STDMETHODCALLTYPE GetBuffer(IMediaSample **ppBuffer, REFERENCE_TIME *pStartTime, REFERENCE_TIME *pEndTime, DWORD dwFlags);
|
||||
HRESULT STDMETHODCALLTYPE ReleaseBuffer(IMediaSample *pBuffer);
|
||||
|
||||
//IMemAllocatorCallbackTemp
|
||||
HRESULT STDMETHODCALLTYPE SetNotify(IMemAllocatorNotifyCallbackTemp *pNotify);
|
||||
HRESULT STDMETHODCALLTYPE GetFreeCount(LONG *plBuffersFree);
|
||||
|
||||
|
||||
CKsAllocator();
|
||||
virtual ~CKsAllocator(){}
|
||||
VOID STDMETHODCALLTYPE FreeMediaSamples();
|
||||
protected:
|
||||
LONG m_Ref;
|
||||
HANDLE m_hAllocator;
|
||||
KSALLOCATORMODE m_Mode;
|
||||
ALLOCATOR_PROPERTIES_EX m_Properties;
|
||||
IMemAllocatorNotifyCallbackTemp *m_Notify;
|
||||
ULONG m_Allocated;
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CKsAllocator::QueryInterface(
|
||||
IN REFIID refiid,
|
||||
OUT PVOID* Output)
|
||||
{
|
||||
if (IsEqualGUID(refiid, IID_IUnknown) ||
|
||||
IsEqualGUID(refiid, IID_IKsAllocator) ||
|
||||
IsEqualGUID(refiid, IID_IKsAllocatorEx))
|
||||
{
|
||||
*Output = PVOID(this);
|
||||
reinterpret_cast<IUnknown*>(*Output)->AddRef();
|
||||
return NOERROR;
|
||||
}
|
||||
if (IsEqualGUID(refiid, IID_IMemAllocator) ||
|
||||
IsEqualGUID(refiid, IID_IMemAllocatorCallbackTemp))
|
||||
{
|
||||
*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
|
||||
//
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CKsAllocator::SetProperties(
|
||||
ALLOCATOR_PROPERTIES *pRequest,
|
||||
ALLOCATOR_PROPERTIES *pActual)
|
||||
{
|
||||
SYSTEM_INFO SystemInfo;
|
||||
|
||||
EnterCriticalSection(&m_CriticalSection);
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsAllocator::SetProperties\n");
|
||||
#endif
|
||||
|
||||
if (!pRequest || !pActual)
|
||||
return E_POINTER;
|
||||
|
||||
// zero output properties
|
||||
ZeroMemory(pActual, sizeof(ALLOCATOR_PROPERTIES));
|
||||
|
||||
// get system info
|
||||
GetSystemInfo(&SystemInfo);
|
||||
|
||||
if (!pRequest->cbAlign || (pRequest->cbAlign - 1) & SystemInfo.dwAllocationGranularity)
|
||||
{
|
||||
// bad alignment
|
||||
LeaveCriticalSection(&m_CriticalSection);
|
||||
return VFW_E_BADALIGN;
|
||||
}
|
||||
|
||||
if (m_Mode == KsAllocatorMode_Kernel)
|
||||
{
|
||||
// u can't change a kernel allocator
|
||||
LeaveCriticalSection(&m_CriticalSection);
|
||||
return VFW_E_ALREADY_COMMITTED;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
pActual->cbAlign = m_cbAlign = pRequest->cbAlign;
|
||||
pActual->cbBuffer = m_cbBuffer = pRequest->cbBuffer;
|
||||
pActual->cbPrefix = m_cbPrefix = pRequest->cbPrefix;
|
||||
pActual->cBuffers = m_cBuffers = pRequest->cBuffers;
|
||||
|
||||
LeaveCriticalSection(&m_CriticalSection);
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CKsAllocator::GetProperties(
|
||||
ALLOCATOR_PROPERTIES *pProps)
|
||||
{
|
||||
if (!pProps)
|
||||
return E_POINTER;
|
||||
|
||||
pProps->cbBuffer = m_cbBuffer;
|
||||
pProps->cBuffers = m_cBuffers;
|
||||
pProps->cbAlign = m_cbAlign;
|
||||
pProps->cbPrefix = m_cbPrefix;
|
||||
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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 */
|
||||
LeaveCriticalSection(&m_CriticalSection);
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CKsAllocator::GetBuffer(
|
||||
IMediaSample **ppBuffer,
|
||||
REFERENCE_TIME *pStartTime,
|
||||
REFERENCE_TIME *pEndTime,
|
||||
DWORD dwFlags)
|
||||
{
|
||||
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
|
||||
STDMETHODCALLTYPE
|
||||
CKsAllocator::ReleaseBuffer(
|
||||
IMediaSample *pBuffer)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// IMemAllocatorCallbackTemp
|
||||
//
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CKsAllocator::SetNotify(
|
||||
IMemAllocatorNotifyCallbackTemp *pNotify)
|
||||
{
|
||||
EnterCriticalSection(&m_CriticalSection);
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsAllocator::SetNotify\n");
|
||||
#endif
|
||||
|
||||
if (pNotify)
|
||||
pNotify->AddRef();
|
||||
|
||||
if (m_Notify)
|
||||
m_Notify->Release();
|
||||
|
||||
m_Notify = pNotify;
|
||||
|
||||
LeaveCriticalSection(&m_CriticalSection);
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CKsAllocator::GetFreeCount(
|
||||
LONG *plBuffersFree)
|
||||
{
|
||||
*plBuffersFree = m_Allocated - m_FreeList.size();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// IKsAllocator
|
||||
//
|
||||
HANDLE
|
||||
STDMETHODCALLTYPE
|
||||
CKsAllocator::KsGetAllocatorHandle()
|
||||
{
|
||||
return m_hAllocator;
|
||||
}
|
||||
|
||||
KSALLOCATORMODE
|
||||
STDMETHODCALLTYPE
|
||||
CKsAllocator::KsGetAllocatorMode()
|
||||
{
|
||||
return m_Mode;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CKsAllocator::KsGetAllocatorStatus(
|
||||
PKSSTREAMALLOCATOR_STATUS AllocatorStatus)
|
||||
{
|
||||
return NOERROR;
|
||||
}
|
||||
VOID
|
||||
STDMETHODCALLTYPE
|
||||
CKsAllocator::KsSetAllocatorMode(
|
||||
KSALLOCATORMODE Mode)
|
||||
{
|
||||
m_Mode = Mode;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// IKsAllocatorEx
|
||||
//
|
||||
PALLOCATOR_PROPERTIES_EX
|
||||
STDMETHODCALLTYPE
|
||||
CKsAllocator::KsGetProperties()
|
||||
{
|
||||
return &m_Properties;
|
||||
}
|
||||
|
||||
VOID
|
||||
STDMETHODCALLTYPE
|
||||
CKsAllocator::KsSetProperties(
|
||||
PALLOCATOR_PROPERTIES_EX Properties)
|
||||
{
|
||||
CopyMemory(&m_Properties, Properties, sizeof(ALLOCATOR_PROPERTIES_EX));
|
||||
}
|
||||
|
||||
VOID
|
||||
STDMETHODCALLTYPE
|
||||
CKsAllocator::KsSetAllocatorHandle(
|
||||
HANDLE AllocatorHandle)
|
||||
{
|
||||
m_hAllocator = AllocatorHandle;
|
||||
}
|
||||
|
||||
|
||||
HANDLE
|
||||
STDMETHODCALLTYPE
|
||||
CKsAllocator::KsCreateAllocatorAndGetHandle(
|
||||
IKsPin* KsPin)
|
||||
{
|
||||
HRESULT hr;
|
||||
IKsObject * pObject;
|
||||
KSALLOCATOR_FRAMING AllocatorFraming;
|
||||
HANDLE hPin;
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsAllocator::KsCreateAllocatorAndGetHandle\n");
|
||||
#endif
|
||||
|
||||
if (m_hAllocator)
|
||||
{
|
||||
CloseHandle(m_hAllocator);
|
||||
m_hAllocator = NULL;
|
||||
}
|
||||
|
||||
// get pin IKsObject interface
|
||||
hr = KsPin->QueryInterface(IID_IKsObject, (void**)&pObject);
|
||||
if (FAILED(hr))
|
||||
return NULL;
|
||||
|
||||
// get pin handle
|
||||
hPin = pObject->KsGetObjectHandle();
|
||||
|
||||
//release IKsObject interface
|
||||
pObject->Release();
|
||||
|
||||
if (!hPin || hPin == INVALID_HANDLE_VALUE)
|
||||
return NULL;
|
||||
|
||||
//setup allocator framing
|
||||
AllocatorFraming.Frames = m_Properties.cBuffers;
|
||||
AllocatorFraming.FrameSize = m_Properties.cbBuffer;
|
||||
AllocatorFraming.FileAlignment = (m_Properties.cbAlign -1);
|
||||
AllocatorFraming.OptionsFlags = KSALLOCATOR_OPTIONF_SYSTEM_MEMORY;
|
||||
AllocatorFraming.PoolType = (m_Properties.LogicalMemoryType == KS_MemoryTypeKernelPaged);
|
||||
|
||||
DWORD dwError = KsCreateAllocator(hPin, &AllocatorFraming, &m_hAllocator);
|
||||
if (dwError)
|
||||
return NULL;
|
||||
|
||||
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(
|
||||
IUnknown * pUnkOuter,
|
||||
REFIID riid,
|
||||
LPVOID * ppv)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CKsAllocator_Constructor\n");
|
||||
#endif
|
||||
|
||||
CKsAllocator * handler = new CKsAllocator();
|
||||
|
||||
if (!handler)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
if (FAILED(handler->QueryInterface(riid, ppv)))
|
||||
{
|
||||
/* not supported */
|
||||
delete handler;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
return NOERROR;
|
||||
}
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -132,7 +132,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;
|
||||
@@ -185,6 +188,7 @@ protected:
|
||||
KSPIN_COMMUNICATION m_Communication;
|
||||
KSPIN_INTERFACE m_Interface;
|
||||
KSPIN_MEDIUM m_Medium;
|
||||
AM_MEDIA_TYPE m_MediaFormat;
|
||||
IPin * m_Pin;
|
||||
BOOL m_ReadOnly;
|
||||
IKsInterfaceHandler * m_InterfaceHandler;
|
||||
@@ -195,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),
|
||||
@@ -217,10 +220,28 @@ 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));
|
||||
hr = KsGetMediaType(0, &m_MediaFormat, hFilter, m_PinId);
|
||||
assert(hr == S_OK);
|
||||
}
|
||||
|
||||
HRESULT
|
||||
@@ -229,6 +250,8 @@ CInputPin::QueryInterface(
|
||||
IN REFIID refiid,
|
||||
OUT PVOID* Output)
|
||||
{
|
||||
WCHAR Buffer[100];
|
||||
|
||||
*Output = NULL;
|
||||
|
||||
if (IsEqualGUID(refiid, IID_IUnknown) ||
|
||||
@@ -240,6 +263,13 @@ CInputPin::QueryInterface(
|
||||
}
|
||||
else if (IsEqualGUID(refiid, IID_IMemInputPin))
|
||||
{
|
||||
if (m_hPin == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
HRESULT hr = CreatePin(&m_MediaFormat);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
}
|
||||
|
||||
*Output = (IMemInputPin*)(this);
|
||||
reinterpret_cast<IMemInputPin*>(*Output)->AddRef();
|
||||
return NOERROR;
|
||||
@@ -252,6 +282,13 @@ CInputPin::QueryInterface(
|
||||
}
|
||||
else if (IsEqualGUID(refiid, IID_IKsPropertySet))
|
||||
{
|
||||
if (m_hPin == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
HRESULT hr = CreatePin(&m_MediaFormat);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
}
|
||||
|
||||
*Output = (IKsPropertySet*)(this);
|
||||
reinterpret_cast<IKsPropertySet*>(*Output)->AddRef();
|
||||
return NOERROR;
|
||||
@@ -308,7 +345,6 @@ CInputPin::QueryInterface(
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
WCHAR Buffer[MAX_PATH];
|
||||
LPOLESTR lpstr;
|
||||
StringFromCLSID(refiid, &lpstr);
|
||||
swprintf(Buffer, L"CInputPin::QueryInterface: NoInterface for %s\n", lpstr);
|
||||
@@ -326,7 +362,10 @@ CInputPin::Notify(
|
||||
IBaseFilter *pSelf,
|
||||
Quality q)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::Notify NotImplemented\n");
|
||||
#endif
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
@@ -335,7 +374,10 @@ STDMETHODCALLTYPE
|
||||
CInputPin::SetSink(
|
||||
IQualityControl *piqc)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::SetSink NotImplemented\n");
|
||||
#endif
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
@@ -348,7 +390,10 @@ STDMETHODCALLTYPE
|
||||
CInputPin::KsAddAggregate(
|
||||
IN REFGUID AggregateClass)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::KsAddAggregate NotImplemented\n");
|
||||
#endif
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
@@ -357,7 +402,10 @@ STDMETHODCALLTYPE
|
||||
CInputPin::KsRemoveAggregate(
|
||||
REFGUID AggregateClass)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::KsRemoveAggregate NotImplemented\n");
|
||||
#endif
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
@@ -381,7 +429,10 @@ CInputPin::Backout(
|
||||
IPin *ppinOut,
|
||||
IGraphBuilder *pGraph)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::Backout\n");
|
||||
#endif
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -394,7 +445,10 @@ STDMETHODCALLTYPE
|
||||
CInputPin::KsPinFactory(
|
||||
ULONG* PinFactory)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::KsPinFactory\n");
|
||||
#endif
|
||||
|
||||
*PinFactory = m_PinId;
|
||||
return S_OK;
|
||||
}
|
||||
@@ -570,7 +624,10 @@ HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CInputPin::GetAllocator(IMemAllocator **ppAllocator)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::GetAllocator\n");
|
||||
#endif
|
||||
|
||||
return VFW_E_NO_ALLOCATOR;
|
||||
}
|
||||
|
||||
@@ -578,6 +635,17 @@ HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CInputPin::NotifyAllocator(IMemAllocator *pAllocator, BOOL bReadOnly)
|
||||
{
|
||||
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)
|
||||
{
|
||||
pAllocator->AddRef();
|
||||
@@ -613,17 +681,28 @@ CInputPin::GetAllocatorRequirements(ALLOCATOR_PROPERTIES *pProps)
|
||||
pProps->cbBuffer = Framing.FrameSize;
|
||||
pProps->cbAlign = Framing.FileAlignment;
|
||||
pProps->cbPrefix = 0;
|
||||
return hr;
|
||||
}
|
||||
else
|
||||
return E_NOTIMPL;
|
||||
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;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CInputPin::Receive(IMediaSample *pSample)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::Receive NotImplemented\n");
|
||||
DebugBreak();
|
||||
#endif
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
@@ -631,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;
|
||||
}
|
||||
|
||||
@@ -639,7 +722,11 @@ HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CInputPin::ReceiveCanBlock( void)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::ReceiveCanBlock NotImplemented\n");
|
||||
DebugBreak();
|
||||
#endif
|
||||
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
@@ -652,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
|
||||
@@ -660,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
|
||||
@@ -669,8 +786,7 @@ CInputPin::KsCreateSinkPinHandle(
|
||||
KSPIN_INTERFACE& Interface,
|
||||
KSPIN_MEDIUM& Medium)
|
||||
{
|
||||
OutputDebugStringW(L"CInputPin::KsCreateSinkPinHandle NotImplemented\n");
|
||||
return E_NOTIMPL;
|
||||
return CreatePin(&m_MediaFormat);
|
||||
}
|
||||
|
||||
HRESULT
|
||||
@@ -707,8 +823,25 @@ HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CInputPin::KsPropagateAcquire()
|
||||
{
|
||||
OutputDebugStringW(L"CInputPin::KsPropagateAcquire NotImplemented\n");
|
||||
return E_NOTIMPL;
|
||||
KSPROPERTY Property;
|
||||
KSSTATE State;
|
||||
ULONG BytesReturned;
|
||||
HRESULT hr;
|
||||
|
||||
assert(m_hPin != INVALID_HANDLE_VALUE);
|
||||
|
||||
Property.Set = KSPROPSETID_Connection;
|
||||
Property.Id = KSPROPERTY_CONNECTION_STATE;
|
||||
Property.Flags = KSPROPERTY_TYPE_SET;
|
||||
|
||||
State = KSSTATE_ACQUIRE;
|
||||
|
||||
hr = KsProperty(&Property, sizeof(KSPROPERTY), (LPVOID)&State, sizeof(KSSTATE), &BytesReturned);
|
||||
|
||||
//TODO
|
||||
//propagate to connected pin on the pipe
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
@@ -744,6 +877,7 @@ HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CInputPin::KsReceiveAllocator(IMemAllocator *MemAllocator)
|
||||
{
|
||||
|
||||
if (MemAllocator)
|
||||
{
|
||||
MemAllocator->AddRef();
|
||||
@@ -785,7 +919,11 @@ CInputPin::KsQualityNotify(
|
||||
ULONG Proportion,
|
||||
REFERENCE_TIME TimeDelta)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::KsQualityNotify NotImplemented\n");
|
||||
#endif
|
||||
|
||||
DebugBreak();
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
@@ -799,7 +937,9 @@ CInputPin::KsNotifyError(
|
||||
IMediaSample* Sample,
|
||||
HRESULT hr)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::KsNotifyError NotImplemented\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -815,7 +955,7 @@ CInputPin::KsProperty(
|
||||
ULONG DataLength,
|
||||
ULONG* BytesReturned)
|
||||
{
|
||||
assert(m_hPin != 0);
|
||||
assert(m_hPin != INVALID_HANDLE_VALUE);
|
||||
return KsSynchronousDeviceControl(m_hPin, IOCTL_KS_PROPERTY, (PVOID)Property, PropertyLength, (PVOID)PropertyData, DataLength, BytesReturned);
|
||||
}
|
||||
|
||||
@@ -828,7 +968,7 @@ CInputPin::KsMethod(
|
||||
ULONG DataLength,
|
||||
ULONG* BytesReturned)
|
||||
{
|
||||
assert(m_hPin != 0);
|
||||
assert(m_hPin != INVALID_HANDLE_VALUE);
|
||||
return KsSynchronousDeviceControl(m_hPin, IOCTL_KS_METHOD, (PVOID)Method, MethodLength, (PVOID)MethodData, DataLength, BytesReturned);
|
||||
}
|
||||
|
||||
@@ -841,7 +981,7 @@ CInputPin::KsEvent(
|
||||
ULONG DataLength,
|
||||
ULONG* BytesReturned)
|
||||
{
|
||||
assert(m_hPin != 0);
|
||||
assert(m_hPin != INVALID_HANDLE_VALUE);
|
||||
|
||||
if (EventLength)
|
||||
return KsSynchronousDeviceControl(m_hPin, IOCTL_KS_ENABLE_EVENT, (PVOID)Event, EventLength, (PVOID)EventData, DataLength, BytesReturned);
|
||||
@@ -972,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;
|
||||
}
|
||||
|
||||
@@ -1023,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
|
||||
@@ -1051,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
|
||||
@@ -1103,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;
|
||||
|
||||
@@ -1123,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
|
||||
@@ -1139,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;
|
||||
}
|
||||
|
||||
@@ -1178,60 +1352,49 @@ STDMETHODCALLTYPE
|
||||
CInputPin::CheckFormat(
|
||||
const AM_MEDIA_TYPE *pmt)
|
||||
{
|
||||
KSP_PIN Property;
|
||||
PKSMULTIPLE_ITEM MultipleItem;
|
||||
PKSDATAFORMAT DataFormat;
|
||||
ULONG BytesReturned;
|
||||
HRESULT hr;
|
||||
|
||||
// prepare request
|
||||
Property.Property.Set = KSPROPSETID_Pin;
|
||||
Property.Property.Id = KSPROPERTY_PIN_DATARANGES;
|
||||
Property.Property.Flags = KSPROPERTY_TYPE_GET;
|
||||
Property.PinId = m_PinId;
|
||||
Property.Reserved = 0;
|
||||
IKsObject * KsObjectParent;
|
||||
HANDLE hFilter;
|
||||
|
||||
if (!pmt)
|
||||
return E_POINTER;
|
||||
|
||||
// query for size of dataranges
|
||||
hr = KsSynchronousDeviceControl(m_hFilter, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSP_PIN), NULL, 0, &BytesReturned);
|
||||
hr = m_ParentFilter->QueryInterface(IID_IKsObject, (LPVOID*)&KsObjectParent);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_MORE_DATA))
|
||||
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;
|
||||
|
||||
DataFormat = (PKSDATAFORMAT)(MultipleItem + 1);
|
||||
for(ULONG Index = 0; Index < MultipleItem->Count; Index++)
|
||||
{
|
||||
// allocate dataranges buffer
|
||||
MultipleItem = (PKSMULTIPLE_ITEM)CoTaskMemAlloc(BytesReturned);
|
||||
|
||||
if (!MultipleItem)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
// query dataranges
|
||||
hr = KsSynchronousDeviceControl(m_hFilter, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSP_PIN), (PVOID)MultipleItem, BytesReturned, &BytesReturned);
|
||||
|
||||
if (FAILED(hr))
|
||||
if (IsEqualGUID(pmt->majortype, DataFormat->MajorFormat) &&
|
||||
IsEqualGUID(pmt->subtype, DataFormat->SubFormat) &&
|
||||
IsEqualGUID(pmt->formattype, DataFormat->Specifier))
|
||||
{
|
||||
// failed to query data ranges
|
||||
// format is supported
|
||||
CoTaskMemFree(MultipleItem);
|
||||
return hr;
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::CheckFormat format OK\n");
|
||||
#endif
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
DataFormat = (PKSDATAFORMAT)(MultipleItem + 1);
|
||||
for(ULONG Index = 0; Index < MultipleItem->Count; Index++)
|
||||
{
|
||||
if (IsEqualGUID(pmt->majortype, DataFormat->MajorFormat) &&
|
||||
IsEqualGUID(pmt->subtype, DataFormat->SubFormat) &&
|
||||
IsEqualGUID(pmt->formattype, DataFormat->Specifier))
|
||||
{
|
||||
// format is supported
|
||||
CoTaskMemFree(MultipleItem);
|
||||
OutputDebugStringW(L"CInputPin::CheckFormat format OK\n");
|
||||
return S_OK;
|
||||
}
|
||||
DataFormat = (PKSDATAFORMAT)((ULONG_PTR)DataFormat + DataFormat->FormatSize);
|
||||
}
|
||||
//format is not supported
|
||||
CoTaskMemFree(MultipleItem);
|
||||
DataFormat = (PKSDATAFORMAT)((ULONG_PTR)DataFormat + DataFormat->FormatSize);
|
||||
}
|
||||
//format is not supported
|
||||
CoTaskMemFree(MultipleItem);
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
@@ -1285,33 +1448,40 @@ CInputPin::CreatePin(
|
||||
|
||||
if (m_Communication != KSPIN_COMMUNICATION_BRIDGE && m_Communication != KSPIN_COMMUNICATION_NONE)
|
||||
{
|
||||
// now load the IKsInterfaceHandler plugin
|
||||
hr = CoCreateInstance(Interface->Set, NULL, CLSCTX_INPROC_SERVER, IID_IKsInterfaceHandler, (void**)&InterfaceHandler);
|
||||
if (FAILED(hr))
|
||||
if (!m_InterfaceHandler)
|
||||
{
|
||||
// failed to load interface handler plugin
|
||||
OutputDebugStringW(L"CInputPin::CreatePin failed to load InterfaceHandlerPlugin\n");
|
||||
CoTaskMemFree(MediumList);
|
||||
CoTaskMemFree(InterfaceList);
|
||||
// now load the IKsInterfaceHandler plugin
|
||||
hr = CoCreateInstance(Interface->Set, NULL, CLSCTX_INPROC_SERVER, IID_IKsInterfaceHandler, (void**)&InterfaceHandler);
|
||||
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);
|
||||
|
||||
return hr;
|
||||
return hr;
|
||||
}
|
||||
|
||||
// now set the pin
|
||||
hr = InterfaceHandler->KsSetPin((IKsPin*)this);
|
||||
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);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// store interface handler
|
||||
m_InterfaceHandler = InterfaceHandler;
|
||||
}
|
||||
|
||||
// now set the pin
|
||||
hr = InterfaceHandler->KsSetPin((IKsPin*)this);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
// failed to load interface handler plugin
|
||||
OutputDebugStringW(L"CInputPin::CreatePin failed to initialize InterfaceHandlerPlugin\n");
|
||||
InterfaceHandler->Release();
|
||||
CoTaskMemFree(MediumList);
|
||||
CoTaskMemFree(InterfaceList);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// store interface handler
|
||||
m_InterfaceHandler = InterfaceHandler;
|
||||
|
||||
// now create pin
|
||||
hr = CreatePinHandle(Medium, Interface, pmt);
|
||||
if (FAILED(hr))
|
||||
@@ -1320,6 +1490,16 @@ CInputPin::CreatePin(
|
||||
m_InterfaceHandler = InterfaceHandler;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
// free medium / interface / dataformat
|
||||
CoTaskMemFree(MediumList);
|
||||
@@ -1339,6 +1519,32 @@ 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)
|
||||
{
|
||||
// pin already exists
|
||||
//CloseHandle(m_hPin);
|
||||
//m_hPin = INVALID_HANDLE_VALUE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
// calc format size
|
||||
Length = sizeof(KSPIN_CONNECT) + sizeof(KSDATAFORMAT) + pmt->cbFormat;
|
||||
@@ -1378,7 +1584,73 @@ CInputPin::CreatePinHandle(
|
||||
}
|
||||
|
||||
// create pin
|
||||
hr = KsCreatePin(m_hFilter, PinConnect, GENERIC_WRITE, &m_hPin);
|
||||
hr = KsCreatePin(hFilter, PinConnect, GENERIC_WRITE, &m_hPin);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
// store current interface / medium
|
||||
CopyMemory(&m_Medium, Medium, sizeof(KSPIN_MEDIUM));
|
||||
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)
|
||||
{
|
||||
m_MediaFormat.pbFormat = (BYTE*)CoTaskMemAlloc(pmt->cbFormat);
|
||||
if (!m_MediaFormat.pbFormat)
|
||||
{
|
||||
CoTaskMemFree(PinConnect);
|
||||
m_MediaFormat.pbFormat = NULL;
|
||||
m_MediaFormat.cbFormat = 0;
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
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");
|
||||
#endif
|
||||
return hr;
|
||||
}
|
||||
|
||||
// load all proxy plugins
|
||||
hr = LoadProxyPlugins(pGuid, NumGuids);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CInputPin::CreatePinHandle LoadProxyPlugins failed\n");
|
||||
#endif
|
||||
return hr;
|
||||
}
|
||||
|
||||
// free sets
|
||||
CoTaskMemFree(pGuid);
|
||||
|
||||
|
||||
//TODO
|
||||
// connect pin pipes
|
||||
|
||||
}
|
||||
|
||||
// free pin connect
|
||||
CoTaskMemFree(PinConnect);
|
||||
@@ -1386,6 +1658,137 @@ 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;
|
||||
|
||||
// allocate guid buffer
|
||||
pGuid = (LPGUID)CoTaskMemAlloc(Length);
|
||||
if (!pGuid)
|
||||
{
|
||||
// failed
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
NumProperty /= sizeof(GUID);
|
||||
NumMethods /= sizeof(GUID);
|
||||
NumEvents /= sizeof(GUID);
|
||||
|
||||
// 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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
#ifdef KSPROXY_TRACE
|
||||
WCHAR Buffer[200];
|
||||
swprintf(Buffer, L"NumProperty %lu NumMethods %lu NumEvents %lu\n", NumProperty, NumMethods, NumEvents);
|
||||
OutputDebugStringW(Buffer);
|
||||
#endif
|
||||
|
||||
*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);
|
||||
}
|
||||
// close key
|
||||
RegCloseKey(hSubKey);
|
||||
}
|
||||
|
||||
// close media interfaces key
|
||||
RegCloseKey(hKey);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
WINAPI
|
||||
CInputPin_Constructor(
|
||||
@@ -1397,7 +1800,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;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<group compilerset="msc">
|
||||
<compilerflag compiler="cxx">/GR-</compilerflag>
|
||||
</group>
|
||||
|
||||
<file>allocator.cpp</file>
|
||||
<file>basicaudio.cpp</file>
|
||||
<file>classfactory.cpp</file>
|
||||
<file>clockforward.cpp</file>
|
||||
@@ -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>
|
||||
|
||||
@@ -0,0 +1,368 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS WDM Streaming ActiveMovie Proxy
|
||||
* FILE: dll/directx/ksproxy/mediasample.cpp
|
||||
* PURPOSE: IMediaSample interface
|
||||
*
|
||||
* PROGRAMMERS: Johannes Anderwald ([email protected])
|
||||
*/
|
||||
#include "precomp.h"
|
||||
|
||||
class CMediaSample : public IMediaSample
|
||||
{
|
||||
public:
|
||||
STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
|
||||
|
||||
STDMETHODIMP_(ULONG) AddRef()
|
||||
{
|
||||
InterlockedIncrement(&m_Ref);
|
||||
return m_Ref;
|
||||
}
|
||||
STDMETHODIMP_(ULONG) Release()
|
||||
{
|
||||
InterlockedDecrement(&m_Ref);
|
||||
DebugBreak();
|
||||
if (!m_Ref)
|
||||
{
|
||||
if (m_Allocator)
|
||||
{
|
||||
m_Allocator->ReleaseBuffer((IMediaSample*)this);
|
||||
return 0;
|
||||
}
|
||||
delete this;
|
||||
return 0;
|
||||
}
|
||||
return m_Ref;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetPointer(BYTE **ppBuffer);
|
||||
long STDMETHODCALLTYPE GetSize(void);
|
||||
HRESULT STDMETHODCALLTYPE GetTime(REFERENCE_TIME *pTimeStart, REFERENCE_TIME *pTimeEnd);
|
||||
HRESULT STDMETHODCALLTYPE SetTime(REFERENCE_TIME *pTimeStart, REFERENCE_TIME *pTimeEnd);
|
||||
HRESULT STDMETHODCALLTYPE IsSyncPoint();
|
||||
HRESULT STDMETHODCALLTYPE SetSyncPoint(BOOL bIsSyncPoint);
|
||||
HRESULT STDMETHODCALLTYPE IsPreroll();
|
||||
HRESULT STDMETHODCALLTYPE SetPreroll(BOOL bIsPreroll);
|
||||
long STDMETHODCALLTYPE GetActualDataLength();
|
||||
HRESULT STDMETHODCALLTYPE SetActualDataLength(long Length);
|
||||
HRESULT STDMETHODCALLTYPE GetMediaType(AM_MEDIA_TYPE **ppMediaType);
|
||||
HRESULT STDMETHODCALLTYPE SetMediaType(AM_MEDIA_TYPE *pMediaType);
|
||||
HRESULT STDMETHODCALLTYPE IsDiscontinuity();
|
||||
HRESULT STDMETHODCALLTYPE SetDiscontinuity(BOOL bDiscontinuity);
|
||||
HRESULT STDMETHODCALLTYPE GetMediaTime(LONGLONG *pTimeStart, LONGLONG *pTimeEnd);
|
||||
HRESULT STDMETHODCALLTYPE SetMediaTime(LONGLONG *pTimeStart, LONGLONG *pTimeEnd);
|
||||
|
||||
CMediaSample(IMemAllocator * Allocator, BYTE * Buffer, LONG BufferSize);
|
||||
virtual ~CMediaSample(){}
|
||||
|
||||
protected:
|
||||
ULONG m_Flags;
|
||||
ULONG m_TypeFlags;
|
||||
BYTE * m_Buffer;
|
||||
LONG m_ActualLength;
|
||||
LONG m_BufferSize;
|
||||
IMemAllocator * m_Allocator;
|
||||
CMediaSample * m_Next;
|
||||
REFERENCE_TIME m_StartTime;
|
||||
REFERENCE_TIME m_StopTime;
|
||||
LONGLONG m_MediaStart;
|
||||
LONGLONG m_MediaStop;
|
||||
AM_MEDIA_TYPE * m_MediaType;
|
||||
ULONG m_StreamId;
|
||||
|
||||
public:
|
||||
LONG m_Ref;
|
||||
|
||||
BOOL m_bMediaTimeValid;
|
||||
|
||||
|
||||
};
|
||||
|
||||
CMediaSample::CMediaSample(
|
||||
IMemAllocator * Allocator,
|
||||
BYTE * Buffer,
|
||||
LONG BufferSize) :
|
||||
m_Flags(0),
|
||||
m_TypeFlags(0),
|
||||
m_Buffer(Buffer),
|
||||
m_ActualLength(BufferSize),
|
||||
m_BufferSize(BufferSize),
|
||||
m_Allocator(Allocator),
|
||||
m_Next(0),
|
||||
m_StartTime(0),
|
||||
m_StopTime(0),
|
||||
m_MediaStart(0),
|
||||
m_MediaStop(0),
|
||||
m_MediaType(0),
|
||||
m_StreamId(0),
|
||||
m_Ref(0),
|
||||
m_bMediaTimeValid(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CMediaSample::QueryInterface(
|
||||
IN REFIID refiid,
|
||||
OUT PVOID* Output)
|
||||
{
|
||||
if (IsEqualGUID(refiid, IID_IUnknown) ||
|
||||
IsEqualGUID(refiid, IID_IMediaSample))
|
||||
{
|
||||
*Output = PVOID(this);
|
||||
reinterpret_cast<IMediaSample*>(*Output)->AddRef();
|
||||
return NOERROR;
|
||||
}
|
||||
if (IsEqualGUID(refiid, IID_IMediaSample2))
|
||||
{
|
||||
#if 0
|
||||
*Output = (IMediaSample2*)(this);
|
||||
reinterpret_cast<IMediaSample2*>(*Output)->AddRef();
|
||||
return NOERROR;
|
||||
#endif
|
||||
}
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// IMediaSample interface
|
||||
//
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CMediaSample::GetPointer(
|
||||
BYTE **ppBuffer)
|
||||
{
|
||||
if (!ppBuffer)
|
||||
return E_POINTER;
|
||||
|
||||
*ppBuffer = m_Buffer;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
long
|
||||
STDMETHODCALLTYPE
|
||||
CMediaSample::GetSize()
|
||||
{
|
||||
return m_BufferSize;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CMediaSample::GetTime(
|
||||
REFERENCE_TIME *pTimeStart,
|
||||
REFERENCE_TIME *pTimeEnd)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
if (!pTimeStart || !pTimeEnd)
|
||||
return E_POINTER;
|
||||
|
||||
if (!(m_Flags & (AM_SAMPLE_TIMEVALID | AM_SAMPLE_STOPVALID)))
|
||||
{
|
||||
// no time is set
|
||||
return VFW_E_SAMPLE_TIME_NOT_SET;
|
||||
}
|
||||
|
||||
*pTimeStart = m_StartTime;
|
||||
|
||||
if (m_Flags & AM_SAMPLE_STOPVALID)
|
||||
{
|
||||
*pTimeEnd = m_StopTime;
|
||||
hr = NOERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
*pTimeEnd = m_StartTime + 1;
|
||||
hr = VFW_S_NO_STOP_TIME;
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CMediaSample::SetTime(REFERENCE_TIME *pTimeStart, REFERENCE_TIME *pTimeEnd)
|
||||
{
|
||||
if (!pTimeStart)
|
||||
{
|
||||
m_Flags &= ~(AM_SAMPLE_TIMEVALID | AM_SAMPLE_STOPVALID);
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
if (!pTimeEnd)
|
||||
{
|
||||
m_Flags &= ~(AM_SAMPLE_STOPVALID);
|
||||
m_Flags |= AM_SAMPLE_TIMEVALID;
|
||||
m_StartTime = *pTimeStart;
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
|
||||
m_Flags |= (AM_SAMPLE_TIMEVALID | AM_SAMPLE_STOPVALID);
|
||||
m_StartTime = *pTimeStart;
|
||||
m_StopTime = *pTimeEnd;
|
||||
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CMediaSample::IsSyncPoint()
|
||||
{
|
||||
return (m_Flags & AM_SAMPLE_SPLICEPOINT) ? S_OK : S_FALSE;
|
||||
}
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CMediaSample::SetSyncPoint(BOOL bIsSyncPoint)
|
||||
{
|
||||
if (bIsSyncPoint)
|
||||
m_Flags |= AM_SAMPLE_SPLICEPOINT;
|
||||
else
|
||||
m_Flags &= ~AM_SAMPLE_SPLICEPOINT;
|
||||
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CMediaSample::IsPreroll()
|
||||
{
|
||||
return (m_Flags & AM_SAMPLE_PREROLL) ? S_OK : S_FALSE;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CMediaSample::SetPreroll(BOOL bIsPreroll)
|
||||
{
|
||||
if (bIsPreroll)
|
||||
m_Flags |= AM_SAMPLE_PREROLL;
|
||||
else
|
||||
m_Flags &= ~AM_SAMPLE_PREROLL;
|
||||
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
long
|
||||
STDMETHODCALLTYPE
|
||||
CMediaSample::GetActualDataLength()
|
||||
{
|
||||
return m_ActualLength;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CMediaSample::SetActualDataLength(long Length)
|
||||
{
|
||||
if (Length > m_BufferSize)
|
||||
return VFW_E_BUFFER_OVERFLOW;
|
||||
|
||||
m_ActualLength = Length;
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CMediaSample::GetMediaType(AM_MEDIA_TYPE **ppMediaType)
|
||||
{
|
||||
if (!m_MediaType)
|
||||
{
|
||||
*ppMediaType = NULL;
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
assert(0);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CMediaSample::SetMediaType(AM_MEDIA_TYPE *pMediaType)
|
||||
{
|
||||
OutputDebugStringW(L"CMediaSample::SetMediaType NotImplemented\n");
|
||||
DebugBreak();
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CMediaSample::IsDiscontinuity()
|
||||
{
|
||||
return (m_Flags & AM_SAMPLE_DATADISCONTINUITY) ? S_OK : S_FALSE;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CMediaSample::SetDiscontinuity(BOOL bDiscontinuity)
|
||||
{
|
||||
if (bDiscontinuity)
|
||||
m_Flags |= AM_SAMPLE_DATADISCONTINUITY;
|
||||
else
|
||||
m_Flags &= ~AM_SAMPLE_DATADISCONTINUITY;
|
||||
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CMediaSample::GetMediaTime(LONGLONG *pTimeStart, LONGLONG *pTimeEnd)
|
||||
{
|
||||
if (!pTimeStart || !pTimeEnd)
|
||||
return E_POINTER;
|
||||
|
||||
if (!m_bMediaTimeValid)
|
||||
return VFW_E_MEDIA_TIME_NOT_SET;
|
||||
|
||||
m_MediaStart = *pTimeStart;
|
||||
m_MediaStop = *pTimeEnd;
|
||||
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
CMediaSample::SetMediaTime(LONGLONG *pTimeStart, LONGLONG *pTimeEnd)
|
||||
{
|
||||
if (!pTimeStart || !pTimeEnd)
|
||||
{
|
||||
m_bMediaTimeValid = false;
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
m_MediaStart = *pTimeStart;
|
||||
m_MediaStop = *pTimeEnd;
|
||||
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
HRESULT
|
||||
WINAPI
|
||||
CMediaSample_Constructor(
|
||||
IMemAllocator* Allocator,
|
||||
BYTE* pBuffer,
|
||||
ULONG BufferSize,
|
||||
REFIID riid,
|
||||
LPVOID * ppv)
|
||||
{
|
||||
#ifdef KSPROXY_TRACE
|
||||
OutputDebugStringW(L"CMediaSample_Constructor\n");
|
||||
#endif
|
||||
|
||||
CMediaSample * handler = new CMediaSample(Allocator, pBuffer, BufferSize);
|
||||
|
||||
if (!handler)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
if (FAILED(handler->QueryInterface(riid, ppv)))
|
||||
{
|
||||
/* not supported */
|
||||
delete handler;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
return NOERROR;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
+1409
-107
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>
|
||||
@@ -134,9 +137,16 @@ COutputPin_Constructor(
|
||||
IBaseFilter * ParentFilter,
|
||||
LPCWSTR PinName,
|
||||
ULONG PinId,
|
||||
KSPIN_COMMUNICATION Communication,
|
||||
REFIID riid,
|
||||
LPVOID * ppv);
|
||||
|
||||
HRESULT
|
||||
STDMETHODCALLTYPE
|
||||
COutputPin_SetState(
|
||||
IPin * Pin,
|
||||
KSSTATE State);
|
||||
|
||||
/* enumpins.cpp */
|
||||
HRESULT
|
||||
WINAPI
|
||||
@@ -165,8 +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;
|
||||
|
||||
+376
-37
File diff suppressed because it is too large
Load Diff
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
|
||||
1 stdcall DownlevelGetLocaleScripts(ptr ptr long) DownlevelGetLocaleScripts
|
||||
2 stdcall DownlevelGetStringScripts(long ptr long ptr long) kernel32.GetStringScripts
|
||||
3 stdcall DownlevelVerifyScripts(long ptr long ptr long) kernel32.VerifyScripts
|
||||
@@ -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);
|
||||
|
||||
+17
-4
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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 */
|
||||
@@ -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>
|
||||
@@ -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"
|
||||
@@ -0,0 +1,3 @@
|
||||
@ stdcall BatteryClassCoInstaller(long ptr ptr)
|
||||
@ stdcall BatteryClassInstall(long ptr ptr)
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
#define IDI_BATTERY 2
|
||||
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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
+113
-53
@@ -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;
|
||||
}
|
||||
|
||||
+248
-273
@@ -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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
/*
|
||||
* File elf_private.h - definitions for processing of ELF files
|
||||
*
|
||||
* Copyright (C) 1996, Eric Youngdale.
|
||||
* 1999-2007 Eric Pouech
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#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
|
||||
|
||||
#define IMAGE_NO_MAP ((void*)-1)
|
||||
|
||||
#ifdef __ELF__
|
||||
|
||||
#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
|
||||
#else
|
||||
#ifndef SHT_NULL
|
||||
#define SHT_NULL 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* structure holding information while handling an ELF image
|
||||
* allows one by one section mapping for memory savings
|
||||
*/
|
||||
struct image_file_map
|
||||
{
|
||||
enum module_type modtype;
|
||||
union
|
||||
{
|
||||
struct elf_file_map
|
||||
{
|
||||
size_t elf_size;
|
||||
size_t elf_start;
|
||||
int fd;
|
||||
const char* shstrtab;
|
||||
struct image_file_map* alternate; /* another ELF file (linked to this one) */
|
||||
#ifdef __ELF__
|
||||
Elf_Ehdr elfhdr;
|
||||
struct
|
||||
{
|
||||
Elf_Shdr shdr;
|
||||
const char* mapped;
|
||||
}* sect;
|
||||
#endif
|
||||
} elf;
|
||||
struct pe_file_map
|
||||
{
|
||||
HANDLE hMap;
|
||||
IMAGE_NT_HEADERS ntheader;
|
||||
unsigned full_count;
|
||||
void* full_map;
|
||||
struct
|
||||
{
|
||||
IMAGE_SECTION_HEADER shdr;
|
||||
const char* mapped;
|
||||
}* sect;
|
||||
const char* strtable;
|
||||
} pe;
|
||||
} u;
|
||||
};
|
||||
|
||||
struct image_section_map
|
||||
{
|
||||
struct image_file_map* fmap;
|
||||
long sidx;
|
||||
};
|
||||
|
||||
extern BOOL elf_find_section(struct image_file_map* fmap, const char* name,
|
||||
unsigned sht, struct image_section_map* ism);
|
||||
extern const char* elf_map_section(struct image_section_map* ism);
|
||||
extern void elf_unmap_section(struct image_section_map* ism);
|
||||
extern DWORD_PTR elf_get_map_rva(const struct image_section_map* ism);
|
||||
extern unsigned elf_get_map_size(const struct image_section_map* ism);
|
||||
|
||||
extern BOOL pe_find_section(struct image_file_map* fmap, const char* name,
|
||||
struct image_section_map* ism);
|
||||
extern const char* pe_map_section(struct image_section_map* psm);
|
||||
extern void pe_unmap_section(struct image_section_map* psm);
|
||||
extern DWORD_PTR pe_get_map_rva(const struct image_section_map* psm);
|
||||
extern unsigned pe_get_map_size(const struct image_section_map* psm);
|
||||
|
||||
static inline BOOL image_find_section(struct image_file_map* fmap, const char* name,
|
||||
struct image_section_map* ism)
|
||||
{
|
||||
switch (fmap->modtype)
|
||||
{
|
||||
case DMT_ELF: return elf_find_section(fmap, name, SHT_NULL, ism);
|
||||
case DMT_PE: return pe_find_section(fmap, name, ism);
|
||||
default: assert(0); return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static inline const char* image_map_section(struct image_section_map* ism)
|
||||
{
|
||||
if (!ism->fmap) return NULL;
|
||||
switch (ism->fmap->modtype)
|
||||
{
|
||||
case DMT_ELF: return elf_map_section(ism);
|
||||
case DMT_PE: return pe_map_section(ism);
|
||||
default: assert(0); return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void image_unmap_section(struct image_section_map* ism)
|
||||
{
|
||||
if (!ism->fmap) return;
|
||||
switch (ism->fmap->modtype)
|
||||
{
|
||||
case DMT_ELF: elf_unmap_section(ism); break;
|
||||
case DMT_PE: pe_unmap_section(ism); break;
|
||||
default: assert(0); return;
|
||||
}
|
||||
}
|
||||
|
||||
static inline DWORD_PTR image_get_map_rva(struct image_section_map* ism)
|
||||
{
|
||||
if (!ism->fmap) return 0;
|
||||
switch (ism->fmap->modtype)
|
||||
{
|
||||
case DMT_ELF: return elf_get_map_rva(ism);
|
||||
case DMT_PE: return pe_get_map_rva(ism);
|
||||
default: assert(0); return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static inline unsigned image_get_map_size(struct image_section_map* ism)
|
||||
{
|
||||
if (!ism->fmap) return 0;
|
||||
switch (ism->fmap->modtype)
|
||||
{
|
||||
case DMT_ELF: return elf_get_map_size(ism);
|
||||
case DMT_PE: return pe_get_map_size(ism);
|
||||
default: assert(0); return 0;
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
+340
-153
@@ -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)
|
||||
|
||||
@@ -69,4 +69,3 @@ FONT 8, "MS Shell Dlg"
|
||||
PUSHBUTTON "OK", IDOK, 40, 65, 45, 15, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
|
||||
PUSHBUTTON "Annulla", IDCANCEL, 115, 65, 45, 15, WS_GROUP | WS_TABSTOP
|
||||
}
|
||||
#pragma code_page(default)
|
||||
|
||||
@@ -69,4 +69,3 @@ FONT 8, "MS Shell Dlg"
|
||||
PUSHBUTTON "OK", IDOK, 40, 65, 45, 15, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
|
||||
PUSHBUTTON "キャンセル", IDCANCEL, 115, 65, 45, 15, WS_GROUP | WS_TABSTOP
|
||||
}
|
||||
#pragma code_page(default)
|
||||
|
||||
@@ -69,4 +69,3 @@ FONT 8, "MS Shell Dlg"
|
||||
PUSHBUTTON "Gerai", IDOK, 40, 65, 45, 15, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
|
||||
PUSHBUTTON "Atsisakyti", IDCANCEL, 115, 65, 45, 15, WS_GROUP | WS_TABSTOP
|
||||
}
|
||||
#pragma code_page(default)
|
||||
|
||||
@@ -70,4 +70,3 @@ FONT 8, "MS Shell Dlg"
|
||||
PUSHBUTTON "OK", IDOK, 40, 65, 45, 15, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
|
||||
PUSHBUTTON "Avbryt", IDCANCEL, 115, 65, 45, 15, WS_GROUP | WS_TABSTOP
|
||||
}
|
||||
#pragma code_page(default)
|
||||
|
||||
@@ -68,4 +68,3 @@ FONT 8, "MS Shell Dlg"
|
||||
PUSHBUTTON "V redu", IDOK, 40, 65, 45, 15, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
|
||||
PUSHBUTTON "Prekliči", IDCANCEL, 115, 65, 45, 15, WS_GROUP | WS_TABSTOP
|
||||
}
|
||||
#pragma code_page(default)
|
||||
|
||||
@@ -554,9 +554,12 @@ static HRESULT WINAPI HTMLDocument_get_vlinkColor(IHTMLDocument2 *iface, VARIANT
|
||||
static HRESULT WINAPI HTMLDocument_get_referrer(IHTMLDocument2 *iface, BSTR *p)
|
||||
{
|
||||
HTMLDocument *This = HTMLDOC_THIS(iface);
|
||||
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
*p = NULL;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLDocument_get_location(IHTMLDocument2 *iface, IHTMLLocation **p)
|
||||
{
|
||||
@@ -1474,7 +1477,7 @@ static void HTMLDocument_on_advise(IUnknown *iface, cp_static_data_t *cp)
|
||||
HTMLDocument *This = HTMLDOC_THIS(iface);
|
||||
|
||||
if(This->window)
|
||||
update_cp_events(This->window, cp);
|
||||
update_cp_events(This->window, &This->doc_node->node.event_target, cp, This->doc_node->node.nsnode);
|
||||
}
|
||||
|
||||
#undef HTMLDOC_THIS
|
||||
@@ -1596,6 +1599,11 @@ static HRESULT WINAPI DocDispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID
|
||||
{
|
||||
HTMLDocument *This = DISPEX_THIS(iface);
|
||||
|
||||
if(This->window && id == DISPID_IHTMLDOCUMENT2_LOCATION && (wFlags & DISPATCH_PROPERTYPUT))
|
||||
return IDispatchEx_InvokeEx(DISPATCHEX(This->window), DISPID_IHTMLWINDOW2_LOCATION, lcid, wFlags,
|
||||
pdp, pvarRes, pei, pspCaller);
|
||||
|
||||
|
||||
return IDispatchEx_InvokeEx(This->dispex, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user