From 583b6cfed09d48c560b41de161b7c4da10a93593 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 23 Jun 2013 20:41:42 +0000 Subject: [PATCH] [WBEMPROX] * Import from Wine 1.5.26 svn path=/trunk/; revision=59324 --- reactos/boot/bootdata/packages/reactos.dff.in | 1 + reactos/cmake/CMakeMacros.cmake | 4 +- reactos/dll/win32/CMakeLists.txt | 1 + reactos/dll/win32/wbemprox/CMakeLists.txt | 38 + reactos/dll/win32/wbemprox/builtin.c | 1428 ++++++++++ reactos/dll/win32/wbemprox/class.c | 1039 +++++++ reactos/dll/win32/wbemprox/main.c | 180 ++ reactos/dll/win32/wbemprox/process.c | 108 + reactos/dll/win32/wbemprox/qualifier.c | 283 ++ reactos/dll/win32/wbemprox/query.c | 887 ++++++ reactos/dll/win32/wbemprox/reg.c | 347 +++ reactos/dll/win32/wbemprox/service.c | 248 ++ reactos/dll/win32/wbemprox/services.c | 680 +++++ reactos/dll/win32/wbemprox/table.c | 437 +++ reactos/dll/win32/wbemprox/wbemlocator.c | 231 ++ reactos/dll/win32/wbemprox/wbemprox.idl | 33 + reactos/dll/win32/wbemprox/wbemprox.rc | 1 + reactos/dll/win32/wbemprox/wbemprox.rgs | 17 + reactos/dll/win32/wbemprox/wbemprox.spec | 4 + reactos/dll/win32/wbemprox/wbemprox_private.h | 297 ++ reactos/dll/win32/wbemprox/wql.tab.c | 2437 +++++++++++++++++ reactos/dll/win32/wbemprox/wql.y | 698 +++++ reactos/include/psdk/CMakeLists.txt | 10 +- reactos/include/psdk/d3d10.idl | 1600 +++++++++++ reactos/include/psdk/d3d10effect.h | 857 ++++++ reactos/include/psdk/d3d10misc.h | 48 + reactos/include/psdk/d3d10shader.h | 233 ++ reactos/include/psdk/d3dcommon.idl | 620 +++++ reactos/include/psdk/ipifcons.h | 278 +- reactos/include/psdk/iptypes.h | 4 +- reactos/include/psdk/wbemcli.idl | 242 ++ reactos/include/psdk/wbemprov.idl | 28 + reactos/include/psdk/winternl.h | 24 +- reactos/media/doc/README.WINE | 1 + reactos/media/inf/syssetup.inf | 1 + 35 files changed, 13292 insertions(+), 53 deletions(-) create mode 100644 reactos/dll/win32/wbemprox/CMakeLists.txt create mode 100644 reactos/dll/win32/wbemprox/builtin.c create mode 100644 reactos/dll/win32/wbemprox/class.c create mode 100644 reactos/dll/win32/wbemprox/main.c create mode 100644 reactos/dll/win32/wbemprox/process.c create mode 100644 reactos/dll/win32/wbemprox/qualifier.c create mode 100644 reactos/dll/win32/wbemprox/query.c create mode 100644 reactos/dll/win32/wbemprox/reg.c create mode 100644 reactos/dll/win32/wbemprox/service.c create mode 100644 reactos/dll/win32/wbemprox/services.c create mode 100644 reactos/dll/win32/wbemprox/table.c create mode 100644 reactos/dll/win32/wbemprox/wbemlocator.c create mode 100644 reactos/dll/win32/wbemprox/wbemprox.idl create mode 100644 reactos/dll/win32/wbemprox/wbemprox.rc create mode 100644 reactos/dll/win32/wbemprox/wbemprox.rgs create mode 100644 reactos/dll/win32/wbemprox/wbemprox.spec create mode 100644 reactos/dll/win32/wbemprox/wbemprox_private.h create mode 100644 reactos/dll/win32/wbemprox/wql.tab.c create mode 100644 reactos/dll/win32/wbemprox/wql.y create mode 100644 reactos/include/psdk/d3d10.idl create mode 100644 reactos/include/psdk/d3d10effect.h create mode 100644 reactos/include/psdk/d3d10misc.h create mode 100644 reactos/include/psdk/d3d10shader.h create mode 100644 reactos/include/psdk/d3dcommon.idl create mode 100644 reactos/include/psdk/wbemprov.idl diff --git a/reactos/boot/bootdata/packages/reactos.dff.in b/reactos/boot/bootdata/packages/reactos.dff.in index fe25c3b36df..9a2c54c5813 100644 --- a/reactos/boot/bootdata/packages/reactos.dff.in +++ b/reactos/boot/bootdata/packages/reactos.dff.in @@ -30,6 +30,7 @@ Signature = "$ReactOS$" 14 = Microsoft.NET\Framework\v2.0.50727 15 = Resources 16 = Resources\Themes +17 = system32\wbem .InfEnd diff --git a/reactos/cmake/CMakeMacros.cmake b/reactos/cmake/CMakeMacros.cmake index 6d227ca54ef..6d58334da36 100644 --- a/reactos/cmake/CMakeMacros.cmake +++ b/reactos/cmake/CMakeMacros.cmake @@ -187,7 +187,9 @@ macro(dir_to_num dir var) set(${var} 15) elseif(${dir} STREQUAL reactos/Resources/Themes) set(${var} 16) - else() + elseif(${dir} STREQUAL reactos/system32/wbem) + set(${var} 17) + else() message(FATAL_ERROR "Wrong destination: ${dir}") endif() endmacro() diff --git a/reactos/dll/win32/CMakeLists.txt b/reactos/dll/win32/CMakeLists.txt index 09e9d51db43..2c4fe585926 100644 --- a/reactos/dll/win32/CMakeLists.txt +++ b/reactos/dll/win32/CMakeLists.txt @@ -208,6 +208,7 @@ add_subdirectory(uxtheme) add_subdirectory(vbscript) add_subdirectory(vdmdbg) add_subdirectory(version) +add_subdirectory(wbemprox) if(ARCH STREQUAL "i386") add_subdirectory(wdmaud.drv) endif() diff --git a/reactos/dll/win32/wbemprox/CMakeLists.txt b/reactos/dll/win32/wbemprox/CMakeLists.txt new file mode 100644 index 00000000000..94724a7122f --- /dev/null +++ b/reactos/dll/win32/wbemprox/CMakeLists.txt @@ -0,0 +1,38 @@ + +include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) +add_definitions(-D__WINESRC__) + +remove_definitions(-D_WIN32_WINNT=0x502) +add_definitions(-D_WIN32_WINNT=0x600) + +spec2def(wbemprox.dll wbemprox.spec) + +list(APPEND SOURCE + builtin.c + class.c + main.c + process.c + qualifier.c + query.c + reg.c + service.c + services.c + table.c + wbemlocator.c + wql.tab.c + ${CMAKE_CURRENT_BINARY_DIR}/wbemprox.def) + +add_library(wbemprox SHARED ${SOURCE} wbemprox.rc) + +if(NOT MSVC) + # FIXME: http://www.cmake.org/Bug/view.php?id=12998 + #allow_warnings(wbemprox) + set_source_files_properties(${SOURCE} PROPERTIES COMPILE_FLAGS "-Wno-error") +endif() + +set_source_files_properties(wbemprox.rc PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/wbemprox.rgs) +set_module_type(wbemprox win32dll) +target_link_libraries(wbemprox wine) +add_importlibs(wbemprox iphlpapi dxgi oleaut32 ole32 advapi32 user32 gdi32 msvcrt kernel32 ntdll) +add_dependencies(wbemprox d3d_idl_headers) +add_cd_file(TARGET wbemprox DESTINATION reactos/system32/wbem FOR all) diff --git a/reactos/dll/win32/wbemprox/builtin.c b/reactos/dll/win32/wbemprox/builtin.c new file mode 100644 index 00000000000..cd229d3aef6 --- /dev/null +++ b/reactos/dll/win32/wbemprox/builtin.c @@ -0,0 +1,1428 @@ +/* + * Copyright 2012 Hans Leidekker for CodeWeavers + * + * 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 + */ + +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H + +#define COBJMACROS +#define NONAMELESSUNION +#define NONAMELESSSTRUCT + +#include "config.h" +#include + +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "initguid.h" +#include "objbase.h" +#include "oleauto.h" +#include "wbemcli.h" +#include "wbemprov.h" +#include "winsock2.h" +#include "iphlpapi.h" +#include "tlhelp32.h" +#include "d3d10.h" +#include "winternl.h" +#include "winioctl.h" +#include "winsvc.h" + +#include "wine/debug.h" +#include "wbemprox_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wbemprox); + +static const WCHAR class_baseboardW[] = + {'W','i','n','3','2','_','B','a','s','e','B','o','a','r','d',0}; +static const WCHAR class_biosW[] = + {'W','i','n','3','2','_','B','I','O','S',0}; +static const WCHAR class_cdromdriveW[] = + {'W','i','n','3','2','_','C','D','R','O','M','D','r','i','v','e',0}; +static const WCHAR class_compsysW[] = + {'W','i','n','3','2','_','C','o','m','p','u','t','e','r','S','y','s','t','e','m',0}; +static const WCHAR class_diskdriveW[] = + {'W','i','n','3','2','_','D','i','s','k','D','r','i','v','e',0}; +static const WCHAR class_diskpartitionW[] = + {'W','i','n','3','2','_','D','i','s','k','P','a','r','t','i','t','i','o','n',0}; +static const WCHAR class_logicaldiskW[] = + {'W','i','n','3','2','_','L','o','g','i','c','a','l','D','i','s','k',0}; +static const WCHAR class_networkadapterW[] = + {'W','i','n','3','2','_','N','e','t','w','o','r','k','A','d','a','p','t','e','r',0}; +static const WCHAR class_osW[] = + {'W','i','n','3','2','_','O','p','e','r','a','t','i','n','g','S','y','s','t','e','m',0}; +static const WCHAR class_paramsW[] = + {'_','_','P','A','R','A','M','E','T','E','R','S',0}; +static const WCHAR class_qualifiersW[] = + {'_','_','Q','U','A','L','I','F','I','E','R','S',0}; +static const WCHAR class_process_getowner_outW[] = + {'_','_','W','I','N','3','2','_','P','R','O','C','E','S','S','_','G','E','T','O','W', + 'N','E','R','_','O','U','T',0}; +static const WCHAR class_processorW[] = + {'W','i','n','3','2','_','P','r','o','c','e','s','s','o','r',0}; +static const WCHAR class_sounddeviceW[] = + {'W','i','n','3','2','_','S','o','u','n','d','D','e','v','i','c','e',0}; +static const WCHAR class_videocontrollerW[] = + {'W','i','n','3','2','_','V','i','d','e','o','C','o','n','t','r','o','l','l','e','r',0}; + +static const WCHAR prop_adaptertypeW[] = + {'A','d','a','p','t','e','r','T','y','p','e',0}; +static const WCHAR prop_acceptpauseW[] = + {'A','c','c','e','p','t','P','a','u','s','e',0}; +static const WCHAR prop_acceptstopW[] = + {'A','c','c','e','p','t','S','t','o','p',0}; +static const WCHAR prop_adapterramW[] = + {'A','d','a','p','t','e','r','R','A','M',0}; +static const WCHAR prop_bootableW[] = + {'B','o','o','t','a','b','l','e',0}; +static const WCHAR prop_captionW[] = + {'C','a','p','t','i','o','n',0}; +static const WCHAR prop_classW[] = + {'C','l','a','s','s',0}; +static const WCHAR prop_commandlineW[] = + {'C','o','m','m','a','n','d','L','i','n','e',0}; +static const WCHAR prop_cpustatusW[] = + {'C','p','u','S','t','a','t','u','s',0}; +static const WCHAR prop_csdversionW[] = + {'C','S','D','V','e','r','s','i','o','n',0}; +static const WCHAR prop_currentbitsperpixelW[] = + {'C','u','r','r','e','n','t','B','i','t','s','P','e','r','P','i','x','e','l',0}; +static const WCHAR prop_currenthorizontalresW[] = + {'C','u','r','r','e','n','t','H','o','r','i','z','o','n','t','a','l','R','e','s','o','l','u','t','i','o','n',0}; +static const WCHAR prop_currentverticalresW[] = + {'C','u','r','r','e','n','t','V','e','r','t','i','c','a','l','R','e','s','o','l','u','t','i','o','n',0}; +static const WCHAR prop_defaultvalueW[] = + {'D','e','f','a','u','l','t','V','a','l','u','e',0}; +static const WCHAR prop_descriptionW[] = + {'D','e','s','c','r','i','p','t','i','o','n',0}; +static const WCHAR prop_deviceidW[] = + {'D','e','v','i','c','e','I','d',0}; +static const WCHAR prop_directionW[] = + {'D','i','r','e','c','t','i','o','n',0}; +static const WCHAR prop_displaynameW[] = + {'D','i','s','p','l','a','y','N','a','m','e',0}; +static const WCHAR prop_diskindexW[] = + {'D','i','s','k','I','n','d','e','x',0}; +static const WCHAR prop_domainW[] = + {'D','o','m','a','i','n',0}; +static const WCHAR prop_domainroleW[] = + {'D','o','m','a','i','n','R','o','l','e',0}; +static const WCHAR prop_driveW[] = + {'D','r','i','v','e',0}; +static const WCHAR prop_drivetypeW[] = + {'D','r','i','v','e','T','y','p','e',0}; +static const WCHAR prop_filesystemW[] = + {'F','i','l','e','S','y','s','t','e','m',0}; +static const WCHAR prop_flavorW[] = + {'F','l','a','v','o','r',0}; +static const WCHAR prop_freespaceW[] = + {'F','r','e','e','S','p','a','c','e',0}; +static const WCHAR prop_handleW[] = + {'H','a','n','d','l','e',0}; +static const WCHAR prop_idW[] = + {'I','D',0}; +static const WCHAR prop_indexW[] = + {'I','n','d','e','x',0}; +static const WCHAR prop_interfaceindexW[] = + {'I','n','t','e','r','f','a','c','e','I','n','d','e','x',0}; +static const WCHAR prop_intvalueW[] = + {'I','n','t','e','g','e','r','V','a','l','u','e',0}; +static const WCHAR prop_lastbootuptimeW[] = + {'L','a','s','t','B','o','o','t','U','p','T','i','m','e',0}; +static const WCHAR prop_macaddressW[] = + {'M','A','C','A','d','d','r','e','s','s',0}; +static const WCHAR prop_manufacturerW[] = + {'M','a','n','u','f','a','c','t','u','r','e','r',0}; +static const WCHAR prop_maxclockspeedW[] = + {'M','a','x','C','l','o','c','k','S','p','e','e','d',0}; +static const WCHAR prop_memberW[] = + {'M','e','m','b','e','r',0}; +static const WCHAR prop_methodW[] = + {'M','e','t','h','o','d',0}; +static const WCHAR prop_modelW[] = + {'M','o','d','e','l',0}; +static const WCHAR prop_netconnectionstatusW[] = + {'N','e','t','C','o','n','n','e','c','t','i','o','n','S','t','a','t','u','s',0}; +static const WCHAR prop_numlogicalprocessorsW[] = + {'N','u','m','b','e','r','O','f','L','o','g','i','c','a','l','P','r','o','c','e','s','s','o','r','s',0}; +static const WCHAR prop_numprocessorsW[] = + {'N','u','m','b','e','r','O','f','P','r','o','c','e','s','s','o','r','s',0}; +static const WCHAR prop_osarchitectureW[] = + {'O','S','A','r','c','h','i','t','e','c','t','u','r','e',0}; +static const WCHAR prop_oslanguageW[] = + {'O','S','L','a','n','g','u','a','g','e',0}; +static const WCHAR prop_parameterW[] = + {'P','a','r','a','m','e','t','e','r',0}; +static const WCHAR prop_pnpdeviceidW[] = + {'P','N','P','D','e','v','i','c','e','I','D',0}; +static const WCHAR prop_pprocessidW[] = + {'P','a','r','e','n','t','P','r','o','c','e','s','s','I','D',0}; +static const WCHAR prop_processidW[] = + {'P','r','o','c','e','s','s','I','D',0}; +static const WCHAR prop_processoridW[] = + {'P','r','o','c','e','s','s','o','r','I','d',0}; +static const WCHAR prop_productnameW[] = + {'P','r','o','d','u','c','t','N','a','m','e',0}; +static const WCHAR prop_releasedateW[] = + {'R','e','l','e','a','s','e','D','a','t','e',0}; +static const WCHAR prop_serialnumberW[] = + {'S','e','r','i','a','l','N','u','m','b','e','r',0}; +static const WCHAR prop_servicetypeW[] = + {'S','e','r','v','i','c','e','T','y','p','e',0}; +static const WCHAR prop_startmodeW[] = + {'S','t','a','r','t','M','o','d','e',0}; +static const WCHAR prop_sizeW[] = + {'S','i','z','e',0}; +static const WCHAR prop_speedW[] = + {'S','p','e','e','d',0}; +static const WCHAR prop_startingoffsetW[] = + {'S','t','a','r','t','i','n','g','O','f','f','s','e','t',0}; +static const WCHAR prop_stateW[] = + {'S','t','a','t','e',0}; +static const WCHAR prop_strvalueW[] = + {'S','t','r','i','n','g','V','a','l','u','e',0}; +static const WCHAR prop_systemdirectoryW[] = + {'S','y','s','t','e','m','D','i','r','e','c','t','o','r','y',0}; +static const WCHAR prop_systemnameW[] = + {'S','y','s','t','e','m','N','a','m','e',0}; +static const WCHAR prop_tagW[] = + {'T','a','g',0}; +static const WCHAR prop_threadcountW[] = + {'T','h','r','e','a','d','C','o','u','n','t',0}; +static const WCHAR prop_totalphysicalmemoryW[] = + {'T','o','t','a','l','P','h','y','s','i','c','a','l','M','e','m','o','r','y',0}; +static const WCHAR prop_typeW[] = + {'T','y','p','e',0}; +static const WCHAR prop_uniqueidW[] = + {'U','n','i','q','u','e','I','d',0}; +static const WCHAR prop_varianttypeW[] = + {'V','a','r','i','a','n','t','T','y','p','e',0}; +static const WCHAR prop_versionW[] = + {'V','e','r','s','i','o','n',0}; + +/* column definitions must be kept in sync with record structures below */ +static const struct column col_baseboard[] = +{ + { prop_manufacturerW, CIM_STRING }, + { prop_serialnumberW, CIM_STRING }, + { prop_tagW, CIM_STRING|COL_FLAG_KEY } +}; +static const struct column col_bios[] = +{ + { prop_descriptionW, CIM_STRING }, + { prop_manufacturerW, CIM_STRING }, + { prop_releasedateW, CIM_DATETIME }, + { prop_serialnumberW, CIM_STRING }, + { prop_versionW, CIM_STRING|COL_FLAG_KEY } +}; +static const struct column col_cdromdrive[] = +{ + { prop_deviceidW, CIM_STRING|COL_FLAG_KEY }, + { prop_driveW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_nameW, CIM_STRING }, + { prop_pnpdeviceidW, CIM_STRING } +}; +static const struct column col_compsys[] = +{ + { prop_descriptionW, CIM_STRING }, + { prop_domainW, CIM_STRING }, + { prop_domainroleW, CIM_UINT16 }, + { prop_manufacturerW, CIM_STRING }, + { prop_modelW, CIM_STRING }, + { prop_numlogicalprocessorsW, CIM_UINT32, VT_I4 }, + { prop_numprocessorsW, CIM_UINT32, VT_I4 }, + { prop_totalphysicalmemoryW, CIM_UINT64 } +}; +static const struct column col_diskdrive[] = +{ + { prop_deviceidW, CIM_STRING|COL_FLAG_KEY }, + { prop_manufacturerW, CIM_STRING }, + { prop_modelW, CIM_STRING }, + { prop_serialnumberW, CIM_STRING } +}; +static const struct column col_diskpartition[] = +{ + { prop_bootableW, CIM_BOOLEAN }, + { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY }, + { prop_diskindexW, CIM_UINT32, VT_I4 }, + { prop_indexW, CIM_UINT32, VT_I4 }, + { prop_pnpdeviceidW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_sizeW, CIM_UINT64 }, + { prop_startingoffsetW, CIM_UINT64 }, + { prop_typeW, CIM_STRING|COL_FLAG_DYNAMIC } +}; +static const struct column col_logicaldisk[] = +{ + { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY }, + { prop_drivetypeW, CIM_UINT32, VT_I4 }, + { prop_filesystemW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_freespaceW, CIM_UINT64 }, + { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_sizeW, CIM_UINT64 } +}; +static const struct column col_networkadapter[] = +{ + { prop_adaptertypeW, CIM_STRING }, + { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY }, + { prop_interfaceindexW, CIM_UINT32, VT_I4 }, + { prop_macaddressW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_manufacturerW, CIM_STRING }, + { prop_netconnectionstatusW, CIM_UINT16, VT_I4 }, + { prop_pnpdeviceidW, CIM_STRING }, + { prop_speedW, CIM_UINT64 } +}; +static const struct column col_os[] = +{ + { prop_captionW, CIM_STRING }, + { prop_csdversionW, CIM_STRING }, + { prop_lastbootuptimeW, CIM_DATETIME|COL_FLAG_DYNAMIC }, + { prop_osarchitectureW, CIM_STRING }, + { prop_oslanguageW, CIM_UINT32, VT_I4 }, + { prop_systemdirectoryW, CIM_STRING|COL_FLAG_DYNAMIC } +}; +static const struct column col_param[] = +{ + { prop_classW, CIM_STRING }, + { prop_methodW, CIM_STRING }, + { prop_directionW, CIM_SINT32 }, + { prop_parameterW, CIM_STRING }, + { prop_typeW, CIM_UINT32 }, + { prop_varianttypeW, CIM_UINT32 }, + { prop_defaultvalueW, CIM_UINT32 } +}; +static const struct column col_process[] = +{ + { prop_captionW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_commandlineW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_descriptionW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_handleW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY }, + { prop_pprocessidW, CIM_UINT32, VT_I4 }, + { prop_processidW, CIM_UINT32, VT_I4 }, + { prop_threadcountW, CIM_UINT32, VT_I4 }, + /* methods */ + { method_getownerW, CIM_FLAG_ARRAY|COL_FLAG_METHOD } +}; +static const struct column col_processor[] = +{ + { prop_cpustatusW, CIM_UINT16 }, + { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY }, + { prop_manufacturerW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_maxclockspeedW, CIM_UINT32, VT_I4 }, + { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_numlogicalprocessorsW, CIM_UINT32, VT_I4 }, + { prop_processoridW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_uniqueidW, CIM_STRING } +}; +static const struct column col_qualifier[] = +{ + { prop_classW, CIM_STRING }, + { prop_memberW, CIM_STRING }, + { prop_typeW, CIM_UINT32 }, + { prop_flavorW, CIM_SINT32 }, + { prop_nameW, CIM_STRING }, + { prop_intvalueW, CIM_SINT32 }, + { prop_strvalueW, CIM_STRING } +}; +static const struct column col_service[] = +{ + { prop_acceptpauseW, CIM_BOOLEAN }, + { prop_acceptstopW, CIM_BOOLEAN }, + { prop_displaynameW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY }, + { prop_processidW, CIM_UINT32 }, + { prop_servicetypeW, CIM_STRING }, + { prop_startmodeW, CIM_STRING }, + { prop_stateW, CIM_STRING }, + { prop_systemnameW, CIM_STRING|COL_FLAG_DYNAMIC }, + /* methods */ + { method_pauseserviceW, CIM_FLAG_ARRAY|COL_FLAG_METHOD }, + { method_resumeserviceW, CIM_FLAG_ARRAY|COL_FLAG_METHOD }, + { method_startserviceW, CIM_FLAG_ARRAY|COL_FLAG_METHOD }, + { method_stopserviceW, CIM_FLAG_ARRAY|COL_FLAG_METHOD } +}; +static const struct column col_sounddevice[] = +{ + { prop_productnameW, CIM_STRING } +}; +static const struct column col_stdregprov[] = +{ + { method_enumkeyW, CIM_FLAG_ARRAY|COL_FLAG_METHOD }, + { method_enumvaluesW, CIM_FLAG_ARRAY|COL_FLAG_METHOD }, + { method_getstringvalueW, CIM_FLAG_ARRAY|COL_FLAG_METHOD } +}; +static const struct column col_videocontroller[] = +{ + { prop_adapterramW, CIM_UINT32 }, + { prop_currentbitsperpixelW, CIM_UINT32 }, + { prop_currenthorizontalresW, CIM_UINT32 }, + { prop_currentverticalresW, CIM_UINT32 }, + { prop_descriptionW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_deviceidW, CIM_STRING|COL_FLAG_KEY }, + { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_pnpdeviceidW, CIM_STRING|COL_FLAG_DYNAMIC } +}; + +static const WCHAR baseboard_manufacturerW[] = + {'I','n','t','e','l',' ','C','o','r','p','o','r','a','t','i','o','n',0}; +static const WCHAR baseboard_serialnumberW[] = + {'N','o','n','e',0}; +static const WCHAR baseboard_tagW[] = + {'B','a','s','e',' ','B','o','a','r','d',0}; +static const WCHAR bios_descriptionW[] = + {'D','e','f','a','u','l','t',' ','S','y','s','t','e','m',' ','B','I','O','S',0}; +static const WCHAR bios_manufacturerW[] = + {'T','h','e',' ','W','i','n','e',' ','P','r','o','j','e','c','t',0}; +static const WCHAR bios_releasedateW[] = + {'2','0','1','2','0','6','0','8','0','0','0','0','0','0','.','0','0','0','0','0','0','+','0','0','0',0}; +static const WCHAR bios_serialnumberW[] = + {'0',0}; +static const WCHAR bios_versionW[] = + {'W','I','N','E',' ',' ',' ','-',' ','1',0}; +static const WCHAR cdromdrive_nameW[] = + {'W','i','n','e',' ','C','D','-','R','O','M',' ','A','T','A',' ','D','e','v','i','c','e',0}; +static const WCHAR cdromdrive_pnpdeviceidW[]= + {'I','D','E','\\','C','D','R','O','M','W','I','N','E','_','C','D','-','R','O','M', + '_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_', + '_','_','_','_','_','_','_','1','.','0','_','_','_','_','_','\\','5','&','3','A','2', + 'A','5','8','5','4','&','0','&','1','.','0','.','0',0}; +static const WCHAR compsys_descriptionW[] = + {'A','T','/','A','T',' ','C','O','M','P','A','T','I','B','L','E',0}; +static const WCHAR compsys_domainW[] = + {'W','O','R','K','G','R','O','U','P',0}; +static const WCHAR compsys_manufacturerW[] = + {'T','h','e',' ','W','i','n','e',' ','P','r','o','j','e','c','t',0}; +static const WCHAR compsys_modelW[] = + {'W','i','n','e',0}; +static const WCHAR diskdrive_deviceidW[] = + {'\\','\\','\\','\\','.','\\','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','0',0}; +static const WCHAR diskdrive_modelW[] = + {'W','i','n','e',' ','D','i','s','k',' ','D','r','i','v','e',0}; +static const WCHAR diskdrive_manufacturerW[] = + {'(','S','t','a','n','d','a','r','d',' ','d','i','s','k',' ','d','r','i','v','e','s',')',0}; +static const WCHAR networkadapter_pnpdeviceidW[]= + {'P','C','I','\\','V','E','N','_','8','0','8','6','&','D','E','V','_','1','0','0','E','&', + 'S','U','B','S','Y','S','_','0','0','1','E','8','0','8','6','&','R','E','V','_','0','2','\\', + '3','&','2','6','7','A','6','1','6','A','&','1','&','1','8',0}; +static const WCHAR os_captionW[] = + {'M','i','c','r','o','s','o','f','t',' ','W','i','n','d','o','w','s',' ','X','P',' ', + 'V','e','r','s','i','o','n',' ','=',' ','5','.','1','.','2','6','0','0',0}; +static const WCHAR os_csdversionW[] = + {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','3',0}; +static const WCHAR os_32bitW[] = + {'3','2','-','b','i','t',0}; +static const WCHAR os_64bitW[] = + {'6','4','-','b','i','t',0}; +static const WCHAR sounddevice_productnameW[] = + {'W','i','n','e',' ','A','u','d','i','o',' ','D','e','v','i','c','e',0}; +static const WCHAR videocontroller_deviceidW[] = + {'V','i','d','e','o','C','o','n','t','r','o','l','l','e','r','1',0}; + +#include "pshpack1.h" +struct record_baseboard +{ + const WCHAR *manufacturer; + const WCHAR *serialnumber; + const WCHAR *tag; +}; +struct record_bios +{ + const WCHAR *description; + const WCHAR *manufacturer; + const WCHAR *releasedate; + const WCHAR *serialnumber; + const WCHAR *version; +}; +struct record_cdromdrive +{ + const WCHAR *device_id; + const WCHAR *drive; + const WCHAR *name; + const WCHAR *pnpdevice_id; +}; +struct record_computersystem +{ + const WCHAR *description; + const WCHAR *domain; + UINT16 domainrole; + const WCHAR *manufacturer; + const WCHAR *model; + UINT32 num_logical_processors; + UINT32 num_processors; + UINT64 total_physical_memory; +}; +struct record_diskdrive +{ + const WCHAR *device_id; + const WCHAR *manufacturer; + const WCHAR *name; + const WCHAR *serialnumber; +}; +struct record_diskpartition +{ + int bootable; + const WCHAR *device_id; + UINT32 diskindex; + UINT32 index; + const WCHAR *pnpdevice_id; + UINT64 size; + UINT64 startingoffset; + const WCHAR *type; +}; +struct record_logicaldisk +{ + const WCHAR *device_id; + UINT32 drivetype; + const WCHAR *filesystem; + UINT64 freespace; + const WCHAR *name; + UINT64 size; +}; +struct record_networkadapter +{ + const WCHAR *adaptertype; + const WCHAR *device_id; + INT32 interface_index; + const WCHAR *mac_address; + const WCHAR *manufacturer; + UINT16 netconnection_status; + const WCHAR *pnpdevice_id; + UINT64 speed; +}; +struct record_operatingsystem +{ + const WCHAR *caption; + const WCHAR *csdversion; + const WCHAR *lastbootuptime; + const WCHAR *osarchitecture; + UINT32 oslanguage; + const WCHAR *systemdirectory; +}; +struct record_param +{ + const WCHAR *class; + const WCHAR *method; + INT32 direction; + const WCHAR *parameter; + UINT32 type; + UINT32 varianttype; + UINT32 defaultvalue; +}; +struct record_process +{ + const WCHAR *caption; + const WCHAR *commandline; + const WCHAR *description; + const WCHAR *handle; + UINT32 pprocess_id; + UINT32 process_id; + UINT32 thread_count; + /* methods */ + class_method *get_owner; +}; +struct record_processor +{ + UINT16 cpu_status; + const WCHAR *device_id; + const WCHAR *manufacturer; + UINT32 maxclockspeed; + const WCHAR *name; + UINT32 num_logical_processors; + const WCHAR *processor_id; + const WCHAR *unique_id; +}; +struct record_qualifier +{ + const WCHAR *class; + const WCHAR *member; + UINT32 type; + INT32 flavor; + const WCHAR *name; + INT32 intvalue; + const WCHAR *strvalue; +}; +struct record_service +{ + int accept_pause; + int accept_stop; + const WCHAR *displayname; + const WCHAR *name; + UINT32 process_id; + const WCHAR *servicetype; + const WCHAR *startmode; + const WCHAR *state; + const WCHAR *systemname; + /* methods */ + class_method *pause_service; + class_method *resume_service; + class_method *start_service; + class_method *stop_service; +}; +struct record_sounddevice +{ + const WCHAR *productname; +}; +struct record_stdregprov +{ + class_method *enumkey; + class_method *enumvalues; + class_method *getstringvalue; +}; +struct record_videocontroller +{ + UINT32 adapter_ram; + UINT32 current_bitsperpixel; + UINT32 current_horizontalres; + UINT32 current_verticalres; + const WCHAR *description; + const WCHAR *device_id; + const WCHAR *name; + const WCHAR *pnpdevice_id; +}; +#include "poppack.h" + +static const struct record_baseboard data_baseboard[] = +{ + { baseboard_manufacturerW, baseboard_serialnumberW, baseboard_tagW } +}; +static const struct record_bios data_bios[] = +{ + { bios_descriptionW, bios_manufacturerW, bios_releasedateW, bios_serialnumberW, bios_versionW } +}; +static const struct record_diskdrive data_diskdrive[] = +{ + { diskdrive_deviceidW, diskdrive_manufacturerW, diskdrive_modelW } +}; +static const struct record_param data_param[] = +{ + { class_processW, method_getownerW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, + { class_processW, method_getownerW, -1, param_userW, CIM_STRING }, + { class_processW, method_getownerW, -1, param_domainW, CIM_STRING }, + { class_serviceW, method_pauseserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, + { class_serviceW, method_resumeserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, + { class_serviceW, method_startserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, + { class_serviceW, method_stopserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, + { class_stdregprovW, method_enumkeyW, 1, param_defkeyW, CIM_SINT32, 0, 0x80000002 }, + { class_stdregprovW, method_enumkeyW, 1, param_subkeynameW, CIM_STRING }, + { class_stdregprovW, method_enumkeyW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, + { class_stdregprovW, method_enumkeyW, -1, param_namesW, CIM_STRING|CIM_FLAG_ARRAY }, + { class_stdregprovW, method_enumvaluesW, 1, param_defkeyW, CIM_SINT32, 0, 0x80000002 }, + { class_stdregprovW, method_enumvaluesW, 1, param_subkeynameW, CIM_STRING }, + { class_stdregprovW, method_enumvaluesW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, + { class_stdregprovW, method_enumvaluesW, -1, param_namesW, CIM_STRING|CIM_FLAG_ARRAY }, + { class_stdregprovW, method_enumvaluesW, -1, param_typesW, CIM_SINT32|CIM_FLAG_ARRAY }, + { class_stdregprovW, method_getstringvalueW, 1, param_defkeyW, CIM_SINT32, 0, 0x80000002 }, + { class_stdregprovW, method_getstringvalueW, 1, param_subkeynameW, CIM_STRING }, + { class_stdregprovW, method_getstringvalueW, 1, param_valuenameW, CIM_STRING }, + { class_stdregprovW, method_getstringvalueW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, + { class_stdregprovW, method_getstringvalueW, -1, param_valueW, CIM_STRING } +}; + +#define FLAVOR_ID (WBEM_FLAVOR_FLAG_PROPAGATE_TO_INSTANCE | WBEM_FLAVOR_NOT_OVERRIDABLE |\ + WBEM_FLAVOR_ORIGIN_PROPAGATED) + +static const struct record_qualifier data_qualifier[] = +{ + { class_process_getowner_outW, param_userW, CIM_SINT32, FLAVOR_ID, prop_idW, 0 }, + { class_process_getowner_outW, param_domainW, CIM_SINT32, FLAVOR_ID, prop_idW, 1 } +}; +static const struct record_sounddevice data_sounddevice[] = +{ + { sounddevice_productnameW } +}; +static const struct record_stdregprov data_stdregprov[] = +{ + { reg_enum_key, reg_enum_values, reg_get_stringvalue } +}; + +static void fill_cdromdrive( struct table *table ) +{ + static const WCHAR fmtW[] = {'%','c',':',0}; + WCHAR drive[3], root[] = {'A',':','\\',0}; + struct record_cdromdrive *rec; + UINT i, num_rows = 0, offset = 0, count = 1; + DWORD drives = GetLogicalDrives(); + + if (!(table->data = heap_alloc( count * sizeof(*rec) ))) return; + + for (i = 0; i < sizeof(drives); i++) + { + if (drives & (1 << i)) + { + root[0] = 'A' + i; + if (GetDriveTypeW( root ) != DRIVE_CDROM) + continue; + + if (num_rows > count) + { + BYTE *data; + count *= 2; + if (!(data = heap_realloc( table->data, count * sizeof(*rec) ))) return; + table->data = data; + } + rec = (struct record_cdromdrive *)(table->data + offset); + rec->device_id = cdromdrive_pnpdeviceidW; + sprintfW( drive, fmtW, 'A' + i ); + rec->drive = heap_strdupW( drive ); + rec->name = cdromdrive_nameW; + rec->pnpdevice_id = cdromdrive_pnpdeviceidW; + offset += sizeof(*rec); + num_rows++; + } + } + TRACE("created %u rows\n", num_rows); + table->num_rows = num_rows; +} + +static UINT get_processor_count(void) +{ + SYSTEM_BASIC_INFORMATION info; + + if (NtQuerySystemInformation( SystemBasicInformation, &info, sizeof(info), NULL )) return 1; + return info.NumberOfProcessors; +} + +static UINT get_logical_processor_count(void) +{ + SYSTEM_LOGICAL_PROCESSOR_INFORMATION *info; + UINT i, j, count = 0; + NTSTATUS status; + ULONG len; + + status = NtQuerySystemInformation( SystemLogicalProcessorInformation, NULL, 0, &len ); + if (status != STATUS_INFO_LENGTH_MISMATCH) return get_processor_count(); + + if (!(info = heap_alloc( len ))) return get_processor_count(); + status = NtQuerySystemInformation( SystemLogicalProcessorInformation, info, len, &len ); + if (status != STATUS_SUCCESS) + { + heap_free( info ); + return get_processor_count(); + } + for (i = 0; i < len / sizeof(*info); i++) + { + if (info[i].Relationship != RelationProcessorCore) continue; + for (j = 0; j < sizeof(ULONG_PTR); j++) if (info[i].ProcessorMask & (1 << j)) count++; + } + heap_free( info ); + return count; +} + +static UINT64 get_total_physical_memory(void) +{ + MEMORYSTATUSEX status; + + status.dwLength = sizeof(status); + if (!GlobalMemoryStatusEx( &status )) return 1024 * 1024 * 1024; + return status.ullTotalPhys; +} + +static void fill_compsys( struct table *table ) +{ + struct record_computersystem *rec; + + if (!(table->data = heap_alloc( sizeof(*rec) ))) return; + + rec = (struct record_computersystem *)table->data; + rec->description = compsys_descriptionW; + rec->domain = compsys_domainW; + rec->domainrole = 0; /* standalone workstation */ + rec->manufacturer = compsys_manufacturerW; + rec->model = compsys_modelW; + rec->num_logical_processors = get_logical_processor_count(); + rec->num_processors = get_processor_count(); + rec->total_physical_memory = get_total_physical_memory(); + + TRACE("created 1 row\n"); + table->num_rows = 1; +} + +static WCHAR *get_filesystem( const WCHAR *root ) +{ + static const WCHAR ntfsW[] = {'N','T','F','S',0}; + WCHAR buffer[MAX_PATH + 1]; + + if (GetVolumeInformationW( root, NULL, 0, NULL, NULL, NULL, buffer, MAX_PATH + 1 )) + return heap_strdupW( buffer ); + return heap_strdupW( ntfsW ); +} + +static UINT64 get_freespace( const WCHAR *dir, UINT64 *disksize ) +{ + WCHAR root[] = {'\\','\\','.','\\','A',':',0}; + ULARGE_INTEGER free; + DISK_GEOMETRY_EX info; + HANDLE handle; + + free.QuadPart = 512 * 1024 * 1024; + GetDiskFreeSpaceExW( dir, NULL, NULL, &free ); + + root[4] = dir[0]; + handle = CreateFileW( root, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0 ); + if (handle != INVALID_HANDLE_VALUE) + { + if (DeviceIoControl( handle, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, NULL, 0, &info, sizeof(info), NULL, NULL )) + *disksize = info.DiskSize.QuadPart; + CloseHandle( handle ); + } + return free.QuadPart; +} + +static void fill_diskpartition( struct table *table ) +{ + static const WCHAR fmtW[] = + {'D','i','s','k',' ','#','%','u',',',' ','P','a','r','t','i','t','i','o','n',' ','#','0',0}; + WCHAR device_id[32], root[] = {'A',':','\\',0}; + struct record_diskpartition *rec; + UINT i, num_rows = 0, offset = 0, count = 4, type, index = 0; + UINT64 size = 1024 * 1024 * 1024; + DWORD drives = GetLogicalDrives(); + + if (!(table->data = heap_alloc( count * sizeof(*rec) ))) return; + + for (i = 0; i < sizeof(drives); i++) + { + if (drives & (1 << i)) + { + root[0] = 'A' + i; + type = GetDriveTypeW( root ); + if (type != DRIVE_FIXED && type != DRIVE_REMOVABLE) + continue; + + if (num_rows > count) + { + BYTE *data; + count *= 2; + if (!(data = heap_realloc( table->data, count * sizeof(*rec) ))) return; + table->data = data; + } + rec = (struct record_diskpartition *)(table->data + offset); + rec->bootable = (i == 2) ? -1 : 0; + sprintfW( device_id, fmtW, index ); + rec->device_id = heap_strdupW( device_id ); + rec->diskindex = index; + rec->index = 0; + rec->pnpdevice_id = heap_strdupW( device_id ); + get_freespace( root, &size ); + rec->size = size; + rec->startingoffset = 0; + rec->type = get_filesystem( root ); + offset += sizeof(*rec); + num_rows++; + index++; + } + } + TRACE("created %u rows\n", num_rows); + table->num_rows = num_rows; +} + +static void fill_logicaldisk( struct table *table ) +{ + static const WCHAR fmtW[] = {'%','c',':',0}; + WCHAR device_id[3], root[] = {'A',':','\\',0}; + struct record_logicaldisk *rec; + UINT i, num_rows = 0, offset = 0, count = 4, type; + UINT64 size = 1024 * 1024 * 1024; + DWORD drives = GetLogicalDrives(); + + if (!(table->data = heap_alloc( count * sizeof(*rec) ))) return; + + for (i = 0; i < sizeof(drives); i++) + { + if (drives & (1 << i)) + { + root[0] = 'A' + i; + type = GetDriveTypeW( root ); + if (type != DRIVE_FIXED && type != DRIVE_CDROM && type != DRIVE_REMOVABLE) + continue; + + if (num_rows > count) + { + BYTE *data; + count *= 2; + if (!(data = heap_realloc( table->data, count * sizeof(*rec) ))) return; + table->data = data; + } + rec = (struct record_logicaldisk *)(table->data + offset); + sprintfW( device_id, fmtW, 'A' + i ); + rec->device_id = heap_strdupW( device_id ); + rec->drivetype = type; + rec->filesystem = get_filesystem( root ); + rec->freespace = get_freespace( root, &size ); + rec->name = heap_strdupW( device_id ); + rec->size = size; + offset += sizeof(*rec); + num_rows++; + } + } + TRACE("created %u rows\n", num_rows); + table->num_rows = num_rows; +} + +static UINT16 get_connection_status( IF_OPER_STATUS status ) +{ + switch (status) + { + case IfOperStatusDown: + return 0; /* Disconnected */ + case IfOperStatusUp: + return 2; /* Connected */ + default: + ERR("unhandled status %u\n", status); + break; + } + return 0; +} +static WCHAR *get_mac_address( const BYTE *addr, DWORD len ) +{ + static const WCHAR fmtW[] = + {'%','0','2','x',':','%','0','2','x',':','%','0','2','x',':', + '%','0','2','x',':','%','0','2','x',':','%','0','2','x',0}; + WCHAR *ret; + + if (len != 6 || !(ret = heap_alloc( 18 * sizeof(WCHAR) ))) return NULL; + sprintfW( ret, fmtW, addr[0], addr[1], addr[2], addr[3], addr[4], addr[5] ); + return ret; +} +static const WCHAR *get_adaptertype( DWORD type ) +{ + static const WCHAR ethernetW[] = {'E','t','h','e','r','n','e','t',' ','8','0','2','.','3',0}; + static const WCHAR wirelessW[] = {'W','i','r','e','l','e','s','s',0}; + static const WCHAR firewireW[] = {'1','3','9','4',0}; + static const WCHAR tunnelW[] = {'T','u','n','n','e','l',0}; + + switch (type) + { + case IF_TYPE_ETHERNET_CSMACD: return ethernetW; + case IF_TYPE_IEEE80211: return wirelessW; + case IF_TYPE_IEEE1394: return firewireW; + case IF_TYPE_TUNNEL: return tunnelW; + default: break; + } + return NULL; +} + +static void fill_networkadapter( struct table *table ) +{ + static const WCHAR fmtW[] = {'%','u',0}; + WCHAR device_id[11]; + struct record_networkadapter *rec; + IP_ADAPTER_ADDRESSES *aa, *buffer; + UINT num_rows = 0, offset = 0; + DWORD size = 0, ret; + + ret = GetAdaptersAddresses( AF_UNSPEC, 0, NULL, NULL, &size ); + if (ret != ERROR_BUFFER_OVERFLOW) return; + + if (!(buffer = heap_alloc( size ))) return; + if (GetAdaptersAddresses( AF_UNSPEC, 0, NULL, buffer, &size )) + { + heap_free( buffer ); + return; + } + for (aa = buffer; aa; aa = aa->Next) num_rows++; + if (!(table->data = heap_alloc( sizeof(*rec) * num_rows ))) + { + heap_free( buffer ); + return; + } + for (aa = buffer; aa; aa = aa->Next) + { + rec = (struct record_networkadapter *)(table->data + offset); + sprintfW( device_id, fmtW, aa->u.s.IfIndex ); + rec->adaptertype = get_adaptertype( aa->IfType ); + rec->device_id = heap_strdupW( device_id ); + rec->interface_index = aa->u.s.IfIndex; + rec->mac_address = get_mac_address( aa->PhysicalAddress, aa->PhysicalAddressLength ); + rec->manufacturer = compsys_manufacturerW; + rec->netconnection_status = get_connection_status( aa->OperStatus ); + rec->pnpdevice_id = networkadapter_pnpdeviceidW; + rec->speed = 1000000; + offset += sizeof(*rec); + } + TRACE("created %u rows\n", num_rows); + table->num_rows = num_rows; + + heap_free( buffer ); +} + +static WCHAR *get_cmdline( DWORD process_id ) +{ + if (process_id == GetCurrentProcessId()) return heap_strdupW( GetCommandLineW() ); + return NULL; /* FIXME handle different process case */ +} + +static void fill_process( struct table *table ) +{ + static const WCHAR fmtW[] = {'%','u',0}; + WCHAR handle[11]; + struct record_process *rec; + PROCESSENTRY32W entry; + HANDLE snap; + UINT num_rows = 0, offset = 0, count = 8; + + snap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 ); + if (snap == INVALID_HANDLE_VALUE) return; + + entry.dwSize = sizeof(entry); + if (!Process32FirstW( snap, &entry )) goto done; + if (!(table->data = heap_alloc( count * sizeof(*rec) ))) goto done; + + do + { + if (num_rows > count) + { + BYTE *data; + count *= 2; + if (!(data = heap_realloc( table->data, count * sizeof(*rec) ))) goto done; + table->data = data; + } + rec = (struct record_process *)(table->data + offset); + rec->caption = heap_strdupW( entry.szExeFile ); + rec->commandline = get_cmdline( entry.th32ProcessID ); + rec->description = heap_strdupW( entry.szExeFile ); + sprintfW( handle, fmtW, entry.th32ProcessID ); + rec->handle = heap_strdupW( handle ); + rec->process_id = entry.th32ProcessID; + rec->pprocess_id = entry.th32ParentProcessID; + rec->thread_count = entry.cntThreads; + rec->get_owner = process_get_owner; + offset += sizeof(*rec); + num_rows++; + } while (Process32NextW( snap, &entry )); + + TRACE("created %u rows\n", num_rows); + table->num_rows = num_rows; + +done: + CloseHandle( snap ); +} + +static inline void do_cpuid( unsigned int ax, unsigned int *p ) +{ +#ifdef __i386__ +#ifdef _MSC_VER + __cpuid(p, ax); +#else + __asm__("pushl %%ebx\n\t" + "cpuid\n\t" + "movl %%ebx, %%esi\n\t" + "popl %%ebx" + : "=a" (p[0]), "=S" (p[1]), "=c" (p[2]), "=d" (p[3]) + : "0" (ax)); +#endif +#endif +} + +static void get_processor_id( WCHAR *processor_id ) +{ + static const WCHAR fmtW[] = {'%','0','8','X','%','0','8','X',0}; + unsigned int regs[4] = {0, 0, 0, 0}; + + do_cpuid( 1, regs ); + sprintfW( processor_id, fmtW, regs[3], regs[0] ); +} +static void regs_to_str( unsigned int *regs, unsigned int len, WCHAR *buffer ) +{ + unsigned int i; + unsigned char *p = (unsigned char *)regs; + + for (i = 0; i < len; i++) + { + buffer[i] = *p++; + } + buffer[i] = 0; +} +static void get_processor_manufacturer( WCHAR *manufacturer ) +{ + unsigned int tmp, regs[4] = {0, 0, 0, 0}; + + do_cpuid( 0, regs ); + tmp = regs[2]; /* swap edx and ecx */ + regs[2] = regs[3]; + regs[3] = tmp; + + regs_to_str( regs + 1, 12, manufacturer ); +} +static void get_processor_name( WCHAR *name ) +{ + unsigned int regs[4] = {0, 0, 0, 0}; + + do_cpuid( 0x80000000, regs ); + if (regs[0] >= 0x80000004) + { + do_cpuid( 0x80000002, regs ); + regs_to_str( regs, 16, name ); + do_cpuid( 0x80000003, regs ); + regs_to_str( regs, 16, name + 16 ); + do_cpuid( 0x80000004, regs ); + regs_to_str( regs, 16, name + 32 ); + } +} +static UINT get_processor_maxclockspeed( void ) +{ + PROCESSOR_POWER_INFORMATION *info; + UINT ret = 1000, size = get_processor_count() * sizeof(PROCESSOR_POWER_INFORMATION); + NTSTATUS status; + + if ((info = heap_alloc( size ))) + { + status = NtPowerInformation( ProcessorInformation, NULL, 0, info, size ); + if (!status) ret = info[0].MaxMhz; + heap_free( info ); + } + return ret; +} + +static void fill_processor( struct table *table ) +{ + static const WCHAR fmtW[] = {'C','P','U','%','u',0}; + WCHAR device_id[14], processor_id[17], manufacturer[13], name[49] = {0}; + struct record_processor *rec; + UINT i, offset = 0, maxclockspeed, num_logical_processors, count = get_processor_count(); + + if (!(table->data = heap_alloc( sizeof(*rec) * count ))) return; + + get_processor_id( processor_id ); + get_processor_manufacturer( manufacturer ); + get_processor_name( name ); + + maxclockspeed = get_processor_maxclockspeed(); + num_logical_processors = get_logical_processor_count() / count; + + for (i = 0; i < count; i++) + { + rec = (struct record_processor *)(table->data + offset); + rec->cpu_status = 1; /* CPU Enabled */ + sprintfW( device_id, fmtW, i ); + rec->device_id = heap_strdupW( device_id ); + rec->manufacturer = heap_strdupW( manufacturer ); + rec->maxclockspeed = maxclockspeed; + rec->name = heap_strdupW( name ); + rec->num_logical_processors = num_logical_processors; + rec->processor_id = heap_strdupW( processor_id ); + rec->unique_id = NULL; + offset += sizeof(*rec); + } + + TRACE("created %u rows\n", count); + table->num_rows = count; +} + +static WCHAR *get_lastbootuptime(void) +{ + static const WCHAR fmtW[] = + {'%','0','4','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u', + '.','%','0','6','u','+','0','0','0',0}; + SYSTEM_TIMEOFDAY_INFORMATION ti; + TIME_FIELDS tf; + WCHAR *ret; + + if (!(ret = heap_alloc( 26 * sizeof(WCHAR) ))) return NULL; + + NtQuerySystemInformation( SystemTimeOfDayInformation, &ti, sizeof(ti), NULL ); + RtlTimeToTimeFields( &ti.liKeBootTime, &tf ); + sprintfW( ret, fmtW, tf.Year, tf.Month, tf.Day, tf.Hour, tf.Minute, tf.Second, tf.Milliseconds * 1000 ); + return ret; +} +static const WCHAR *get_osarchitecture(void) +{ + SYSTEM_INFO info; + GetNativeSystemInfo( &info ); + if (info.u.s.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) return os_64bitW; + return os_32bitW; +} +static WCHAR *get_systemdirectory(void) +{ + void *redir; + WCHAR *ret; + + if (!(ret = heap_alloc( MAX_PATH * sizeof(WCHAR) ))) return NULL; + Wow64DisableWow64FsRedirection( &redir ); + GetSystemDirectoryW( ret, MAX_PATH ); + Wow64RevertWow64FsRedirection( redir ); + return ret; +} + +static void fill_os( struct table *table ) +{ + struct record_operatingsystem *rec; + + if (!(table->data = heap_alloc( sizeof(*rec) ))) return; + + rec = (struct record_operatingsystem *)table->data; + rec->caption = os_captionW; + rec->csdversion = os_csdversionW; + rec->lastbootuptime = get_lastbootuptime(); + rec->osarchitecture = get_osarchitecture(); + rec->oslanguage = MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US ); + rec->systemdirectory = get_systemdirectory(); + + TRACE("created 1 row\n"); + table->num_rows = 1; +} + +static const WCHAR *get_service_type( DWORD type ) +{ + static const WCHAR filesystem_driverW[] = + {'F','i','l','e',' ','S','y','s','t','e','m',' ','D','r','i','v','e','r',0}; + static const WCHAR kernel_driverW[] = + {'K','e','r','n','e','l',' ','D','r','i','v','e','r',0}; + static const WCHAR own_processW[] = + {'O','w','n',' ','P','r','o','c','e','s','s',0}; + static const WCHAR share_processW[] = + {'S','h','a','r','e',' ','P','r','o','c','e','s','s',0}; + + if (type & SERVICE_KERNEL_DRIVER) return kernel_driverW; + else if (type & SERVICE_FILE_SYSTEM_DRIVER) return filesystem_driverW; + else if (type & SERVICE_WIN32_OWN_PROCESS) return own_processW; + else if (type & SERVICE_WIN32_SHARE_PROCESS) return share_processW; + else ERR("unhandled type 0x%08x\n", type); + return NULL; +} +static const WCHAR *get_service_state( DWORD state ) +{ + static const WCHAR runningW[] = + {'R','u','n','n','i','n','g',0}; + static const WCHAR start_pendingW[] = + {'S','t','a','r','t',' ','P','e','n','d','i','n','g',0}; + static const WCHAR stop_pendingW[] = + {'S','t','o','p',' ','P','e','n','d','i','n','g',0}; + static const WCHAR stoppedW[] = + {'S','t','o','p','p','e','d',0}; + static const WCHAR unknownW[] = + {'U','n','k','n','o','w','n',0}; + + switch (state) + { + case SERVICE_STOPPED: return stoppedW; + case SERVICE_START_PENDING: return start_pendingW; + case SERVICE_STOP_PENDING: return stop_pendingW; + case SERVICE_RUNNING: return runningW; + default: + ERR("unknown state %u\n", state); + return unknownW; + } +} + +static const WCHAR *get_service_startmode( DWORD mode ) +{ + static const WCHAR bootW[] = {'B','o','o','t',0}; + static const WCHAR systemW[] = {'S','y','s','t','e','m',0}; + static const WCHAR autoW[] = {'A','u','t','o',0}; + static const WCHAR manualW[] = {'M','a','n','u','a','l',0}; + static const WCHAR disabledW[] = {'D','i','s','a','b','l','e','d',0}; + static const WCHAR unknownW[] = {'U','n','k','n','o','w','n',0}; + + switch (mode) + { + case SERVICE_BOOT_START: return bootW; + case SERVICE_SYSTEM_START: return systemW; + case SERVICE_AUTO_START: return autoW; + case SERVICE_DEMAND_START: return manualW; + case SERVICE_DISABLED: return disabledW; + default: + ERR("unknown mode 0x%x\n", mode); + return unknownW; + } +} + +static QUERY_SERVICE_CONFIGW *query_service_config( SC_HANDLE manager, const WCHAR *name ) +{ + QUERY_SERVICE_CONFIGW *config = NULL; + SC_HANDLE service; + DWORD size; + + if (!(service = OpenServiceW( manager, name, SERVICE_QUERY_CONFIG ))) return NULL; + QueryServiceConfigW( service, NULL, 0, &size ); + if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) goto done; + if (!(config = heap_alloc( size ))) goto done; + if (QueryServiceConfigW( service, config, size, &size )) goto done; + heap_free( config ); + config = NULL; + +done: + CloseServiceHandle( service ); + return config; +} + +static void fill_service( struct table *table ) +{ + struct record_service *rec; + SC_HANDLE manager; + ENUM_SERVICE_STATUS_PROCESSW *tmp, *services = NULL; + SERVICE_STATUS_PROCESS *status; + WCHAR sysnameW[MAX_COMPUTERNAME_LENGTH + 1]; + DWORD len = sizeof(sysnameW) / sizeof(sysnameW[0]); + UINT i, num_rows = 0, offset = 0, size = 256, needed, count; + BOOL ret; + + if (!(manager = OpenSCManagerW( NULL, NULL, SC_MANAGER_ENUMERATE_SERVICE ))) return; + if (!(services = heap_alloc( size ))) goto done; + + ret = EnumServicesStatusExW( manager, SC_ENUM_PROCESS_INFO, SERVICE_TYPE_ALL, + SERVICE_STATE_ALL, (BYTE *)services, size, &needed, + &count, NULL, NULL ); + if (!ret) + { + if (GetLastError() != ERROR_MORE_DATA) goto done; + size = needed; + if (!(tmp = heap_realloc( services, size ))) goto done; + services = tmp; + ret = EnumServicesStatusExW( manager, SC_ENUM_PROCESS_INFO, SERVICE_TYPE_ALL, + SERVICE_STATE_ALL, (BYTE *)services, size, &needed, + &count, NULL, NULL ); + if (!ret) goto done; + } + if (!(table->data = heap_alloc( sizeof(*rec) * count ))) goto done; + + GetComputerNameW( sysnameW, &len ); + + for (i = 0; i < count; i++) + { + QUERY_SERVICE_CONFIGW *config; + + if (!(config = query_service_config( manager, services[i].lpServiceName ))) continue; + + status = &services[i].ServiceStatusProcess; + rec = (struct record_service *)(table->data + offset); + rec->accept_pause = (status->dwControlsAccepted & SERVICE_ACCEPT_PAUSE_CONTINUE) ? -1 : 0; + rec->accept_stop = (status->dwControlsAccepted & SERVICE_ACCEPT_STOP) ? -1 : 0; + rec->displayname = heap_strdupW( services[i].lpDisplayName ); + rec->name = heap_strdupW( services[i].lpServiceName ); + rec->process_id = status->dwProcessId; + rec->servicetype = get_service_type( status->dwServiceType ); + rec->startmode = get_service_startmode( config->dwStartType ); + rec->state = get_service_state( status->dwCurrentState ); + rec->systemname = heap_strdupW( sysnameW ); + rec->pause_service = service_pause_service; + rec->resume_service = service_resume_service; + rec->start_service = service_start_service; + rec->stop_service = service_stop_service; + heap_free( config ); + offset += sizeof(*rec); + num_rows++; + } + + TRACE("created %u rows\n", num_rows); + table->num_rows = num_rows; + +done: + CloseServiceHandle( manager ); + heap_free( services ); +} + +static UINT32 get_bits_per_pixel( UINT *hres, UINT *vres ) +{ + HDC hdc = GetDC( NULL ); + UINT32 ret; + + if (!hdc) return 32; + ret = GetDeviceCaps( hdc, BITSPIXEL ); + *hres = GetDeviceCaps( hdc, HORZRES ); + *vres = GetDeviceCaps( hdc, VERTRES ); + ReleaseDC( NULL, hdc ); + return ret; +} + +static WCHAR *get_pnpdeviceid( DXGI_ADAPTER_DESC *desc ) +{ + static const WCHAR fmtW[] = + {'P','C','I','\\','V','E','N','_','%','0','4','X','&','D','E','V','_','%','0','4','X', + '&','S','U','B','S','Y','S','_','%','0','8','X','&','R','E','V','_','%','0','2','X','\\', + '0','&','D','E','A','D','B','E','E','F','&','0','&','D','E','A','D',0}; + WCHAR *ret; + + if (!(ret = heap_alloc( sizeof(fmtW) + 2 * sizeof(WCHAR) ))) return NULL; + sprintfW( ret, fmtW, desc->VendorId, desc->DeviceId, desc->SubSysId, desc->Revision ); + return ret; +} + +static void fill_videocontroller( struct table *table ) +{ + + struct record_videocontroller *rec; + HRESULT hr; + IDXGIFactory *factory = NULL; + IDXGIAdapter *adapter = NULL; + DXGI_ADAPTER_DESC desc; + UINT hres = 1024, vres = 768, vidmem = 512 * 1024 * 1024; + const WCHAR *name = videocontroller_deviceidW; + + if (!(table->data = heap_alloc( sizeof(*rec) ))) return; + + hr = CreateDXGIFactory( &IID_IDXGIFactory, (void **)&factory ); + if (FAILED(hr)) goto done; + + hr = IDXGIFactory_EnumAdapters( factory, 0, &adapter ); + if (FAILED(hr)) goto done; + + hr = IDXGIAdapter_GetDesc( adapter, &desc ); + if (SUCCEEDED(hr)) + { + vidmem = desc.DedicatedVideoMemory; + name = desc.Description; + } + +done: + rec = (struct record_videocontroller *)table->data; + rec->adapter_ram = vidmem; + rec->current_bitsperpixel = get_bits_per_pixel( &hres, &vres ); + rec->current_horizontalres = hres; + rec->current_verticalres = vres; + rec->description = heap_strdupW( name ); + rec->device_id = videocontroller_deviceidW; + rec->name = heap_strdupW( name ); + rec->pnpdevice_id = get_pnpdeviceid( &desc ); + + TRACE("created 1 row\n"); + table->num_rows = 1; + + if (adapter) IDXGIAdapter_Release( adapter ); + if (factory) IDXGIFactory_Release( factory ); +} + +static struct table builtin_classes[] = +{ + { class_baseboardW, SIZEOF(col_baseboard), col_baseboard, SIZEOF(data_baseboard), (BYTE *)data_baseboard }, + { class_biosW, SIZEOF(col_bios), col_bios, SIZEOF(data_bios), (BYTE *)data_bios }, + { class_cdromdriveW, SIZEOF(col_cdromdrive), col_cdromdrive, 0, NULL, fill_cdromdrive }, + { class_compsysW, SIZEOF(col_compsys), col_compsys, 0, NULL, fill_compsys }, + { class_diskdriveW, SIZEOF(col_diskdrive), col_diskdrive, SIZEOF(data_diskdrive), (BYTE *)data_diskdrive }, + { class_diskpartitionW, SIZEOF(col_diskpartition), col_diskpartition, 0, NULL, fill_diskpartition }, + { class_logicaldiskW, SIZEOF(col_logicaldisk), col_logicaldisk, 0, NULL, fill_logicaldisk }, + { class_networkadapterW, SIZEOF(col_networkadapter), col_networkadapter, 0, NULL, fill_networkadapter }, + { class_osW, SIZEOF(col_os), col_os, 0, NULL, fill_os }, + { class_paramsW, SIZEOF(col_param), col_param, SIZEOF(data_param), (BYTE *)data_param }, + { class_processW, SIZEOF(col_process), col_process, 0, NULL, fill_process }, + { class_processorW, SIZEOF(col_processor), col_processor, 0, NULL, fill_processor }, + { class_qualifiersW, SIZEOF(col_qualifier), col_qualifier, SIZEOF(data_qualifier), (BYTE *)data_qualifier }, + { class_serviceW, SIZEOF(col_service), col_service, 0, NULL, fill_service }, + { class_sounddeviceW, SIZEOF(col_sounddevice), col_sounddevice, SIZEOF(data_sounddevice), (BYTE *)data_sounddevice }, + { class_stdregprovW, SIZEOF(col_stdregprov), col_stdregprov, SIZEOF(data_stdregprov), (BYTE *)data_stdregprov }, + { class_videocontrollerW, SIZEOF(col_videocontroller), col_videocontroller, 0, NULL, fill_videocontroller } +}; + +void init_table_list( void ) +{ + static struct list tables = LIST_INIT( tables ); + UINT i; + + for (i = 0; i < SIZEOF(builtin_classes); i++) list_add_tail( &tables, &builtin_classes[i].entry ); + table_list = &tables; +} diff --git a/reactos/dll/win32/wbemprox/class.c b/reactos/dll/win32/wbemprox/class.c new file mode 100644 index 00000000000..3bbd0b1ba18 --- /dev/null +++ b/reactos/dll/win32/wbemprox/class.c @@ -0,0 +1,1039 @@ +/* + * Copyright 2012 Hans Leidekker for CodeWeavers + * + * 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 + */ + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H + +#define COBJMACROS + +#include "config.h" +#include + +#include "windef.h" +#include "winbase.h" +#include "ole2.h" +#include "wbemcli.h" + +#include "wine/debug.h" +#include "wbemprox_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wbemprox); + +struct enum_class_object +{ + IEnumWbemClassObject IEnumWbemClassObject_iface; + LONG refs; + struct query *query; + UINT index; +}; + +static inline struct enum_class_object *impl_from_IEnumWbemClassObject( + IEnumWbemClassObject *iface ) +{ + return CONTAINING_RECORD(iface, struct enum_class_object, IEnumWbemClassObject_iface); +} + +static ULONG WINAPI enum_class_object_AddRef( + IEnumWbemClassObject *iface ) +{ + struct enum_class_object *ec = impl_from_IEnumWbemClassObject( iface ); + return InterlockedIncrement( &ec->refs ); +} + +static ULONG WINAPI enum_class_object_Release( + IEnumWbemClassObject *iface ) +{ + struct enum_class_object *ec = impl_from_IEnumWbemClassObject( iface ); + LONG refs = InterlockedDecrement( &ec->refs ); + if (!refs) + { + TRACE("destroying %p\n", ec); + release_query( ec->query ); + heap_free( ec ); + } + return refs; +} + +static HRESULT WINAPI enum_class_object_QueryInterface( + IEnumWbemClassObject *iface, + REFIID riid, + void **ppvObject ) +{ + struct enum_class_object *ec = impl_from_IEnumWbemClassObject( iface ); + + TRACE("%p, %s, %p\n", ec, debugstr_guid( riid ), ppvObject ); + + if ( IsEqualGUID( riid, &IID_IEnumWbemClassObject ) || + IsEqualGUID( riid, &IID_IUnknown ) ) + { + *ppvObject = ec; + } + else if ( IsEqualGUID( riid, &IID_IClientSecurity ) ) + { + *ppvObject = &client_security; + return S_OK; + } + else + { + FIXME("interface %s not implemented\n", debugstr_guid(riid)); + return E_NOINTERFACE; + } + IEnumWbemClassObject_AddRef( iface ); + return S_OK; +} + +static HRESULT WINAPI enum_class_object_Reset( + IEnumWbemClassObject *iface ) +{ + struct enum_class_object *ec = impl_from_IEnumWbemClassObject( iface ); + + TRACE("%p\n", iface); + + ec->index = 0; + return WBEM_S_NO_ERROR; +} + +static HRESULT WINAPI enum_class_object_Next( + IEnumWbemClassObject *iface, + LONG lTimeout, + ULONG uCount, + IWbemClassObject **apObjects, + ULONG *puReturned ) +{ + struct enum_class_object *ec = impl_from_IEnumWbemClassObject( iface ); + struct view *view = ec->query->view; + HRESULT hr; + + TRACE("%p, %d, %u, %p, %p\n", iface, lTimeout, uCount, apObjects, puReturned); + + if (!uCount) return WBEM_S_FALSE; + if (!apObjects || !puReturned) return WBEM_E_INVALID_PARAMETER; + if (lTimeout != WBEM_INFINITE) FIXME("timeout not supported\n"); + + *puReturned = 0; + if (ec->index >= view->count) return WBEM_S_FALSE; + + hr = create_class_object( view->table->name, iface, ec->index, NULL, apObjects ); + if (hr != S_OK) return hr; + + ec->index++; + *puReturned = 1; + if (ec->index == view->count) return WBEM_S_FALSE; + if (uCount > 1) return WBEM_S_TIMEDOUT; + return WBEM_S_NO_ERROR; +} + +static HRESULT WINAPI enum_class_object_NextAsync( + IEnumWbemClassObject *iface, + ULONG uCount, + IWbemObjectSink *pSink ) +{ + FIXME("%p, %u, %p\n", iface, uCount, pSink); + return E_NOTIMPL; +} + +static HRESULT WINAPI enum_class_object_Clone( + IEnumWbemClassObject *iface, + IEnumWbemClassObject **ppEnum ) +{ + struct enum_class_object *ec = impl_from_IEnumWbemClassObject( iface ); + + TRACE("%p, %p\n", iface, ppEnum); + + return EnumWbemClassObject_create( NULL, ec->query, (void **)ppEnum ); +} + +static HRESULT WINAPI enum_class_object_Skip( + IEnumWbemClassObject *iface, + LONG lTimeout, + ULONG nCount ) +{ + struct enum_class_object *ec = impl_from_IEnumWbemClassObject( iface ); + struct view *view = ec->query->view; + + TRACE("%p, %d, %u\n", iface, lTimeout, nCount); + + if (lTimeout != WBEM_INFINITE) FIXME("timeout not supported\n"); + + if (!view->count) return WBEM_S_FALSE; + + if (nCount > view->count - ec->index) + { + ec->index = view->count - 1; + return WBEM_S_FALSE; + } + ec->index += nCount; + return WBEM_S_NO_ERROR; +} + +static const IEnumWbemClassObjectVtbl enum_class_object_vtbl = +{ + enum_class_object_QueryInterface, + enum_class_object_AddRef, + enum_class_object_Release, + enum_class_object_Reset, + enum_class_object_Next, + enum_class_object_NextAsync, + enum_class_object_Clone, + enum_class_object_Skip +}; + +HRESULT EnumWbemClassObject_create( + IUnknown *pUnkOuter, struct query *query, LPVOID *ppObj ) +{ + struct enum_class_object *ec; + + TRACE("%p, %p\n", pUnkOuter, ppObj); + + ec = heap_alloc( sizeof(*ec) ); + if (!ec) return E_OUTOFMEMORY; + + ec->IEnumWbemClassObject_iface.lpVtbl = &enum_class_object_vtbl; + ec->refs = 1; + ec->query = addref_query( query ); + ec->index = 0; + + *ppObj = &ec->IEnumWbemClassObject_iface; + + TRACE("returning iface %p\n", *ppObj); + return S_OK; +} + +static struct record *create_record( struct table *table ) +{ + UINT i; + struct record *record; + + if (!(record = heap_alloc( sizeof(struct record) ))) return NULL; + if (!(record->fields = heap_alloc( table->num_cols * sizeof(struct field) ))) + { + heap_free( record ); + return NULL; + } + for (i = 0; i < table->num_cols; i++) + { + record->fields[i].type = table->columns[i].type; + record->fields[i].vartype = table->columns[i].vartype; + record->fields[i].u.ival = 0; + } + record->count = table->num_cols; + record->table = addref_table( table ); + return record; +} + +void destroy_array( struct array *array, CIMTYPE type ) +{ + UINT i, size; + + if (!array) return; + if (type == CIM_STRING || type == CIM_DATETIME) + { + size = get_type_size( type ); + for (i = 0; i < array->count; i++) heap_free( *(WCHAR **)((char *)array->ptr + i * size) ); + } + heap_free( array->ptr ); + heap_free( array ); +} + +static void destroy_record( struct record *record ) +{ + UINT i; + + if (!record) return; + release_table( record->table ); + for (i = 0; i < record->count; i++) + { + if (record->fields[i].type == CIM_STRING || record->fields[i].type == CIM_DATETIME) + heap_free( record->fields[i].u.sval ); + else if (record->fields[i].type & CIM_FLAG_ARRAY) + destroy_array( record->fields[i].u.aval, record->fields[i].type & CIM_TYPE_MASK ); + } + heap_free( record->fields ); + heap_free( record ); +} + +struct class_object +{ + IWbemClassObject IWbemClassObject_iface; + LONG refs; + WCHAR *name; + IEnumWbemClassObject *iter; + UINT index; + UINT index_method; + UINT index_property; + struct record *record; /* uncommitted instance */ +}; + +static inline struct class_object *impl_from_IWbemClassObject( + IWbemClassObject *iface ) +{ + return CONTAINING_RECORD(iface, struct class_object, IWbemClassObject_iface); +} + +static ULONG WINAPI class_object_AddRef( + IWbemClassObject *iface ) +{ + struct class_object *co = impl_from_IWbemClassObject( iface ); + return InterlockedIncrement( &co->refs ); +} + +static ULONG WINAPI class_object_Release( + IWbemClassObject *iface ) +{ + struct class_object *co = impl_from_IWbemClassObject( iface ); + LONG refs = InterlockedDecrement( &co->refs ); + if (!refs) + { + TRACE("destroying %p\n", co); + if (co->iter) IEnumWbemClassObject_Release( co->iter ); + destroy_record( co->record ); + heap_free( co->name ); + heap_free( co ); + } + return refs; +} + +static HRESULT WINAPI class_object_QueryInterface( + IWbemClassObject *iface, + REFIID riid, + void **ppvObject ) +{ + struct class_object *co = impl_from_IWbemClassObject( iface ); + + TRACE("%p, %s, %p\n", co, debugstr_guid( riid ), ppvObject ); + + if ( IsEqualGUID( riid, &IID_IWbemClassObject ) || + IsEqualGUID( riid, &IID_IUnknown ) ) + { + *ppvObject = co; + } + else if (IsEqualGUID( riid, &IID_IClientSecurity )) + { + *ppvObject = &client_security; + return S_OK; + } + else + { + FIXME("interface %s not implemented\n", debugstr_guid(riid)); + return E_NOINTERFACE; + } + IWbemClassObject_AddRef( iface ); + return S_OK; +} + +static HRESULT WINAPI class_object_GetQualifierSet( + IWbemClassObject *iface, + IWbemQualifierSet **ppQualSet ) +{ + FIXME("%p, %p\n", iface, ppQualSet); + return E_NOTIMPL; +} + +static HRESULT record_get_value( const struct record *record, UINT index, VARIANT *var, CIMTYPE *type ) +{ + VARTYPE vartype = record->fields[index].vartype; + + if (type) *type = record->fields[index].type; + + if (record->fields[index].type & CIM_FLAG_ARRAY) + { + V_VT( var ) = vartype ? vartype : to_vartype( record->fields[index].type & CIM_TYPE_MASK ) | VT_ARRAY; + V_ARRAY( var ) = to_safearray( record->fields[index].u.aval, record->fields[index].type & CIM_TYPE_MASK ); + return S_OK; + } + switch (record->fields[index].type) + { + case CIM_STRING: + case CIM_DATETIME: + if (!vartype) vartype = VT_BSTR; + V_BSTR( var ) = SysAllocString( record->fields[index].u.sval ); + break; + case CIM_SINT32: + if (!vartype) vartype = VT_I4; + V_I4( var ) = record->fields[index].u.ival; + break; + case CIM_UINT32: + if (!vartype) vartype = VT_UI4; + V_UI4( var ) = record->fields[index].u.ival; + break; + default: + FIXME("unhandled type %u\n", record->fields[index].type); + return WBEM_E_INVALID_PARAMETER; + } + V_VT( var ) = vartype; + return S_OK; +} + +static HRESULT WINAPI class_object_Get( + IWbemClassObject *iface, + LPCWSTR wszName, + LONG lFlags, + VARIANT *pVal, + CIMTYPE *pType, + LONG *plFlavor ) +{ + struct class_object *co = impl_from_IWbemClassObject( iface ); + struct enum_class_object *ec = impl_from_IEnumWbemClassObject( co->iter ); + + TRACE("%p, %s, %08x, %p, %p, %p\n", iface, debugstr_w(wszName), lFlags, pVal, pType, plFlavor); + + if (co->record) + { + UINT index; + HRESULT hr; + + if ((hr = get_column_index( co->record->table, wszName, &index )) != S_OK) return hr; + return record_get_value( co->record, index, pVal, pType ); + } + return get_propval( ec->query->view, co->index, wszName, pVal, pType, plFlavor ); +} + +static HRESULT record_set_value( struct record *record, UINT index, VARIANT *var ) +{ + LONGLONG val; + CIMTYPE type; + HRESULT hr; + + if ((hr = to_longlong( var, &val, &type )) != S_OK) return hr; + if (type != record->fields[index].type) return WBEM_E_TYPE_MISMATCH; + + if (type & CIM_FLAG_ARRAY) + { + record->fields[index].u.aval = (struct array *)(INT_PTR)val; + return S_OK; + } + switch (type) + { + case CIM_STRING: + case CIM_DATETIME: + record->fields[index].u.sval = (WCHAR *)(INT_PTR)val; + return S_OK; + case CIM_SINT16: + case CIM_UINT16: + case CIM_SINT32: + case CIM_UINT32: + record->fields[index].u.ival = val; + return S_OK; + default: + FIXME("unhandled type %u\n", type); + break; + } + return WBEM_E_INVALID_PARAMETER; +} + +static HRESULT WINAPI class_object_Put( + IWbemClassObject *iface, + LPCWSTR wszName, + LONG lFlags, + VARIANT *pVal, + CIMTYPE Type ) +{ + struct class_object *co = impl_from_IWbemClassObject( iface ); + struct enum_class_object *ec = impl_from_IEnumWbemClassObject( co->iter ); + + TRACE("%p, %s, %08x, %p, %u\n", iface, debugstr_w(wszName), lFlags, pVal, Type); + + if (co->record) + { + UINT index; + HRESULT hr; + + if ((hr = get_column_index( co->record->table, wszName, &index )) != S_OK) return hr; + return record_set_value( co->record, index, pVal ); + } + return put_propval( ec->query->view, co->index, wszName, pVal, Type ); +} + +static HRESULT WINAPI class_object_Delete( + IWbemClassObject *iface, + LPCWSTR wszName ) +{ + FIXME("%p, %s\n", iface, debugstr_w(wszName)); + return E_NOTIMPL; +} + +static HRESULT WINAPI class_object_GetNames( + IWbemClassObject *iface, + LPCWSTR wszQualifierName, + LONG lFlags, + VARIANT *pQualifierVal, + SAFEARRAY **pNames ) +{ + struct class_object *co = impl_from_IWbemClassObject( iface ); + struct enum_class_object *ec = impl_from_IEnumWbemClassObject( co->iter ); + + TRACE("%p, %s, %08x, %s, %p\n", iface, debugstr_w(wszQualifierName), lFlags, + debugstr_variant(pQualifierVal), pNames); + + if (wszQualifierName || pQualifierVal) + { + FIXME("qualifier not supported\n"); + return E_NOTIMPL; + } + if (lFlags != WBEM_FLAG_ALWAYS) + { + FIXME("flags %08x not supported\n", lFlags); + return E_NOTIMPL; + } + return get_properties( ec->query->view, pNames ); +} + +static HRESULT WINAPI class_object_BeginEnumeration( + IWbemClassObject *iface, + LONG lEnumFlags ) +{ + struct class_object *co = impl_from_IWbemClassObject( iface ); + + TRACE("%p, %08x\n", iface, lEnumFlags); + + if (lEnumFlags) FIXME("flags 0x%08x not supported\n", lEnumFlags); + + co->index_property = 0; + return S_OK; +} + +static HRESULT WINAPI class_object_Next( + IWbemClassObject *iface, + LONG lFlags, + BSTR *strName, + VARIANT *pVal, + CIMTYPE *pType, + LONG *plFlavor ) +{ + struct class_object *co = impl_from_IWbemClassObject( iface ); + struct enum_class_object *ec = impl_from_IEnumWbemClassObject( co->iter ); + struct view *view = ec->query->view; + BSTR property; + HRESULT hr; + + TRACE("%p, %08x, %p, %p, %p, %p\n", iface, lFlags, strName, pVal, pType, plFlavor); + + if (!(property = get_property_name( co->name, co->index_property ))) return WBEM_S_NO_MORE_DATA; + if ((hr = get_propval( view, co->index, property, pVal, pType, plFlavor ) != S_OK)) + { + SysFreeString( property ); + return hr; + } + *strName = property; + co->index_property++; + return S_OK; +} + +static HRESULT WINAPI class_object_EndEnumeration( + IWbemClassObject *iface ) +{ + struct class_object *co = impl_from_IWbemClassObject( iface ); + + TRACE("%p\n", iface); + + co->index_property = 0; + return S_OK; +} + +static HRESULT WINAPI class_object_GetPropertyQualifierSet( + IWbemClassObject *iface, + LPCWSTR wszProperty, + IWbemQualifierSet **ppQualSet ) +{ + struct class_object *co = impl_from_IWbemClassObject( iface ); + + TRACE("%p, %s, %p\n", iface, debugstr_w(wszProperty), ppQualSet); + + return WbemQualifierSet_create( NULL, co->name, wszProperty, (void **)ppQualSet ); +} + +static HRESULT WINAPI class_object_Clone( + IWbemClassObject *iface, + IWbemClassObject **ppCopy ) +{ + FIXME("%p, %p\n", iface, ppCopy); + return E_NOTIMPL; +} + +static BSTR get_body_text( const struct table *table, UINT row, UINT *len ) +{ + static const WCHAR fmtW[] = {'\n','\t','%','s',' ','=',' ','%','s',';',0}; + BSTR value, ret; + WCHAR *p; + UINT i; + + *len = 0; + for (i = 0; i < table->num_cols; i++) + { + if ((value = get_value_bstr( table, row, i ))) + { + *len += sizeof(fmtW) / sizeof(fmtW[0]); + *len += strlenW( table->columns[i].name ); + *len += SysStringLen( value ); + SysFreeString( value ); + } + } + if (!(ret = SysAllocStringLen( NULL, *len ))) return NULL; + p = ret; + for (i = 0; i < table->num_cols; i++) + { + if ((value = get_value_bstr( table, row, i ))) + { + p += sprintfW( p, fmtW, table->columns[i].name, value ); + SysFreeString( value ); + } + } + return ret; +} + +static BSTR get_object_text( const struct view *view, UINT index ) +{ + static const WCHAR fmtW[] = + {'\n','i','n','s','t','a','n','c','e',' ','o','f',' ','%','s','\n','{','%','s','\n','}',';',0}; + UINT len, len_body, row = view->result[index]; + BSTR ret, body; + + len = sizeof(fmtW) / sizeof(fmtW[0]); + len += strlenW( view->table->name ); + if (!(body = get_body_text( view->table, row, &len_body ))) return NULL; + len += len_body; + + if (!(ret = SysAllocStringLen( NULL, len ))) return NULL; + sprintfW( ret, fmtW, view->table->name, body ); + SysFreeString( body ); + return ret; +} + +static HRESULT WINAPI class_object_GetObjectText( + IWbemClassObject *iface, + LONG lFlags, + BSTR *pstrObjectText ) +{ + struct class_object *co = impl_from_IWbemClassObject( iface ); + struct enum_class_object *ec = impl_from_IEnumWbemClassObject( co->iter ); + struct view *view = ec->query->view; + BSTR text; + + TRACE("%p, %08x, %p\n", iface, lFlags, pstrObjectText); + + if (lFlags) FIXME("flags %08x not implemented\n", lFlags); + + if (!(text = get_object_text( view, co->index ))) return E_OUTOFMEMORY; + *pstrObjectText = text; + return S_OK; +} + +static HRESULT WINAPI class_object_SpawnDerivedClass( + IWbemClassObject *iface, + LONG lFlags, + IWbemClassObject **ppNewClass ) +{ + FIXME("%p, %08x, %p\n", iface, lFlags, ppNewClass); + return E_NOTIMPL; +} + +static HRESULT WINAPI class_object_SpawnInstance( + IWbemClassObject *iface, + LONG lFlags, + IWbemClassObject **ppNewInstance ) +{ + struct class_object *co = impl_from_IWbemClassObject( iface ); + struct enum_class_object *ec = impl_from_IEnumWbemClassObject( co->iter ); + struct view *view = ec->query->view; + struct record *record; + + TRACE("%p, %08x, %p\n", iface, lFlags, ppNewInstance); + + if (!(record = create_record( view->table ))) return E_OUTOFMEMORY; + + return create_class_object( co->name, NULL, 0, record, ppNewInstance ); +} + +static HRESULT WINAPI class_object_CompareTo( + IWbemClassObject *iface, + LONG lFlags, + IWbemClassObject *pCompareTo ) +{ + FIXME("%p, %08x, %p\n", iface, lFlags, pCompareTo); + return E_NOTIMPL; +} + +static HRESULT WINAPI class_object_GetPropertyOrigin( + IWbemClassObject *iface, + LPCWSTR wszName, + BSTR *pstrClassName ) +{ + FIXME("%p, %s, %p\n", iface, debugstr_w(wszName), pstrClassName); + return E_NOTIMPL; +} + +static HRESULT WINAPI class_object_InheritsFrom( + IWbemClassObject *iface, + LPCWSTR strAncestor ) +{ + FIXME("%p, %s\n", iface, debugstr_w(strAncestor)); + return E_NOTIMPL; +} + +static UINT count_instances( IEnumWbemClassObject *iter ) +{ + UINT count = 0; + while (!IEnumWbemClassObject_Skip( iter, WBEM_INFINITE, 1 )) count++; + IEnumWbemClassObject_Reset( iter ); + return count; +} + +static void set_default_value( CIMTYPE type, UINT val, BYTE *ptr ) +{ + switch (type) + { + case CIM_SINT16: + *(INT16 *)ptr = val; + break; + case CIM_UINT16: + *(UINT16 *)ptr = val; + break; + case CIM_SINT32: + *(INT32 *)ptr = val; + break; + case CIM_UINT32: + *(UINT32 *)ptr = val; + break; + default: + FIXME("unhandled type %u\n", type); + break; + } +} + +static HRESULT create_signature_columns_and_data( IEnumWbemClassObject *iter, UINT *num_cols, + struct column **cols, BYTE **data ) +{ + static const WCHAR parameterW[] = {'P','a','r','a','m','e','t','e','r',0}; + static const WCHAR typeW[] = {'T','y','p','e',0}; + static const WCHAR varianttypeW[] = {'V','a','r','i','a','n','t','T','y','p','e',0}; + static const WCHAR defaultvalueW[] = {'D','e','f','a','u','l','t','V','a','l','u','e',0}; + struct column *columns; + BYTE *row; + IWbemClassObject *param; + VARIANT val; + HRESULT hr = E_OUTOFMEMORY; + UINT offset = 0; + ULONG count; + int i = 0; + + count = count_instances( iter ); + if (!(columns = heap_alloc( count * sizeof(struct column) ))) return E_OUTOFMEMORY; + if (!(row = heap_alloc_zero( count * sizeof(LONGLONG) ))) goto error; + + for (;;) + { + IEnumWbemClassObject_Next( iter, WBEM_INFINITE, 1, ¶m, &count ); + if (!count) break; + + hr = IWbemClassObject_Get( param, parameterW, 0, &val, NULL, NULL ); + if (hr != S_OK) goto error; + columns[i].name = heap_strdupW( V_BSTR( &val ) ); + VariantClear( &val ); + + hr = IWbemClassObject_Get( param, typeW, 0, &val, NULL, NULL ); + if (hr != S_OK) goto error; + columns[i].type = V_UI4( &val ); + + hr = IWbemClassObject_Get( param, varianttypeW, 0, &val, NULL, NULL ); + if (hr != S_OK) goto error; + columns[i].vartype = V_UI4( &val ); + + hr = IWbemClassObject_Get( param, defaultvalueW, 0, &val, NULL, NULL ); + if (hr != S_OK) goto error; + if (V_UI4( &val )) set_default_value( columns[i].type, V_UI4( &val ), row + offset ); + offset += get_type_size( columns[i].type ); + + IWbemClassObject_Release( param ); + i++; + } + *num_cols = i; + *cols = columns; + *data = row; + return S_OK; + +error: + for (; i >= 0; i--) heap_free( (WCHAR *)columns[i].name ); + heap_free( columns ); + heap_free( row ); + return hr; +} + +static HRESULT create_signature_table( IEnumWbemClassObject *iter, WCHAR *name ) +{ + HRESULT hr; + struct table *table; + struct column *columns; + UINT num_cols; + BYTE *row; + + hr = create_signature_columns_and_data( iter, &num_cols, &columns, &row ); + if (hr != S_OK) return hr; + + if (!(table = create_table( name, num_cols, columns, 1, row, NULL ))) + { + free_columns( columns, num_cols ); + heap_free( row ); + return E_OUTOFMEMORY; + } + if (!add_table( table )) free_table( table ); /* already exists */ + return S_OK; +} + +static WCHAR *build_signature_table_name( const WCHAR *class, const WCHAR *method, enum param_direction dir ) +{ + static const WCHAR fmtW[] = {'_','_','%','s','_','%','s','_','%','s',0}; + static const WCHAR outW[] = {'O','U','T',0}; + static const WCHAR inW[] = {'I','N',0}; + UINT len = SIZEOF(fmtW) + SIZEOF(outW) + strlenW( class ) + strlenW( method ); + WCHAR *ret; + + if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL; + sprintfW( ret, fmtW, class, method, dir == PARAM_IN ? inW : outW ); + return struprW( ret ); +} + +HRESULT create_signature( const WCHAR *class, const WCHAR *method, enum param_direction dir, + IWbemClassObject **sig ) +{ + static const WCHAR selectW[] = + {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', + '_','_','P','A','R','A','M','E','T','E','R','S',' ','W','H','E','R','E',' ', + 'C','l','a','s','s','=','\'','%','s','\'',' ','A','N','D',' ', + 'M','e','t','h','o','d','=','\'','%','s','\'',' ','A','N','D',' ', + 'D','i','r','e','c','t','i','o','n','%','s',0}; + static const WCHAR geW[] = {'>','=','0',0}; + static const WCHAR leW[] = {'<','=','0',0}; + UINT len = SIZEOF(selectW) + SIZEOF(geW); + IEnumWbemClassObject *iter; + WCHAR *query, *name; + HRESULT hr; + + len += strlenW( class ) + strlenW( method ); + if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY; + sprintfW( query, selectW, class, method, dir >= 0 ? geW : leW ); + + hr = exec_query( query, &iter ); + heap_free( query ); + if (hr != S_OK) return hr; + + if (!(name = build_signature_table_name( class, method, dir ))) + { + IEnumWbemClassObject_Release( iter ); + return E_OUTOFMEMORY; + } + hr = create_signature_table( iter, name ); + IEnumWbemClassObject_Release( iter ); + if (hr == S_OK) + hr = get_object( name, sig ); + + heap_free( name ); + return hr; +} + +static HRESULT WINAPI class_object_GetMethod( + IWbemClassObject *iface, + LPCWSTR wszName, + LONG lFlags, + IWbemClassObject **ppInSignature, + IWbemClassObject **ppOutSignature ) +{ + struct class_object *co = impl_from_IWbemClassObject( iface ); + IWbemClassObject *in, *out; + HRESULT hr; + + TRACE("%p, %s, %08x, %p, %p\n", iface, debugstr_w(wszName), lFlags, ppInSignature, ppOutSignature); + + hr = create_signature( co->name, wszName, PARAM_IN, &in ); + if (hr != S_OK) return hr; + + hr = create_signature( co->name, wszName, PARAM_OUT, &out ); + if (hr == S_OK) + { + if (ppInSignature) *ppInSignature = in; + else IWbemClassObject_Release( in ); + if (ppOutSignature) *ppOutSignature = out; + else IWbemClassObject_Release( out ); + } + else IWbemClassObject_Release( in ); + return hr; +} + +static HRESULT WINAPI class_object_PutMethod( + IWbemClassObject *iface, + LPCWSTR wszName, + LONG lFlags, + IWbemClassObject *pInSignature, + IWbemClassObject *pOutSignature ) +{ + FIXME("%p, %s, %08x, %p, %p\n", iface, debugstr_w(wszName), lFlags, pInSignature, pOutSignature); + return E_NOTIMPL; +} + +static HRESULT WINAPI class_object_DeleteMethod( + IWbemClassObject *iface, + LPCWSTR wszName ) +{ + FIXME("%p, %s\n", iface, debugstr_w(wszName)); + return E_NOTIMPL; +} + +static HRESULT WINAPI class_object_BeginMethodEnumeration( + IWbemClassObject *iface, + LONG lEnumFlags) +{ + struct class_object *co = impl_from_IWbemClassObject( iface ); + + TRACE("%p, %08x\n", iface, lEnumFlags); + + if (lEnumFlags) FIXME("flags 0x%08x not supported\n", lEnumFlags); + + if (co->iter) + { + WARN("not allowed on instance\n"); + return WBEM_E_ILLEGAL_OPERATION; + } + co->index_method = 0; + return S_OK; +} + +static HRESULT WINAPI class_object_NextMethod( + IWbemClassObject *iface, + LONG lFlags, + BSTR *pstrName, + IWbemClassObject **ppInSignature, + IWbemClassObject **ppOutSignature) +{ + struct class_object *co = impl_from_IWbemClassObject( iface ); + BSTR method; + HRESULT hr; + + TRACE("%p, %08x, %p, %p, %p\n", iface, lFlags, pstrName, ppInSignature, ppOutSignature); + + if (!(method = get_method_name( co->name, co->index_method ))) return WBEM_S_NO_MORE_DATA; + + hr = create_signature( co->name, method, PARAM_IN, ppInSignature ); + if (hr != S_OK) + { + SysFreeString( method ); + return hr; + } + hr = create_signature( co->name, method, PARAM_OUT, ppOutSignature ); + if (hr != S_OK) + { + SysFreeString( method ); + IWbemClassObject_Release( *ppInSignature ); + } + else + { + *pstrName = method; + co->index_method++; + } + return hr; +} + +static HRESULT WINAPI class_object_EndMethodEnumeration( + IWbemClassObject *iface ) +{ + struct class_object *co = impl_from_IWbemClassObject( iface ); + + TRACE("%p\n", iface); + + co->index_method = 0; + return S_OK; +} + +static HRESULT WINAPI class_object_GetMethodQualifierSet( + IWbemClassObject *iface, + LPCWSTR wszMethod, + IWbemQualifierSet **ppQualSet) +{ + FIXME("%p, %s, %p\n", iface, debugstr_w(wszMethod), ppQualSet); + return E_NOTIMPL; +} + +static HRESULT WINAPI class_object_GetMethodOrigin( + IWbemClassObject *iface, + LPCWSTR wszMethodName, + BSTR *pstrClassName) +{ + FIXME("%p, %s, %p\n", iface, debugstr_w(wszMethodName), pstrClassName); + return E_NOTIMPL; +} + +static const IWbemClassObjectVtbl class_object_vtbl = +{ + class_object_QueryInterface, + class_object_AddRef, + class_object_Release, + class_object_GetQualifierSet, + class_object_Get, + class_object_Put, + class_object_Delete, + class_object_GetNames, + class_object_BeginEnumeration, + class_object_Next, + class_object_EndEnumeration, + class_object_GetPropertyQualifierSet, + class_object_Clone, + class_object_GetObjectText, + class_object_SpawnDerivedClass, + class_object_SpawnInstance, + class_object_CompareTo, + class_object_GetPropertyOrigin, + class_object_InheritsFrom, + class_object_GetMethod, + class_object_PutMethod, + class_object_DeleteMethod, + class_object_BeginMethodEnumeration, + class_object_NextMethod, + class_object_EndMethodEnumeration, + class_object_GetMethodQualifierSet, + class_object_GetMethodOrigin +}; + +HRESULT create_class_object( const WCHAR *name, IEnumWbemClassObject *iter, UINT index, + struct record *record, IWbemClassObject **obj ) +{ + struct class_object *co; + + TRACE("%s, %p\n", debugstr_w(name), obj); + + co = heap_alloc( sizeof(*co) ); + if (!co) return E_OUTOFMEMORY; + + co->IWbemClassObject_iface.lpVtbl = &class_object_vtbl; + co->refs = 1; + if (!name) co->name = NULL; + else if (!(co->name = heap_strdupW( name ))) + { + heap_free( co ); + return E_OUTOFMEMORY; + } + co->iter = iter; + co->index = index; + co->index_method = 0; + co->index_property = 0; + co->record = record; + if (iter) IEnumWbemClassObject_AddRef( iter ); + + *obj = &co->IWbemClassObject_iface; + + TRACE("returning iface %p\n", *obj); + return S_OK; +} diff --git a/reactos/dll/win32/wbemprox/main.c b/reactos/dll/win32/wbemprox/main.c new file mode 100644 index 00000000000..cbdc742f12b --- /dev/null +++ b/reactos/dll/win32/wbemprox/main.c @@ -0,0 +1,180 @@ +/* + * + * Copyright 2009 Austin English + * + * 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 + */ + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H + +#include "config.h" + +#include + +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" +#include "objbase.h" +#include "oleauto.h" +#include "wbemcli.h" +#include "wbemprov.h" +#include "rpcproxy.h" + +#include "wbemprox_private.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wbemprox); + +static HINSTANCE instance; + +typedef HRESULT (*fnCreateInstance)( IUnknown *pUnkOuter, LPVOID *ppObj ); + +typedef struct +{ + IClassFactory IClassFactory_iface; + fnCreateInstance pfnCreateInstance; +} wbemprox_cf; + +static inline wbemprox_cf *impl_from_IClassFactory( IClassFactory *iface ) +{ + return CONTAINING_RECORD(iface, wbemprox_cf, IClassFactory_iface); +} + +static HRESULT WINAPI wbemprox_cf_QueryInterface( IClassFactory *iface, REFIID riid, LPVOID *ppobj ) +{ + if (IsEqualGUID(riid, &IID_IUnknown) || + IsEqualGUID(riid, &IID_IClassFactory)) + { + IClassFactory_AddRef( iface ); + *ppobj = iface; + return S_OK; + } + FIXME("interface %s not implemented\n", debugstr_guid(riid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI wbemprox_cf_AddRef( IClassFactory *iface ) +{ + return 2; +} + +static ULONG WINAPI wbemprox_cf_Release( IClassFactory *iface ) +{ + return 1; +} + +static HRESULT WINAPI wbemprox_cf_CreateInstance( IClassFactory *iface, LPUNKNOWN pOuter, + REFIID riid, LPVOID *ppobj ) +{ + wbemprox_cf *This = impl_from_IClassFactory( iface ); + HRESULT r; + IUnknown *punk; + + TRACE("%p %s %p\n", pOuter, debugstr_guid(riid), ppobj); + + *ppobj = NULL; + + if (pOuter) + return CLASS_E_NOAGGREGATION; + + r = This->pfnCreateInstance( pOuter, (LPVOID *)&punk ); + if (FAILED(r)) + return r; + + r = IUnknown_QueryInterface( punk, riid, ppobj ); + if (FAILED(r)) + return r; + + IUnknown_Release( punk ); + return r; +} + +static HRESULT WINAPI wbemprox_cf_LockServer( IClassFactory *iface, BOOL dolock ) +{ + FIXME("(%p)->(%d)\n", iface, dolock); + return S_OK; +} + +static const struct IClassFactoryVtbl wbemprox_cf_vtbl = +{ + wbemprox_cf_QueryInterface, + wbemprox_cf_AddRef, + wbemprox_cf_Release, + wbemprox_cf_CreateInstance, + wbemprox_cf_LockServer +}; + +static wbemprox_cf wbem_locator_cf = { { &wbemprox_cf_vtbl }, WbemLocator_create }; + +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + + switch (fdwReason) + { + case DLL_WINE_PREATTACH: + return FALSE; /* prefer native version */ + case DLL_PROCESS_ATTACH: + instance = hinstDLL; + DisableThreadLibraryCalls(hinstDLL); + init_table_list(); + break; + case DLL_PROCESS_DETACH: + break; + } + + return TRUE; +} + +HRESULT WINAPI DllGetClassObject( REFCLSID rclsid, REFIID iid, LPVOID *ppv ) +{ + IClassFactory *cf = NULL; + + TRACE("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv); + + if (IsEqualGUID( rclsid, &CLSID_WbemLocator ) || + IsEqualGUID( rclsid, &CLSID_WbemAdministrativeLocator )) + { + cf = &wbem_locator_cf.IClassFactory_iface; + } + if (!cf) return CLASS_E_CLASSNOTAVAILABLE; + return IClassFactory_QueryInterface( cf, iid, ppv ); +} + +/*********************************************************************** + * DllCanUnloadNow (WBEMPROX.@) + */ +HRESULT WINAPI DllCanUnloadNow( void ) +{ + return S_FALSE; +} + +/*********************************************************************** + * DllRegisterServer (WBEMPROX.@) + */ +HRESULT WINAPI DllRegisterServer(void) +{ + return __wine_register_resources( instance ); +} + +/*********************************************************************** + * DllUnregisterServer (WBEMPROX.@) + */ +HRESULT WINAPI DllUnregisterServer(void) +{ + return __wine_unregister_resources( instance ); +} diff --git a/reactos/dll/win32/wbemprox/process.c b/reactos/dll/win32/wbemprox/process.c new file mode 100644 index 00000000000..011d30c6863 --- /dev/null +++ b/reactos/dll/win32/wbemprox/process.c @@ -0,0 +1,108 @@ +/* + * Win32_Process methods implementation + * + * Copyright 2013 Hans Leidekker for CodeWeavers + * + * 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 + */ + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H + +#define COBJMACROS + +#include "config.h" +#include + +#include "windef.h" +#include "winbase.h" +#include "objbase.h" +#include "oleauto.h" +#include "wbemcli.h" + +#include "wine/debug.h" +#include "wbemprox_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wbemprox); + +static HRESULT get_owner( VARIANT *user, VARIANT *domain, VARIANT *retval ) +{ + DWORD len; + UINT error = 8; + + len = 0; + GetUserNameW( NULL, &len ); + if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) goto done; + if (!(V_BSTR( user ) = heap_alloc( len * sizeof(WCHAR) ))) goto done; + if (!GetUserNameW( V_BSTR( user ), &len )) goto done; + V_VT( user ) = VT_BSTR; + + len = 0; + GetComputerNameW( NULL, &len ); + if (GetLastError() != ERROR_BUFFER_OVERFLOW) goto done; + if (!(V_BSTR( domain ) = heap_alloc( len * sizeof(WCHAR) ))) goto done; + if (!GetComputerNameW( V_BSTR( domain ), &len )) goto done; + V_VT( domain ) = VT_BSTR; + + error = 0; + +done: + if (error) + { + VariantClear( user ); + VariantClear( domain ); + } + set_variant( VT_UI4, error, NULL, retval ); + return S_OK; +} + +HRESULT process_get_owner( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out ) +{ + VARIANT user, domain, retval; + IWbemClassObject *sig; + HRESULT hr; + + TRACE("%p, %p, %p\n", obj, in, out); + + hr = create_signature( class_processW, method_getownerW, PARAM_OUT, &sig ); + if (hr != S_OK) return hr; + + hr = IWbemClassObject_SpawnInstance( sig, 0, out ); + if (hr != S_OK) + { + IWbemClassObject_Release( sig ); + return hr; + } + VariantInit( &user ); + VariantInit( &domain ); + hr = get_owner( &user, &domain, &retval ); + if (hr != S_OK) goto done; + if (!V_UI4( &retval )) + { + hr = IWbemClassObject_Put( *out, param_userW, 0, &user, CIM_STRING ); + if (hr != S_OK) goto done; + hr = IWbemClassObject_Put( *out, param_domainW, 0, &domain, CIM_STRING ); + if (hr != S_OK) goto done; + } + hr = IWbemClassObject_Put( *out, param_returnvalueW, 0, &retval, CIM_UINT32 ); + +done: + VariantClear( &user ); + VariantClear( &domain ); + IWbemClassObject_Release( sig ); + if (hr != S_OK) IWbemClassObject_Release( *out ); + return hr; +} diff --git a/reactos/dll/win32/wbemprox/qualifier.c b/reactos/dll/win32/wbemprox/qualifier.c new file mode 100644 index 00000000000..b2ed44fb112 --- /dev/null +++ b/reactos/dll/win32/wbemprox/qualifier.c @@ -0,0 +1,283 @@ +/* + * Copyright 2013 Hans Leidekker for CodeWeavers + * + * 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 + */ + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H + +#define COBJMACROS + +#include "config.h" +#include + +#include "windef.h" +#include "winbase.h" +#include "objbase.h" +#include "oleauto.h" +#include "wbemcli.h" + +#include "wine/debug.h" +#include "wbemprox_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wbemprox); + +struct qualifier_set +{ + IWbemQualifierSet IWbemQualifierSet_iface; + LONG refs; + WCHAR *class; + WCHAR *member; +}; + +static inline struct qualifier_set *impl_from_IWbemQualifierSet( + IWbemQualifierSet *iface ) +{ + return CONTAINING_RECORD(iface, struct qualifier_set, IWbemQualifierSet_iface); +} + +static ULONG WINAPI qualifier_set_AddRef( + IWbemQualifierSet *iface ) +{ + struct qualifier_set *set = impl_from_IWbemQualifierSet( iface ); + return InterlockedIncrement( &set->refs ); +} + +static ULONG WINAPI qualifier_set_Release( + IWbemQualifierSet *iface ) +{ + struct qualifier_set *set = impl_from_IWbemQualifierSet( iface ); + LONG refs = InterlockedDecrement( &set->refs ); + if (!refs) + { + TRACE("destroying %p\n", set); + heap_free( set->class ); + heap_free( set->member ); + heap_free( set ); + } + return refs; +} + +static HRESULT WINAPI qualifier_set_QueryInterface( + IWbemQualifierSet *iface, + REFIID riid, + void **ppvObject ) +{ + struct qualifier_set *set = impl_from_IWbemQualifierSet( iface ); + + TRACE("%p, %s, %p\n", set, debugstr_guid( riid ), ppvObject ); + + if ( IsEqualGUID( riid, &IID_IWbemQualifierSet ) || + IsEqualGUID( riid, &IID_IUnknown ) ) + { + *ppvObject = set; + } + else + { + FIXME("interface %s not implemented\n", debugstr_guid(riid)); + return E_NOINTERFACE; + } + IWbemQualifierSet_AddRef( iface ); + return S_OK; +} + +static HRESULT create_qualifier_enum( const WCHAR *class, const WCHAR *member, const WCHAR *name, + IEnumWbemClassObject **iter ) +{ + static const WCHAR fmtW[] = + {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','_','_','Q','U','A','L', + 'I','F','I','E','R','S',' ','W','H','E','R','E',' ','C','l','a','s','s','=', + '\'','%','s','\'',' ','A','N','D',' ','M','e','m','b','e','r','=','\'','%','s','\'',' ', + 'A','N','D',' ','N','a','m','e','=','\'','%','s','\'',0}; + static const WCHAR fmt2W[] = + {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','_','_','Q','U','A','L', + 'I','F','I','E','R','S',' ','W','H','E','R','E',' ','C','l','a','s','s','=', + '\'','%','s','\'',' ','A','N','D',' ','M','e','m','b','e','r','=','\'','%','s','\'',0}; + static const WCHAR noneW[] = {'_','_','N','O','N','E',0}; + WCHAR *query; + HRESULT hr; + int len; + + if (!member) member = noneW; + len = strlenW( class ) + strlenW( member ); + if (name) len += strlenW( name ) + SIZEOF(fmtW); + else len += SIZEOF(fmt2W); + + if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY; + if (name) sprintfW( query, fmtW, class, member, name ); + else sprintfW( query, fmt2W, class, member ); + + hr = exec_query( query, iter ); + heap_free( query ); + return hr; +} + +static HRESULT get_qualifier_value( const WCHAR *class, const WCHAR *member, const WCHAR *name, + VARIANT *val, LONG *flavor ) +{ + static const WCHAR qualifiersW[] = {'_','_','Q','U','A','L','I','F','I','E','R','S',0}; + static const WCHAR intvalueW[] = {'I','n','t','e','g','e','r','V','a','l','u','e',0}; + static const WCHAR strvalueW[] = {'S','t','r','i','n','g','V','a','l','u','e',0}; + static const WCHAR flavorW[] = {'F','l','a','v','o','r',0}; + static const WCHAR typeW[] = {'T','y','p','e',0}; + IEnumWbemClassObject *iter; + IWbemClassObject *obj; + VARIANT var; + HRESULT hr; + + hr = create_qualifier_enum( class, member, name, &iter ); + if (FAILED( hr )) return hr; + + hr = create_class_object( qualifiersW, iter, 0, NULL, &obj ); + IEnumWbemClassObject_Release( iter ); + if (FAILED( hr )) return hr; + + if (flavor) + { + hr = IWbemClassObject_Get( obj, flavorW, 0, &var, NULL, NULL ); + if (hr != S_OK) goto done; + *flavor = V_I4( &var ); + } + hr = IWbemClassObject_Get( obj, typeW, 0, &var, NULL, NULL ); + if (hr != S_OK) goto done; + switch (V_UI4( &var )) + { + case CIM_STRING: + hr = IWbemClassObject_Get( obj, strvalueW, 0, val, NULL, NULL ); + break; + case CIM_SINT32: + hr = IWbemClassObject_Get( obj, intvalueW, 0, val, NULL, NULL ); + break; + default: + ERR("unhandled type %u\n", V_UI4( &var )); + break; + } + +done: + IWbemClassObject_Release( obj ); + return hr; +} + +static HRESULT WINAPI qualifier_set_Get( + IWbemQualifierSet *iface, + LPCWSTR wszName, + LONG lFlags, + VARIANT *pVal, + LONG *plFlavor ) +{ + struct qualifier_set *set = impl_from_IWbemQualifierSet( iface ); + + FIXME("%p, %s, %08x, %p, %p\n", iface, debugstr_w(wszName), lFlags, pVal, plFlavor); + return get_qualifier_value( set->class, set->member, wszName, pVal, plFlavor ); +} + +static HRESULT WINAPI qualifier_set_Put( + IWbemQualifierSet *iface, + LPCWSTR wszName, + VARIANT *pVal, + LONG lFlavor ) +{ + FIXME("%p, %s, %p, %d\n", iface, debugstr_w(wszName), pVal, lFlavor); + return E_NOTIMPL; +} + +static HRESULT WINAPI qualifier_set_Delete( + IWbemQualifierSet *iface, + LPCWSTR wszName ) +{ + FIXME("%p, %s\n", iface, debugstr_w(wszName)); + return E_NOTIMPL; +} + +static HRESULT WINAPI qualifier_set_GetNames( + IWbemQualifierSet *iface, + LONG lFlags, + SAFEARRAY **pNames ) +{ + FIXME("%p, %08x, %p\n", iface, lFlags, pNames); + return E_NOTIMPL; +} + +static HRESULT WINAPI qualifier_set_BeginEnumeration( + IWbemQualifierSet *iface, + LONG lFlags ) +{ + FIXME("%p, %08x\n", iface, lFlags); + return E_NOTIMPL; +} + +static HRESULT WINAPI qualifier_set_Next( + IWbemQualifierSet *iface, + LONG lFlags, + BSTR *pstrName, + VARIANT *pVal, + LONG *plFlavor ) +{ + FIXME("%p, %08x, %p, %p, %p\n", iface, lFlags, pstrName, pVal, plFlavor); + return E_NOTIMPL; +} + +static HRESULT WINAPI qualifier_set_EndEnumeration( + IWbemQualifierSet *iface ) +{ + FIXME("%p\n", iface); + return E_NOTIMPL; +} + +static const IWbemQualifierSetVtbl qualifier_set_vtbl = +{ + qualifier_set_QueryInterface, + qualifier_set_AddRef, + qualifier_set_Release, + qualifier_set_Get, + qualifier_set_Put, + qualifier_set_Delete, + qualifier_set_GetNames, + qualifier_set_BeginEnumeration, + qualifier_set_Next, + qualifier_set_EndEnumeration +}; + +HRESULT WbemQualifierSet_create( + IUnknown *pUnkOuter, const WCHAR *class, const WCHAR *member, LPVOID *ppObj ) +{ + struct qualifier_set *set; + + TRACE("%p, %p\n", pUnkOuter, ppObj); + + if (!(set = heap_alloc( sizeof(*set) ))) return E_OUTOFMEMORY; + + set->IWbemQualifierSet_iface.lpVtbl = &qualifier_set_vtbl; + if (!(set->class = heap_strdupW( class ))) + { + heap_free( set ); + return E_OUTOFMEMORY; + } + if (!member) set->member = NULL; + else if (!(set->member = heap_strdupW( member ))) + { + heap_free( set->class ); + heap_free( set ); + return E_OUTOFMEMORY; + } + set->refs = 1; + + *ppObj = &set->IWbemQualifierSet_iface; + + TRACE("returning iface %p\n", *ppObj); + return S_OK; +} diff --git a/reactos/dll/win32/wbemprox/query.c b/reactos/dll/win32/wbemprox/query.c new file mode 100644 index 00000000000..6ad7f4d86cd --- /dev/null +++ b/reactos/dll/win32/wbemprox/query.c @@ -0,0 +1,887 @@ +/* + * Copyright 2012 Hans Leidekker for CodeWeavers + * + * 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 + */ + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H + +#define COBJMACROS + +#include "config.h" +#include + +#include "windef.h" +#include "winbase.h" +#include "objbase.h" +#include "oleauto.h" +#include "wbemcli.h" + +#include "wine/debug.h" +#include "wbemprox_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wbemprox); + +HRESULT create_view( const struct property *proplist, const WCHAR *class, + const struct expr *cond, struct view **ret ) +{ + struct view *view = heap_alloc( sizeof(struct view) ); + + if (!view) return E_OUTOFMEMORY; + view->proplist = proplist; + view->table = grab_table( class ); + view->cond = cond; + view->result = NULL; + view->count = 0; + *ret = view; + return S_OK; +} + +void destroy_view( struct view *view ) +{ + if (!view) return; + if (view->table) release_table( view->table ); + heap_free( view->result ); + heap_free( view ); +} + +static BOOL eval_like( const WCHAR *lstr, const WCHAR *rstr ) +{ + const WCHAR *p = lstr, *q = rstr; + + while (*p && *q) + { + if (*q == '%') + { + while (*q == '%') q++; + if (!*q) return TRUE; + while (*p && toupperW( p[1] ) != toupperW( q[1] )) p++; + if (!*p) return TRUE; + } + if (toupperW( *p++ ) != toupperW( *q++ )) return FALSE; + } + return TRUE; +} + +static HRESULT eval_strcmp( UINT op, const WCHAR *lstr, const WCHAR *rstr, LONGLONG *val ) +{ + if (!lstr || !rstr) + { + *val = 0; + return S_OK; + } + switch (op) + { + case OP_EQ: + *val = !strcmpW( lstr, rstr ); + break; + case OP_GT: + *val = strcmpW( lstr, rstr ) > 0; + break; + case OP_LT: + *val = strcmpW( lstr, rstr ) < 0; + break; + case OP_LE: + *val = strcmpW( lstr, rstr ) <= 0; + break; + case OP_GE: + *val = strcmpW( lstr, rstr ) >= 0; + break; + case OP_NE: + *val = strcmpW( lstr, rstr ); + break; + case OP_LIKE: + *val = eval_like( lstr, rstr ); + break; + default: + ERR("unhandled operator %u\n", op); + return WBEM_E_INVALID_QUERY; + } + return S_OK; +} + +static inline BOOL is_strcmp( const struct complex_expr *expr ) +{ + return ((expr->left->type == EXPR_PROPVAL && expr->right->type == EXPR_SVAL) || + (expr->left->type == EXPR_SVAL && expr->right->type == EXPR_PROPVAL)); +} + +static HRESULT eval_cond( const struct table *, UINT, const struct expr *, LONGLONG * ); + +static HRESULT eval_binary( const struct table *table, UINT row, const struct complex_expr *expr, + LONGLONG *val ) +{ + HRESULT lret, rret; + LONGLONG lval, rval; + + lret = eval_cond( table, row, expr->left, &lval ); + rret = eval_cond( table, row, expr->right, &rval ); + if (lret != S_OK || rret != S_OK) return WBEM_E_INVALID_QUERY; + + if (is_strcmp( expr )) + { + const WCHAR *lstr = (const WCHAR *)(INT_PTR)lval; + const WCHAR *rstr = (const WCHAR *)(INT_PTR)rval; + + return eval_strcmp( expr->op, lstr, rstr, val ); + } + switch (expr->op) + { + case OP_EQ: + *val = (lval == rval); + break; + case OP_AND: + *val = (lval && rval); + break; + case OP_OR: + *val = (lval || rval); + break; + case OP_GT: + *val = (lval > rval); + break; + case OP_LT: + *val = (lval < rval); + break; + case OP_LE: + *val = (lval <= rval); + break; + case OP_GE: + *val = (lval >= rval); + break; + case OP_NE: + *val = (lval != rval); + break; + default: + ERR("unhandled operator %u\n", expr->op); + return WBEM_E_INVALID_QUERY; + } + return S_OK; +} + +static HRESULT eval_unary( const struct table *table, UINT row, const struct complex_expr *expr, + LONGLONG *val ) + +{ + HRESULT hr; + UINT column; + LONGLONG lval; + + hr = get_column_index( table, expr->left->u.propval->name, &column ); + if (hr != S_OK) + return hr; + + hr = get_value( table, row, column, &lval ); + if (hr != S_OK) + return hr; + + switch (expr->op) + { + case OP_ISNULL: + *val = !lval; + break; + case OP_NOTNULL: + *val = lval; + break; + default: + ERR("unknown operator %u\n", expr->op); + return WBEM_E_INVALID_QUERY; + } + return S_OK; +} + +static HRESULT eval_propval( const struct table *table, UINT row, const struct property *propval, + LONGLONG *val ) + +{ + HRESULT hr; + UINT column; + + hr = get_column_index( table, propval->name, &column ); + if (hr != S_OK) + return hr; + + return get_value( table, row, column, val ); +} + +static HRESULT eval_cond( const struct table *table, UINT row, const struct expr *cond, + LONGLONG *val ) +{ + if (!cond) + { + *val = 1; + return S_OK; + } + switch (cond->type) + { + case EXPR_COMPLEX: + return eval_binary( table, row, &cond->u.expr, val ); + case EXPR_UNARY: + return eval_unary( table, row, &cond->u.expr, val ); + case EXPR_PROPVAL: + return eval_propval( table, row, cond->u.propval, val ); + case EXPR_SVAL: + *val = (INT_PTR)cond->u.sval; + return S_OK; + case EXPR_IVAL: + case EXPR_BVAL: + *val = cond->u.ival; + return S_OK; + default: + ERR("invalid expression type\n"); + break; + } + return WBEM_E_INVALID_QUERY; +} + +static HRESULT execute_view( struct view *view ) +{ + UINT i, j = 0, len; + + if (!view->table || !view->table->num_rows) return S_OK; + + len = min( view->table->num_rows, 16 ); + if (!(view->result = heap_alloc( len * sizeof(UINT) ))) return E_OUTOFMEMORY; + + for (i = 0; i < view->table->num_rows; i++) + { + HRESULT hr; + LONGLONG val = 0; + + if (j >= len) + { + UINT *tmp; + len *= 2; + if (!(tmp = heap_realloc( view->result, len * sizeof(UINT) ))) return E_OUTOFMEMORY; + view->result = tmp; + } + if ((hr = eval_cond( view->table, i, view->cond, &val )) != S_OK) return hr; + if (val) view->result[j++] = i; + } + view->count = j; + return S_OK; +} + +static struct query *create_query(void) +{ + struct query *query; + + if (!(query = heap_alloc( sizeof(*query) ))) return NULL; + list_init( &query->mem ); + query->refs = 1; + return query; +} + +static void free_query( struct query *query ) +{ + struct list *mem, *next; + + destroy_view( query->view ); + LIST_FOR_EACH_SAFE( mem, next, &query->mem ) + { + heap_free( mem ); + } + heap_free( query ); +} + +struct query *addref_query( struct query *query ) +{ + InterlockedIncrement( &query->refs ); + return query; +} + +void release_query( struct query *query ) +{ + if (!InterlockedDecrement( &query->refs )) free_query( query ); +} + +HRESULT exec_query( const WCHAR *str, IEnumWbemClassObject **result ) +{ + HRESULT hr; + struct query *query; + + *result = NULL; + if (!(query = create_query())) return E_OUTOFMEMORY; + hr = parse_query( str, &query->view, &query->mem ); + if (hr != S_OK) goto done; + hr = execute_view( query->view ); + if (hr != S_OK) goto done; + hr = EnumWbemClassObject_create( NULL, query, (void **)result ); + +done: + release_query( query ); + return hr; +} + +static BOOL is_selected_prop( const struct view *view, const WCHAR *name ) +{ + const struct property *prop = view->proplist; + + if (!prop) return TRUE; + while (prop) + { + if (!strcmpiW( prop->name, name )) return TRUE; + prop = prop->next; + } + return FALSE; +} + +static BOOL is_system_prop( const WCHAR *name ) +{ + return (name[0] == '_' && name[1] == '_'); +} + +static BSTR build_servername( const struct view *view ) +{ + WCHAR server[MAX_COMPUTERNAME_LENGTH + 1], *p; + DWORD len = sizeof(server)/sizeof(server[0]); + + if (view->proplist) return NULL; + + if (!(GetComputerNameW( server, &len ))) return NULL; + for (p = server; *p; p++) *p = toupperW( *p ); + return SysAllocString( server ); +} + +static BSTR build_classname( const struct view *view ) +{ + return SysAllocString( view->table->name ); +} + +static BSTR build_namespace( const struct view *view ) +{ + static const WCHAR cimv2W[] = {'R','O','O','T','\\','C','I','M','V','2',0}; + + if (view->proplist) return NULL; + return SysAllocString( cimv2W ); +} + +static BSTR build_proplist( const struct view *view, UINT index, UINT count, UINT *len ) +{ + static const WCHAR fmtW[] = {'%','s','=','%','s',0}; + UINT i, j, offset, row = view->result[index]; + BSTR *values, ret = NULL; + + if (!(values = heap_alloc( count * sizeof(BSTR) ))) return NULL; + + *len = j = 0; + for (i = 0; i < view->table->num_cols; i++) + { + if (view->table->columns[i].type & COL_FLAG_KEY) + { + const WCHAR *name = view->table->columns[i].name; + + values[j] = get_value_bstr( view->table, row, i ); + *len += strlenW( fmtW ) + strlenW( name ) + strlenW( values[j] ); + j++; + } + } + if ((ret = SysAllocStringLen( NULL, *len ))) + { + offset = j = 0; + for (i = 0; i < view->table->num_cols; i++) + { + if (view->table->columns[i].type & COL_FLAG_KEY) + { + const WCHAR *name = view->table->columns[i].name; + + offset += sprintfW( ret + offset, fmtW, name, values[j] ); + if (j < count - 1) ret[offset++] = ','; + j++; + } + } + } + for (i = 0; i < count; i++) SysFreeString( values[i] ); + heap_free( values ); + return ret; +} + +static UINT count_key_columns( const struct view *view ) +{ + UINT i, num_keys = 0; + + for (i = 0; i < view->table->num_cols; i++) + { + if (view->table->columns[i].type & COL_FLAG_KEY) num_keys++; + } + return num_keys; +} + +static BSTR build_relpath( const struct view *view, UINT index, const WCHAR *name ) +{ + static const WCHAR fmtW[] = {'%','s','.','%','s',0}; + BSTR class, proplist, ret = NULL; + UINT num_keys, len; + + if (view->proplist) return NULL; + + if (!(class = build_classname( view ))) return NULL; + if (!(num_keys = count_key_columns( view ))) return class; + if (!(proplist = build_proplist( view, index, num_keys, &len ))) goto done; + + len += strlenW( fmtW ) + SysStringLen( class ); + if (!(ret = SysAllocStringLen( NULL, len ))) goto done; + sprintfW( ret, fmtW, class, proplist ); + +done: + SysFreeString( class ); + SysFreeString( proplist ); + return ret; +} + +static BSTR build_path( const struct view *view, UINT index, const WCHAR *name ) +{ + static const WCHAR fmtW[] = {'\\','\\','%','s','\\','%','s',':','%','s',0}; + BSTR server, namespace = NULL, relpath = NULL, ret = NULL; + UINT len; + + if (view->proplist) return NULL; + + if (!(server = build_servername( view ))) return NULL; + if (!(namespace = build_namespace( view ))) goto done; + if (!(relpath = build_relpath( view, index, name ))) goto done; + + len = strlenW( fmtW ) + SysStringLen( server ) + SysStringLen( namespace ) + SysStringLen( relpath ); + if (!(ret = SysAllocStringLen( NULL, len ))) goto done; + sprintfW( ret, fmtW, server, namespace, relpath ); + +done: + SysFreeString( server ); + SysFreeString( namespace ); + SysFreeString( relpath ); + return ret; +} + +static inline BOOL is_method( const struct table *table, UINT column ) +{ + return table->columns[column].type & COL_FLAG_METHOD; +} + +static UINT count_properties( const struct view *view ) +{ + UINT i, num_props = 0; + + for (i = 0; i < view->table->num_cols; i++) + { + if (!is_method( view->table, i)) num_props++; + } + return num_props; +} + +static UINT count_selected_properties( const struct view *view ) +{ + const struct property *prop = view->proplist; + UINT count; + + if (!prop) return count_properties( view ); + + count = 1; + while ((prop = prop->next)) count++; + return count; +} + +static HRESULT get_system_propval( const struct view *view, UINT index, const WCHAR *name, + VARIANT *ret, CIMTYPE *type, LONG *flavor ) +{ + static const WCHAR classW[] = {'_','_','C','L','A','S','S',0}; + static const WCHAR genusW[] = {'_','_','G','E','N','U','S',0}; + static const WCHAR pathW[] = {'_','_','P','A','T','H',0}; + static const WCHAR namespaceW[] = {'_','_','N','A','M','E','S','P','A','C','E',0}; + static const WCHAR propcountW[] = {'_','_','P','R','O','P','E','R','T','Y','_','C','O','U','N','T',0}; + static const WCHAR relpathW[] = {'_','_','R','E','L','P','A','T','H',0}; + static const WCHAR serverW[] = {'_','_','S','E','R','V','E','R',0}; + + if (flavor) *flavor = WBEM_FLAVOR_ORIGIN_SYSTEM; + + if (!strcmpiW( name, classW )) + { + V_VT( ret ) = VT_BSTR; + V_BSTR( ret ) = build_classname( view ); + if (type) *type = CIM_STRING; + return S_OK; + } + if (!strcmpiW( name, genusW )) + { + V_VT( ret ) = VT_I4; + V_I4( ret ) = WBEM_GENUS_INSTANCE; /* FIXME */ + if (type) *type = CIM_SINT32; + return S_OK; + } + else if (!strcmpiW( name, namespaceW )) + { + V_VT( ret ) = VT_BSTR; + V_BSTR( ret ) = build_namespace( view ); + if (type) *type = CIM_STRING; + return S_OK; + } + else if (!strcmpiW( name, pathW )) + { + V_VT( ret ) = VT_BSTR; + V_BSTR( ret ) = build_path( view, index, name ); + if (type) *type = CIM_STRING; + return S_OK; + } + if (!strcmpiW( name, propcountW )) + { + V_VT( ret ) = VT_I4; + V_I4( ret ) = count_selected_properties( view ); + if (type) *type = CIM_SINT32; + return S_OK; + } + else if (!strcmpiW( name, relpathW )) + { + V_VT( ret ) = VT_BSTR; + V_BSTR( ret ) = build_relpath( view, index, name ); + if (type) *type = CIM_STRING; + return S_OK; + } + else if (!strcmpiW( name, serverW )) + { + V_VT( ret ) = VT_BSTR; + V_BSTR( ret ) = build_servername( view ); + if (type) *type = CIM_STRING; + return S_OK; + } + FIXME("system property %s not implemented\n", debugstr_w(name)); + return WBEM_E_NOT_FOUND; +} + +VARTYPE to_vartype( CIMTYPE type ) +{ + switch (type) + { + case CIM_BOOLEAN: return VT_BOOL; + case CIM_STRING: + case CIM_DATETIME: return VT_BSTR; + case CIM_SINT16: return VT_I2; + case CIM_UINT16: return VT_UI2; + case CIM_SINT32: return VT_I4; + case CIM_UINT32: return VT_UI4; + case CIM_SINT64: return VT_I8; + case CIM_UINT64: return VT_UI8; + default: + ERR("unhandled type %u\n", type); + break; + } + return 0; +} + +SAFEARRAY *to_safearray( const struct array *array, CIMTYPE type ) +{ + SAFEARRAY *ret; + UINT size = get_type_size( type ); + VARTYPE vartype = to_vartype( type ); + LONG i; + + if (!(ret = SafeArrayCreateVector( vartype, 0, array->count ))) return NULL; + + for (i = 0; i < array->count; i++) + { + void *ptr = (char *)array->ptr + i * size; + if (vartype == VT_BSTR) + { + BSTR str = SysAllocString( *(const WCHAR **)ptr ); + if (!str || SafeArrayPutElement( ret, &i, str ) != S_OK) + { + SysFreeString( str ); + SafeArrayDestroy( ret ); + return NULL; + } + } + else if (SafeArrayPutElement( ret, &i, ptr ) != S_OK) + { + SafeArrayDestroy( ret ); + return NULL; + } + } + return ret; +} + +void set_variant( VARTYPE type, LONGLONG val, void *val_ptr, VARIANT *ret ) +{ + if (type & VT_ARRAY) + { + V_VT( ret ) = type; + V_ARRAY( ret ) = val_ptr; + return; + } + switch (type) + { + case VT_BOOL: + V_BOOL( ret ) = val; + break; + case VT_BSTR: + V_BSTR( ret ) = val_ptr; + break; + case VT_I2: + V_I2( ret ) = val; + break; + case VT_UI2: + V_UI2( ret ) = val; + break; + case VT_I4: + V_I4( ret ) = val; + break; + case VT_UI4: + V_UI4( ret ) = val; + break; + case VT_NULL: + break; + default: + ERR("unhandled variant type %u\n", type); + return; + } + V_VT( ret ) = type; +} + +HRESULT get_propval( const struct view *view, UINT index, const WCHAR *name, VARIANT *ret, + CIMTYPE *type, LONG *flavor ) +{ + HRESULT hr; + UINT column, row; + VARTYPE vartype; + void *val_ptr = NULL; + LONGLONG val; + + if (is_system_prop( name )) return get_system_propval( view, index, name, ret, type, flavor ); + if (!view->count || !is_selected_prop( view, name )) return WBEM_E_NOT_FOUND; + + hr = get_column_index( view->table, name, &column ); + if (hr != S_OK || is_method( view->table, column )) return WBEM_E_NOT_FOUND; + + row = view->result[index]; + hr = get_value( view->table, row, column, &val ); + if (hr != S_OK) return hr; + + vartype = view->table->columns[column].vartype; + if (view->table->columns[column].type & CIM_FLAG_ARRAY) + { + CIMTYPE basetype = view->table->columns[column].type & CIM_TYPE_MASK; + + val_ptr = to_safearray( (const struct array *)(INT_PTR)val, basetype ); + if (!vartype) vartype = to_vartype( basetype ) | VT_ARRAY; + goto done; + } + switch (view->table->columns[column].type & COL_TYPE_MASK) + { + case CIM_BOOLEAN: + if (!vartype) vartype = VT_BOOL; + break; + case CIM_STRING: + case CIM_DATETIME: + if (val) + { + vartype = VT_BSTR; + val_ptr = SysAllocString( (const WCHAR *)(INT_PTR)val ); + } + else + vartype = VT_NULL; + break; + case CIM_SINT16: + if (!vartype) vartype = VT_I2; + break; + case CIM_UINT16: + if (!vartype) vartype = VT_UI2; + break; + case CIM_SINT32: + if (!vartype) vartype = VT_I4; + break; + case CIM_UINT32: + if (!vartype) vartype = VT_UI4; + break; + case CIM_SINT64: + vartype = VT_BSTR; + val_ptr = get_value_bstr( view->table, row, column ); + break; + case CIM_UINT64: + vartype = VT_BSTR; + val_ptr = get_value_bstr( view->table, row, column ); + break; + default: + ERR("unhandled column type %u\n", view->table->columns[column].type); + return WBEM_E_FAILED; + } + +done: + set_variant( vartype, val, val_ptr, ret ); + if (type) *type = view->table->columns[column].type & COL_TYPE_MASK; + if (flavor) *flavor = 0; + return S_OK; +} + +static CIMTYPE to_cimtype( VARTYPE type ) +{ + switch (type) + { + case VT_BOOL: return CIM_BOOLEAN; + case VT_BSTR: return CIM_STRING; + case VT_I2: return CIM_SINT16; + case VT_UI2: return CIM_UINT16; + case VT_I4: return CIM_SINT32; + case VT_UI4: return CIM_UINT32; + case VT_I8: return CIM_SINT64; + case VT_UI8: return CIM_UINT64; + default: + ERR("unhandled type %u\n", type); + break; + } + return 0; +} + +static struct array *to_array( VARIANT *var, CIMTYPE *type ) +{ + struct array *ret; + LONG bound, i; + VARTYPE vartype; + CIMTYPE basetype; + UINT size; + + if (SafeArrayGetVartype( V_ARRAY( var ), &vartype ) != S_OK) return NULL; + if (!(basetype = to_cimtype( vartype ))) return NULL; + if (SafeArrayGetUBound( V_ARRAY( var ), 1, &bound ) != S_OK) return NULL; + if (!(ret = heap_alloc( sizeof(struct array) ))) return NULL; + + ret->count = bound + 1; + size = get_type_size( basetype ); + if (!(ret->ptr = heap_alloc_zero( ret->count * size ))) + { + heap_free( ret ); + return NULL; + } + for (i = 0; i < ret->count; i++) + { + void *ptr = (char *)ret->ptr + i * size; + if (vartype == VT_BSTR) + { + BSTR str; + if (SafeArrayGetElement( V_ARRAY( var ), &i, &str ) != S_OK) + { + destroy_array( ret, basetype ); + return NULL; + } + *(WCHAR **)ptr = heap_strdupW( str ); + SysFreeString( str ); + if (!*(WCHAR **)ptr) + { + destroy_array( ret, basetype ); + return NULL; + } + } + else if (SafeArrayGetElement( V_ARRAY( var ), &i, ptr ) != S_OK) + { + destroy_array( ret, basetype ); + return NULL; + } + } + *type = basetype | CIM_FLAG_ARRAY; + return ret; +} + +HRESULT to_longlong( VARIANT *var, LONGLONG *val, CIMTYPE *type ) +{ + if (!var) + { + *val = 0; + return S_OK; + } + if (V_VT( var ) & VT_ARRAY) + { + *val = (INT_PTR)to_array( var, type ); + if (!*val) return E_OUTOFMEMORY; + return S_OK; + } + switch (V_VT( var )) + { + case VT_BOOL: + *val = V_BOOL( var ); + *type = CIM_BOOLEAN; + break; + case VT_BSTR: + *val = (INT_PTR)heap_strdupW( V_BSTR( var ) ); + if (!*val) return E_OUTOFMEMORY; + *type = CIM_STRING; + break; + case VT_I2: + *val = V_I2( var ); + *type = CIM_SINT16; + break; + case VT_UI2: + *val = V_UI2( var ); + *type = CIM_UINT16; + break; + case VT_I4: + *val = V_I4( var ); + *type = CIM_SINT32; + break; + case VT_UI4: + *val = V_UI4( var ); + *type = CIM_UINT32; + break; + case VT_NULL: + *val = 0; + break; + default: + ERR("unhandled type %u\n", V_VT( var )); + return WBEM_E_FAILED; + } + return S_OK; +} + +HRESULT put_propval( const struct view *view, UINT index, const WCHAR *name, VARIANT *var, CIMTYPE type ) +{ + HRESULT hr; + UINT column, row = view->result[index]; + LONGLONG val; + + hr = get_column_index( view->table, name, &column ); + if (hr != S_OK) + { + FIXME("no support for creating new properties\n"); + return WBEM_E_FAILED; + } + if (is_method( view->table, column ) || !(view->table->columns[column].type & COL_FLAG_DYNAMIC)) + return WBEM_E_FAILED; + + hr = to_longlong( var, &val, &type ); + if (hr != S_OK) return hr; + + return set_value( view->table, row, column, val, type ); +} + +HRESULT get_properties( const struct view *view, SAFEARRAY **props ) +{ + SAFEARRAY *sa; + BSTR str; + LONG i; + UINT num_props = count_properties( view ); + + if (!(sa = SafeArrayCreateVector( VT_BSTR, 0, num_props ))) return E_OUTOFMEMORY; + + for (i = 0; i < view->table->num_cols; i++) + { + if (is_method( view->table, i )) continue; + + str = SysAllocString( view->table->columns[i].name ); + if (!str || SafeArrayPutElement( sa, &i, str ) != S_OK) + { + SysFreeString( str ); + SafeArrayDestroy( sa ); + return E_OUTOFMEMORY; + } + } + *props = sa; + return S_OK; +} diff --git a/reactos/dll/win32/wbemprox/reg.c b/reactos/dll/win32/wbemprox/reg.c new file mode 100644 index 00000000000..becc6e11c6c --- /dev/null +++ b/reactos/dll/win32/wbemprox/reg.c @@ -0,0 +1,347 @@ +/* + * StdRegProv implementation + * + * Copyright 2012 Hans Leidekker for CodeWeavers + * + * 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 + */ + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H + +#define COBJMACROS + +#include "config.h" +#include + +#include "windef.h" +#include "winbase.h" +#include "winreg.h" +#include "objbase.h" +#include "oleauto.h" +#include "wbemcli.h" + +#include "wine/debug.h" +#include "wbemprox_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wbemprox); + +static HRESULT to_bstr_array( BSTR *strings, DWORD count, VARIANT *var ) +{ + SAFEARRAY *sa; + HRESULT hr; + LONG i; + + if (!(sa = SafeArrayCreateVector( VT_BSTR, 0, count ))) return E_OUTOFMEMORY; + for (i = 0; i < count; i++) + { + if ((hr = SafeArrayPutElement( sa, &i, strings[i] )) != S_OK) + { + SafeArrayDestroy( sa ); + return hr; + } + } + set_variant( VT_BSTR|VT_ARRAY, 0, sa, var ); + return S_OK; +} + +static HRESULT to_i4_array( DWORD *values, DWORD count, VARIANT *var ) +{ + SAFEARRAY *sa; + HRESULT hr; + LONG i; + + if (!(sa = SafeArrayCreateVector( VT_I4, 0, count ))) return E_OUTOFMEMORY; + for (i = 0; i < count; i++) + { + if ((hr = SafeArrayPutElement( sa, &i, &values[i] )) != S_OK) + { + SafeArrayDestroy( sa ); + return hr; + } + } + set_variant( VT_I4|VT_ARRAY, 0, sa, var ); + return S_OK; +} + +static HRESULT enum_key( HKEY root, const WCHAR *subkey, VARIANT *names, VARIANT *retval ) +{ + HKEY hkey; + HRESULT hr = S_OK; + WCHAR buf[256]; + BSTR *strings, *tmp; + DWORD count = 2, len = sizeof(buf)/sizeof(buf[0]); + LONG res, i = 0; + + TRACE("%p, %s\n", root, debugstr_w(subkey)); + + if (!(strings = heap_alloc( count * sizeof(BSTR) ))) return E_OUTOFMEMORY; + if ((res = RegOpenKeyExW( root, subkey, 0, KEY_ENUMERATE_SUB_KEYS, &hkey ))) + { + set_variant( VT_UI4, res, NULL, retval ); + heap_free( strings ); + return S_OK; + } + for (;;) + { + if (i >= count) + { + count *= 2; + if (!(tmp = heap_realloc( strings, count * sizeof(BSTR) ))) + { + RegCloseKey( hkey ); + return E_OUTOFMEMORY; + } + strings = tmp; + } + if ((res = RegEnumKeyW( hkey, i, buf, len )) == ERROR_NO_MORE_ITEMS) + { + if (i) res = ERROR_SUCCESS; + break; + } + if (res) break; + if (!(strings[i] = SysAllocString( buf ))) + { + for (i--; i >= 0; i--) SysFreeString( strings[i] ); + hr = ERROR_OUTOFMEMORY; + break; + } + i++; + } + if (hr == S_OK && !res) hr = to_bstr_array( strings, i, names ); + set_variant( VT_UI4, res, NULL, retval ); + RegCloseKey( hkey ); + heap_free( strings ); + return hr; +} + +HRESULT reg_enum_key( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out ) +{ + VARIANT defkey, subkey, names, retval; + IWbemClassObject *sig; + HRESULT hr; + + TRACE("%p, %p\n", in, out); + + hr = IWbemClassObject_Get( in, param_defkeyW, 0, &defkey, NULL, NULL ); + if (hr != S_OK) return hr; + hr = IWbemClassObject_Get( in, param_subkeynameW, 0, &subkey, NULL, NULL ); + if (hr != S_OK) return hr; + + hr = create_signature( class_stdregprovW, method_enumkeyW, PARAM_OUT, &sig ); + if (hr != S_OK) + { + VariantClear( &subkey ); + return hr; + } + hr = IWbemClassObject_SpawnInstance( sig, 0, out ); + if (hr != S_OK) + { + VariantClear( &subkey ); + IWbemClassObject_Release( sig ); + return hr; + } + VariantInit( &names ); + hr = enum_key( (HKEY)(INT_PTR)V_I4(&defkey), V_BSTR(&subkey), &names, &retval ); + if (hr != S_OK) goto done; + if (!V_UI4( &retval )) + { + hr = IWbemClassObject_Put( *out, param_namesW, 0, &names, CIM_STRING|CIM_FLAG_ARRAY ); + if (hr != S_OK) goto done; + } + hr = IWbemClassObject_Put( *out, param_returnvalueW, 0, &retval, CIM_UINT32 ); + +done: + VariantClear( &names ); + VariantClear( &subkey ); + IWbemClassObject_Release( sig ); + if (hr != S_OK) IWbemClassObject_Release( *out ); + return hr; +} + +static HRESULT enum_values( HKEY root, const WCHAR *subkey, VARIANT *names, VARIANT *types, VARIANT *retval ) +{ + HKEY hkey = NULL; + HRESULT hr = S_OK; + BSTR *value_names = NULL; + DWORD count, buflen, len, *value_types = NULL; + LONG res, i = 0; + WCHAR *buf = NULL; + + TRACE("%p, %s\n", root, debugstr_w(subkey)); + + if ((res = RegOpenKeyExW( root, subkey, 0, KEY_QUERY_VALUE, &hkey ))) goto done; + if ((res = RegQueryInfoKeyW( hkey, NULL, NULL, NULL, NULL, NULL, NULL, &count, &buflen, NULL, NULL, NULL ))) + goto done; + + hr = E_OUTOFMEMORY; + if (!(buf = heap_alloc( (buflen + 1) * sizeof(WCHAR) ))) goto done; + if (!(value_names = heap_alloc( count * sizeof(BSTR) ))) goto done; + if (!(value_types = heap_alloc( count * sizeof(DWORD) ))) goto done; + + hr = S_OK; + for (;;) + { + len = buflen + 1; + res = RegEnumValueW( hkey, i, buf, &len, NULL, &value_types[i], NULL, NULL ); + if (res == ERROR_NO_MORE_ITEMS) + { + if (i) res = ERROR_SUCCESS; + break; + } + if (res) break; + if (!(value_names[i] = SysAllocString( buf ))) + { + for (i--; i >= 0; i--) SysFreeString( value_names[i] ); + hr = ERROR_OUTOFMEMORY; + break; + } + i++; + } + if (hr == S_OK && !res) + { + hr = to_bstr_array( value_names, i, names ); + if (hr == S_OK) hr = to_i4_array( value_types, i, types ); + } + +done: + set_variant( VT_UI4, res, NULL, retval ); + RegCloseKey( hkey ); + heap_free( value_names ); + heap_free( value_types ); + heap_free( buf ); + return hr; +} + +HRESULT reg_enum_values( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out ) +{ + VARIANT defkey, subkey, names, types, retval; + IWbemClassObject *sig; + HRESULT hr; + + TRACE("%p, %p\n", in, out); + + hr = IWbemClassObject_Get( in, param_defkeyW, 0, &defkey, NULL, NULL ); + if (hr != S_OK) return hr; + hr = IWbemClassObject_Get( in, param_subkeynameW, 0, &subkey, NULL, NULL ); + if (hr != S_OK) return hr; + + hr = create_signature( class_stdregprovW, method_enumvaluesW, PARAM_OUT, &sig ); + if (hr != S_OK) + { + VariantClear( &subkey ); + return hr; + } + hr = IWbemClassObject_SpawnInstance( sig, 0, out ); + if (hr != S_OK) + { + VariantClear( &subkey ); + IWbemClassObject_Release( sig ); + return hr; + } + VariantInit( &names ); + VariantInit( &types ); + hr = enum_values( (HKEY)(INT_PTR)V_I4(&defkey), V_BSTR(&subkey), &names, &types, &retval ); + if (hr != S_OK) goto done; + if (!V_UI4( &retval )) + { + hr = IWbemClassObject_Put( *out, param_namesW, 0, &names, CIM_STRING|CIM_FLAG_ARRAY ); + if (hr != S_OK) goto done; + hr = IWbemClassObject_Put( *out, param_typesW, 0, &types, CIM_SINT32|CIM_FLAG_ARRAY ); + if (hr != S_OK) goto done; + } + hr = IWbemClassObject_Put( *out, param_returnvalueW, 0, &retval, CIM_UINT32 ); + +done: + VariantClear( &types ); + VariantClear( &names ); + VariantClear( &subkey ); + IWbemClassObject_Release( sig ); + if (hr != S_OK) IWbemClassObject_Release( *out ); + return hr; +} + +static HRESULT get_stringvalue( HKEY root, const WCHAR *subkey, const WCHAR *name, VARIANT *value, VARIANT *retval ) +{ + HRESULT hr = S_OK; + WCHAR *buf = NULL; + DWORD size; + LONG res; + + TRACE("%p, %s, %s\n", root, debugstr_w(subkey), debugstr_w(name)); + + if ((res = RegGetValueW( root, subkey, name, RRF_RT_REG_SZ, NULL, NULL, &size ))) goto done; + if (!(buf = heap_alloc( size ))) + { + hr = E_OUTOFMEMORY; + goto done; + } + if (!(res = RegGetValueW( root, subkey, name, RRF_RT_REG_SZ, NULL, buf, &size ))) + set_variant( VT_BSTR, 0, buf, value ); + +done: + set_variant( VT_UI4, res, NULL, retval ); + heap_free( buf ); + return hr; +} + +HRESULT reg_get_stringvalue( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out ) +{ + VARIANT defkey, subkey, name, value, retval; + IWbemClassObject *sig; + HRESULT hr; + + TRACE("%p, %p\n", in, out); + + hr = IWbemClassObject_Get( in, param_defkeyW, 0, &defkey, NULL, NULL ); + if (hr != S_OK) return hr; + hr = IWbemClassObject_Get( in, param_subkeynameW, 0, &subkey, NULL, NULL ); + if (hr != S_OK) return hr; + hr = IWbemClassObject_Get( in, param_valuenameW, 0, &name, NULL, NULL ); + if (hr != S_OK) return hr; + + hr = create_signature( class_stdregprovW, method_getstringvalueW, PARAM_OUT, &sig ); + if (hr != S_OK) + { + VariantClear( &name ); + VariantClear( &subkey ); + return hr; + } + hr = IWbemClassObject_SpawnInstance( sig, 0, out ); + if (hr != S_OK) + { + VariantClear( &name ); + VariantClear( &subkey ); + IWbemClassObject_Release( sig ); + return hr; + } + VariantInit( &value ); + hr = get_stringvalue( (HKEY)(INT_PTR)V_I4(&defkey), V_BSTR(&subkey), V_BSTR(&name), &value, &retval ); + if (hr != S_OK) goto done; + if (!V_UI4( &retval )) + { + hr = IWbemClassObject_Put( *out, param_valueW, 0, &value, CIM_STRING ); + if (hr != S_OK) goto done; + } + hr = IWbemClassObject_Put( *out, param_returnvalueW, 0, &retval, CIM_UINT32 ); + +done: + VariantClear( &name ); + VariantClear( &subkey ); + IWbemClassObject_Release( sig ); + if (hr != S_OK) IWbemClassObject_Release( *out ); + return hr; +} diff --git a/reactos/dll/win32/wbemprox/service.c b/reactos/dll/win32/wbemprox/service.c new file mode 100644 index 00000000000..bde669c1275 --- /dev/null +++ b/reactos/dll/win32/wbemprox/service.c @@ -0,0 +1,248 @@ +/* + * Win32_Service methods implementation + * + * Copyright 2012 Hans Leidekker for CodeWeavers + * + * 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 + */ + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H + +#define COBJMACROS + +#include "config.h" +#include + +#include "windef.h" +#include "winbase.h" +#include "objbase.h" +#include "oleauto.h" +#include "wbemcli.h" +#include "winsvc.h" + +#include "wine/debug.h" +#include "wbemprox_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wbemprox); + +static UINT map_error( DWORD error ) +{ + switch (error) + { + case ERROR_SUCCESS: return 0; + case ERROR_ACCESS_DENIED: return 2; + case ERROR_DEPENDENT_SERVICES_RUNNING: return 3; + case ERROR_INVALID_SERVICE_CONTROL: return 4; + case ERROR_SERVICE_CANNOT_ACCEPT_CTRL: return 5; + case ERROR_SERVICE_NOT_ACTIVE: return 6; + case ERROR_SERVICE_REQUEST_TIMEOUT: return 7; + case ERROR_SERVICE_ALREADY_RUNNING: return 10; + default: + WARN("unknown error %u\n", error); + break; + } + return 8; +} + +static HRESULT control_service( const WCHAR *name, DWORD control, VARIANT *retval ) +{ + SC_HANDLE manager, service = NULL; + SERVICE_STATUS status; + UINT error = 0; + + if (!(manager = OpenSCManagerW( NULL, NULL, SC_MANAGER_ENUMERATE_SERVICE ))) + { + error = map_error( GetLastError() ); + goto done; + } + if (!(service = OpenServiceW( manager, name, SERVICE_STOP|SERVICE_START|SERVICE_PAUSE_CONTINUE ))) + { + error = map_error( GetLastError() ); + goto done; + } + if (!ControlService( service, control, &status )) error = map_error( GetLastError() ); + +done: + set_variant( VT_UI4, error, NULL, retval ); + CloseServiceHandle( service ); + CloseServiceHandle( manager ); + return S_OK; +} + +HRESULT service_pause_service( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out ) +{ + VARIANT name, retval; + IWbemClassObject *sig; + HRESULT hr; + + TRACE("%p, %p, %p\n", obj, in, out); + + hr = IWbemClassObject_Get( obj, prop_nameW, 0, &name, NULL, NULL ); + if (hr != S_OK) return hr; + + hr = create_signature( class_serviceW, method_pauseserviceW, PARAM_OUT, &sig ); + if (hr != S_OK) + { + VariantClear( &name ); + return hr; + } + hr = IWbemClassObject_SpawnInstance( sig, 0, out ); + if (hr != S_OK) + { + VariantClear( &name ); + IWbemClassObject_Release( sig ); + return hr; + } + hr = control_service( V_BSTR(&name), SERVICE_CONTROL_PAUSE, &retval ); + if (hr != S_OK) goto done; + hr = IWbemClassObject_Put( *out, param_returnvalueW, 0, &retval, CIM_UINT32 ); + +done: + VariantClear( &name ); + IWbemClassObject_Release( sig ); + if (hr != S_OK) IWbemClassObject_Release( *out ); + return hr; +} + +HRESULT service_resume_service( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out ) +{ + VARIANT name, retval; + IWbemClassObject *sig; + HRESULT hr; + + TRACE("%p, %p, %p\n", obj, in, out); + + hr = IWbemClassObject_Get( obj, prop_nameW, 0, &name, NULL, NULL ); + if (hr != S_OK) return hr; + + hr = create_signature( class_serviceW, method_resumeserviceW, PARAM_OUT, &sig ); + if (hr != S_OK) + { + VariantClear( &name ); + return hr; + } + hr = IWbemClassObject_SpawnInstance( sig, 0, out ); + if (hr != S_OK) + { + VariantClear( &name ); + IWbemClassObject_Release( sig ); + return hr; + } + hr = control_service( V_BSTR(&name), SERVICE_CONTROL_CONTINUE, &retval ); + if (hr != S_OK) goto done; + hr = IWbemClassObject_Put( *out, param_returnvalueW, 0, &retval, CIM_UINT32 ); + +done: + VariantClear( &name ); + IWbemClassObject_Release( sig ); + if (hr != S_OK) IWbemClassObject_Release( *out ); + return hr; +} + +static HRESULT start_service( const WCHAR *name, VARIANT *retval ) +{ + SC_HANDLE manager, service = NULL; + UINT error = 0; + + if (!(manager = OpenSCManagerW( NULL, NULL, SC_MANAGER_ENUMERATE_SERVICE ))) + { + error = map_error( GetLastError() ); + goto done; + } + if (!(service = OpenServiceW( manager, name, SERVICE_START ))) + { + error = map_error( GetLastError() ); + goto done; + } + if (!StartServiceW( service, 0, NULL )) error = map_error( GetLastError() ); + +done: + set_variant( VT_UI4, error, NULL, retval ); + CloseServiceHandle( service ); + CloseServiceHandle( manager ); + return S_OK; +} + +HRESULT service_start_service( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out ) +{ + VARIANT name, retval; + IWbemClassObject *sig; + HRESULT hr; + + TRACE("%p, %p, %p\n", obj, in, out); + + hr = IWbemClassObject_Get( obj, prop_nameW, 0, &name, NULL, NULL ); + if (hr != S_OK) return hr; + + hr = create_signature( class_serviceW, method_startserviceW, PARAM_OUT, &sig ); + if (hr != S_OK) + { + VariantClear( &name ); + return hr; + } + hr = IWbemClassObject_SpawnInstance( sig, 0, out ); + if (hr != S_OK) + { + VariantClear( &name ); + IWbemClassObject_Release( sig ); + return hr; + } + hr = start_service( V_BSTR(&name), &retval ); + if (hr != S_OK) goto done; + hr = IWbemClassObject_Put( *out, param_returnvalueW, 0, &retval, CIM_UINT32 ); + +done: + VariantClear( &name ); + IWbemClassObject_Release( sig ); + if (hr != S_OK) IWbemClassObject_Release( *out ); + return hr; +} + +HRESULT service_stop_service( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out ) +{ + VARIANT name, retval; + IWbemClassObject *sig; + HRESULT hr; + + TRACE("%p, %p, %p\n", obj, in, out); + + hr = IWbemClassObject_Get( obj, prop_nameW, 0, &name, NULL, NULL ); + if (hr != S_OK) return hr; + + hr = create_signature( class_serviceW, method_stopserviceW, PARAM_OUT, &sig ); + if (hr != S_OK) + { + VariantClear( &name ); + return hr; + } + hr = IWbemClassObject_SpawnInstance( sig, 0, out ); + if (hr != S_OK) + { + VariantClear( &name ); + IWbemClassObject_Release( sig ); + return hr; + } + hr = control_service( V_BSTR(&name), SERVICE_CONTROL_STOP, &retval ); + if (hr != S_OK) goto done; + hr = IWbemClassObject_Put( *out, param_returnvalueW, 0, &retval, CIM_UINT32 ); + +done: + VariantClear( &name ); + IWbemClassObject_Release( sig ); + if (hr != S_OK) IWbemClassObject_Release( *out ); + return hr; +} diff --git a/reactos/dll/win32/wbemprox/services.c b/reactos/dll/win32/wbemprox/services.c new file mode 100644 index 00000000000..65ea433ac62 --- /dev/null +++ b/reactos/dll/win32/wbemprox/services.c @@ -0,0 +1,680 @@ +/* + * Copyright 2012 Hans Leidekker for CodeWeavers + * + * 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 + */ + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H + +#define COBJMACROS + +#include "config.h" +#include + +#include "windef.h" +#include "winbase.h" +#include "objbase.h" +#include "oleauto.h" +#include "wbemcli.h" + +#include "wine/debug.h" +#include "wine/unicode.h" +#include "wbemprox_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wbemprox); + +struct client_security +{ + IClientSecurity IClientSecurity_iface; +}; + +static inline struct client_security *impl_from_IClientSecurity( IClientSecurity *iface ) +{ + return CONTAINING_RECORD( iface, struct client_security, IClientSecurity_iface ); +} + +static HRESULT WINAPI client_security_QueryInterface( + IClientSecurity *iface, + REFIID riid, + void **ppvObject ) +{ + struct client_security *cs = impl_from_IClientSecurity( iface ); + + TRACE("%p %s %p\n", cs, debugstr_guid( riid ), ppvObject ); + + if ( IsEqualGUID( riid, &IID_IClientSecurity ) || + IsEqualGUID( riid, &IID_IUnknown ) ) + { + *ppvObject = cs; + } + else + { + FIXME("interface %s not implemented\n", debugstr_guid(riid)); + return E_NOINTERFACE; + } + IClientSecurity_AddRef( iface ); + return S_OK; +} + +static ULONG WINAPI client_security_AddRef( + IClientSecurity *iface ) +{ + FIXME("%p\n", iface); + return 2; +} + +static ULONG WINAPI client_security_Release( + IClientSecurity *iface ) +{ + FIXME("%p\n", iface); + return 1; +} + +static HRESULT WINAPI client_security_QueryBlanket( + IClientSecurity *iface, + IUnknown *pProxy, + DWORD *pAuthnSvc, + DWORD *pAuthzSvc, + OLECHAR **pServerPrincName, + DWORD *pAuthnLevel, + DWORD *pImpLevel, + void **pAuthInfo, + DWORD *pCapabilities ) +{ + FIXME("\n"); + return WBEM_E_FAILED; +} + +static HRESULT WINAPI client_security_SetBlanket( + IClientSecurity *iface, + IUnknown *pProxy, + DWORD AuthnSvc, + DWORD AuthzSvc, + OLECHAR *pServerPrincName, + DWORD AuthnLevel, + DWORD ImpLevel, + void *pAuthInfo, + DWORD Capabilities ) +{ + static const OLECHAR defaultW[] = + {'<','C','O','L','E','_','D','E','F','A','U','L','T','_','P','R','I','N','C','I','P','A','L','>',0}; + const OLECHAR *princname = (pServerPrincName == COLE_DEFAULT_PRINCIPAL) ? defaultW : pServerPrincName; + + FIXME("%p, %p, %u, %u, %s, %u, %u, %p, 0x%08x\n", iface, pProxy, AuthnSvc, AuthzSvc, + debugstr_w(princname), AuthnLevel, ImpLevel, pAuthInfo, Capabilities); + return WBEM_NO_ERROR; +} + +static HRESULT WINAPI client_security_CopyProxy( + IClientSecurity *iface, + IUnknown *pProxy, + IUnknown **ppCopy ) +{ + FIXME("\n"); + return WBEM_E_FAILED; +} + +static const IClientSecurityVtbl client_security_vtbl = +{ + client_security_QueryInterface, + client_security_AddRef, + client_security_Release, + client_security_QueryBlanket, + client_security_SetBlanket, + client_security_CopyProxy +}; + +IClientSecurity client_security = { &client_security_vtbl }; + +struct wbem_services +{ + IWbemServices IWbemServices_iface; + LONG refs; + WCHAR *namespace; +}; + +static inline struct wbem_services *impl_from_IWbemServices( IWbemServices *iface ) +{ + return CONTAINING_RECORD( iface, struct wbem_services, IWbemServices_iface ); +} + +static ULONG WINAPI wbem_services_AddRef( + IWbemServices *iface ) +{ + struct wbem_services *ws = impl_from_IWbemServices( iface ); + return InterlockedIncrement( &ws->refs ); +} + +static ULONG WINAPI wbem_services_Release( + IWbemServices *iface ) +{ + struct wbem_services *ws = impl_from_IWbemServices( iface ); + LONG refs = InterlockedDecrement( &ws->refs ); + if (!refs) + { + TRACE("destroying %p\n", ws); + heap_free( ws->namespace ); + heap_free( ws ); + } + return refs; +} + +static HRESULT WINAPI wbem_services_QueryInterface( + IWbemServices *iface, + REFIID riid, + void **ppvObject ) +{ + struct wbem_services *ws = impl_from_IWbemServices( iface ); + + TRACE("%p %s %p\n", ws, debugstr_guid( riid ), ppvObject ); + + if ( IsEqualGUID( riid, &IID_IWbemServices ) || + IsEqualGUID( riid, &IID_IUnknown ) ) + { + *ppvObject = ws; + } + else if ( IsEqualGUID( riid, &IID_IClientSecurity ) ) + { + *ppvObject = &client_security; + return S_OK; + } + else + { + FIXME("interface %s not implemented\n", debugstr_guid(riid)); + return E_NOINTERFACE; + } + IWbemServices_AddRef( iface ); + return S_OK; +} + +static HRESULT WINAPI wbem_services_OpenNamespace( + IWbemServices *iface, + const BSTR strNamespace, + LONG lFlags, + IWbemContext *pCtx, + IWbemServices **ppWorkingNamespace, + IWbemCallResult **ppResult ) +{ + static const WCHAR cimv2W[] = {'c','i','m','v','2',0}; + static const WCHAR defaultW[] = {'d','e','f','a','u','l','t',0}; + struct wbem_services *ws = impl_from_IWbemServices( iface ); + + TRACE("%p, %s, 0x%08x, %p, %p, %p\n", iface, debugstr_w(strNamespace), lFlags, + pCtx, ppWorkingNamespace, ppResult); + + if ((strcmpiW( strNamespace, cimv2W ) && strcmpiW( strNamespace, defaultW )) || ws->namespace) + return WBEM_E_INVALID_NAMESPACE; + + return WbemServices_create( NULL, cimv2W, (void **)ppWorkingNamespace ); +} + +static HRESULT WINAPI wbem_services_CancelAsyncCall( + IWbemServices *iface, + IWbemObjectSink *pSink ) +{ + FIXME("\n"); + return WBEM_E_FAILED; +} + +static HRESULT WINAPI wbem_services_QueryObjectSink( + IWbemServices *iface, + LONG lFlags, + IWbemObjectSink **ppResponseHandler ) +{ + FIXME("\n"); + return WBEM_E_FAILED; +} + +struct path +{ + WCHAR *class; + UINT class_len; + WCHAR *filter; + UINT filter_len; +}; + +static HRESULT parse_path( const WCHAR *str, struct path **ret ) +{ + struct path *path; + const WCHAR *p = str, *q; + UINT len; + + if (!(path = heap_alloc_zero( sizeof(*path) ))) return E_OUTOFMEMORY; + + while (*p && *p != '.') p++; + + len = p - str; + if (!(path->class = heap_alloc( (len + 1) * sizeof(WCHAR) ))) + { + heap_free( path ); + return E_OUTOFMEMORY; + } + memcpy( path->class, str, len * sizeof(WCHAR) ); + path->class[len] = 0; + path->class_len = len; + + if (p[0] == '.' && p[1]) + { + q = ++p; + while (*q) q++; + + len = q - p; + if (!(path->filter = heap_alloc( (len + 1) * sizeof(WCHAR) ))) + { + heap_free( path->class ); + heap_free( path ); + return E_OUTOFMEMORY; + } + memcpy( path->filter, p, len * sizeof(WCHAR) ); + path->filter[len] = 0; + path->filter_len = len; + } + *ret = path; + return S_OK; +} + +static void free_path( struct path *path ) +{ + heap_free( path->class ); + heap_free( path->filter ); + heap_free( path ); +} + +static HRESULT create_instance_enum( const struct path *path, IEnumWbemClassObject **iter ) +{ + static const WCHAR selectW[] = + {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','%','s',' ', + 'W','H','E','R','E',' ','%','s',0}; + static const WCHAR select_allW[] = + {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',0}; + WCHAR *query; + HRESULT hr; + UINT len; + + if (path->filter) + { + len = path->class_len + path->filter_len + SIZEOF(selectW); + if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY; + sprintfW( query, selectW, path->class, path->filter ); + } + else + { + len = path->class_len + SIZEOF(select_allW); + if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY; + strcpyW( query, select_allW ); + strcatW( query, path->class ); + } + hr = exec_query( query, iter ); + heap_free( query ); + return hr; +} + +HRESULT get_object( const WCHAR *object_path, IWbemClassObject **obj ) +{ + IEnumWbemClassObject *iter; + struct path *path; + HRESULT hr; + + hr = parse_path( object_path, &path ); + if (hr != S_OK) return hr; + + hr = create_instance_enum( path, &iter ); + if (hr != S_OK) + { + free_path( path ); + return hr; + } + hr = create_class_object( path->class, iter, 0, NULL, obj ); + IEnumWbemClassObject_Release( iter ); + free_path( path ); + return hr; +} + +static HRESULT WINAPI wbem_services_GetObject( + IWbemServices *iface, + const BSTR strObjectPath, + LONG lFlags, + IWbemContext *pCtx, + IWbemClassObject **ppObject, + IWbemCallResult **ppCallResult ) +{ + TRACE("%p, %s, 0x%08x, %p, %p, %p\n", iface, debugstr_w(strObjectPath), lFlags, + pCtx, ppObject, ppCallResult); + + if (lFlags) FIXME("unsupported flags 0x%08x\n", lFlags); + + if (!strObjectPath || !strObjectPath[0]) + return create_class_object( NULL, NULL, 0, NULL, ppObject ); + + return get_object( strObjectPath, ppObject ); +} + +static HRESULT WINAPI wbem_services_GetObjectAsync( + IWbemServices *iface, + const BSTR strObjectPath, + LONG lFlags, + IWbemContext *pCtx, + IWbemObjectSink *pResponseHandler ) +{ + FIXME("\n"); + return WBEM_E_FAILED; +} + +static HRESULT WINAPI wbem_services_PutClass( + IWbemServices *iface, + IWbemClassObject *pObject, + LONG lFlags, + IWbemContext *pCtx, + IWbemCallResult **ppCallResult ) +{ + FIXME("\n"); + return WBEM_E_FAILED; +} + +static HRESULT WINAPI wbem_services_PutClassAsync( + IWbemServices *iface, + IWbemClassObject *pObject, + LONG lFlags, + IWbemContext *pCtx, + IWbemObjectSink *pResponseHandler ) +{ + FIXME("\n"); + return WBEM_E_FAILED; +} + +static HRESULT WINAPI wbem_services_DeleteClass( + IWbemServices *iface, + const BSTR strClass, + LONG lFlags, + IWbemContext *pCtx, + IWbemCallResult **ppCallResult ) +{ + FIXME("\n"); + return WBEM_E_FAILED; +} + +static HRESULT WINAPI wbem_services_DeleteClassAsync( + IWbemServices *iface, + const BSTR strClass, + LONG lFlags, + IWbemContext *pCtx, + IWbemObjectSink *pResponseHandler ) +{ + FIXME("\n"); + return WBEM_E_FAILED; +} + +static HRESULT WINAPI wbem_services_CreateClassEnum( + IWbemServices *iface, + const BSTR strSuperclass, + LONG lFlags, + IWbemContext *pCtx, + IEnumWbemClassObject **ppEnum ) +{ + FIXME("\n"); + return WBEM_E_FAILED; +} + +static HRESULT WINAPI wbem_services_CreateClassEnumAsync( + IWbemServices *iface, + const BSTR strSuperclass, + LONG lFlags, + IWbemContext *pCtx, + IWbemObjectSink *pResponseHandler ) +{ + FIXME("\n"); + return WBEM_E_FAILED; +} + +static HRESULT WINAPI wbem_services_PutInstance( + IWbemServices *iface, + IWbemClassObject *pInst, + LONG lFlags, + IWbemContext *pCtx, + IWbemCallResult **ppCallResult ) +{ + FIXME("\n"); + return WBEM_E_FAILED; +} + +static HRESULT WINAPI wbem_services_PutInstanceAsync( + IWbemServices *iface, + IWbemClassObject *pInst, + LONG lFlags, + IWbemContext *pCtx, + IWbemObjectSink *pResponseHandler ) +{ + FIXME("\n"); + return WBEM_E_FAILED; +} + +static HRESULT WINAPI wbem_services_DeleteInstance( + IWbemServices *iface, + const BSTR strObjectPath, + LONG lFlags, + IWbemContext *pCtx, + IWbemCallResult **ppCallResult ) +{ + FIXME("\n"); + return WBEM_E_FAILED; +} + +static HRESULT WINAPI wbem_services_DeleteInstanceAsync( + IWbemServices *iface, + const BSTR strObjectPath, + LONG lFlags, + IWbemContext *pCtx, + IWbemObjectSink *pResponseHandler ) +{ + FIXME("\n"); + return WBEM_E_FAILED; +} + +static HRESULT WINAPI wbem_services_CreateInstanceEnum( + IWbemServices *iface, + const BSTR strClass, + LONG lFlags, + IWbemContext *pCtx, + IEnumWbemClassObject **ppEnum ) +{ + struct path *path; + HRESULT hr; + + TRACE("%p, %s, 0%08x, %p, %p\n", iface, debugstr_w(strClass), lFlags, pCtx, ppEnum); + + if (lFlags) FIXME("unsupported flags 0x%08x\n", lFlags); + + hr = parse_path( strClass, &path ); + if (hr != S_OK) return hr; + + hr = create_instance_enum( path, ppEnum ); + free_path( path ); + return hr; +} + +static HRESULT WINAPI wbem_services_CreateInstanceEnumAsync( + IWbemServices *iface, + const BSTR strFilter, + LONG lFlags, + IWbemContext *pCtx, + IWbemObjectSink *pResponseHandler ) +{ + FIXME("\n"); + return WBEM_E_FAILED; +} + +static HRESULT WINAPI wbem_services_ExecQuery( + IWbemServices *iface, + const BSTR strQueryLanguage, + const BSTR strQuery, + LONG lFlags, + IWbemContext *pCtx, + IEnumWbemClassObject **ppEnum ) +{ + static const WCHAR wqlW[] = {'W','Q','L',0}; + + TRACE("%p, %s, %s, 0x%08x, %p, %p\n", iface, debugstr_w(strQueryLanguage), + debugstr_w(strQuery), lFlags, pCtx, ppEnum); + + if (!strQueryLanguage || !strQuery || !strQuery[0]) return WBEM_E_INVALID_PARAMETER; + if (strcmpiW( strQueryLanguage, wqlW )) return WBEM_E_INVALID_QUERY_TYPE; + return exec_query( strQuery, ppEnum ); +} + +static HRESULT WINAPI wbem_services_ExecQueryAsync( + IWbemServices *iface, + const BSTR strQueryLanguage, + const BSTR strQuery, + LONG lFlags, + IWbemContext *pCtx, + IWbemObjectSink *pResponseHandler ) +{ + FIXME("\n"); + return WBEM_E_FAILED; +} + +static HRESULT WINAPI wbem_services_ExecNotificationQuery( + IWbemServices *iface, + const BSTR strQueryLanguage, + const BSTR strQuery, + LONG lFlags, + IWbemContext *pCtx, + IEnumWbemClassObject **ppEnum ) +{ + FIXME("\n"); + return WBEM_E_FAILED; +} + +static HRESULT WINAPI wbem_services_ExecNotificationQueryAsync( + IWbemServices *iface, + const BSTR strQueryLanguage, + const BSTR strQuery, + LONG lFlags, + IWbemContext *pCtx, + IWbemObjectSink *pResponseHandler ) +{ + FIXME("\n"); + return WBEM_E_FAILED; +} + +static HRESULT WINAPI wbem_services_ExecMethod( + IWbemServices *iface, + const BSTR strObjectPath, + const BSTR strMethodName, + LONG lFlags, + IWbemContext *pCtx, + IWbemClassObject *pInParams, + IWbemClassObject **ppOutParams, + IWbemCallResult **ppCallResult ) +{ + IWbemClassObject *obj; + struct table *table; + class_method *func; + struct path *path; + HRESULT hr; + + TRACE("%p, %s, %s, %08x, %p, %p, %p, %p\n", iface, debugstr_w(strObjectPath), + debugstr_w(strMethodName), lFlags, pCtx, pInParams, ppOutParams, ppCallResult); + + if (lFlags) FIXME("flags %08x not supported\n", lFlags); + + if ((hr = get_object( strObjectPath, &obj ))) return hr; + if ((hr = parse_path( strObjectPath, &path )) != S_OK) + { + IWbemClassObject_Release( obj ); + return hr; + } + table = grab_table( path->class ); + free_path( path ); + if (!table) + { + IWbemClassObject_Release( obj ); + return WBEM_E_NOT_FOUND; + } + hr = get_method( table, strMethodName, &func ); + release_table( table ); + if (hr != S_OK) + { + IWbemClassObject_Release( obj ); + return hr; + } + hr = func( obj, pInParams, ppOutParams ); + IWbemClassObject_Release( obj ); + return hr; +} + +static HRESULT WINAPI wbem_services_ExecMethodAsync( + IWbemServices *iface, + const BSTR strObjectPath, + const BSTR strMethodName, + LONG lFlags, + IWbemContext *pCtx, + IWbemClassObject *pInParams, + IWbemObjectSink *pResponseHandler ) +{ + FIXME("\n"); + return WBEM_E_FAILED; +} + +static const IWbemServicesVtbl wbem_services_vtbl = +{ + wbem_services_QueryInterface, + wbem_services_AddRef, + wbem_services_Release, + wbem_services_OpenNamespace, + wbem_services_CancelAsyncCall, + wbem_services_QueryObjectSink, + wbem_services_GetObject, + wbem_services_GetObjectAsync, + wbem_services_PutClass, + wbem_services_PutClassAsync, + wbem_services_DeleteClass, + wbem_services_DeleteClassAsync, + wbem_services_CreateClassEnum, + wbem_services_CreateClassEnumAsync, + wbem_services_PutInstance, + wbem_services_PutInstanceAsync, + wbem_services_DeleteInstance, + wbem_services_DeleteInstanceAsync, + wbem_services_CreateInstanceEnum, + wbem_services_CreateInstanceEnumAsync, + wbem_services_ExecQuery, + wbem_services_ExecQueryAsync, + wbem_services_ExecNotificationQuery, + wbem_services_ExecNotificationQueryAsync, + wbem_services_ExecMethod, + wbem_services_ExecMethodAsync +}; + +HRESULT WbemServices_create( IUnknown *pUnkOuter, const WCHAR *namespace, LPVOID *ppObj ) +{ + struct wbem_services *ws; + + TRACE("(%p,%p)\n", pUnkOuter, ppObj); + + ws = heap_alloc( sizeof(*ws) ); + if (!ws) return E_OUTOFMEMORY; + + ws->IWbemServices_iface.lpVtbl = &wbem_services_vtbl; + ws->refs = 1; + ws->namespace = heap_strdupW( namespace ); + + *ppObj = &ws->IWbemServices_iface; + + TRACE("returning iface %p\n", *ppObj); + return S_OK; +} diff --git a/reactos/dll/win32/wbemprox/table.c b/reactos/dll/win32/wbemprox/table.c new file mode 100644 index 00000000000..1eb76c5bc57 --- /dev/null +++ b/reactos/dll/win32/wbemprox/table.c @@ -0,0 +1,437 @@ +/* + * Copyright 2012 Hans Leidekker for CodeWeavers + * + * 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 + */ + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H + +#define COBJMACROS + +#include "config.h" +#include + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "objbase.h" +#include "oleauto.h" +#include "wbemcli.h" + +#include "wine/debug.h" +#include "wbemprox_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wbemprox); + +HRESULT get_column_index( const struct table *table, const WCHAR *name, UINT *column ) +{ + UINT i; + for (i = 0; i < table->num_cols; i++) + { + if (!strcmpiW( table->columns[i].name, name )) + { + *column = i; + return S_OK; + } + } + return WBEM_E_INVALID_QUERY; +} + +UINT get_type_size( CIMTYPE type ) +{ + if (type & CIM_FLAG_ARRAY) return sizeof(void *); + + switch (type) + { + case CIM_BOOLEAN: + return sizeof(int); + case CIM_SINT16: + case CIM_UINT16: + return sizeof(INT16); + case CIM_SINT32: + case CIM_UINT32: + return sizeof(INT32); + case CIM_SINT64: + case CIM_UINT64: + return sizeof(INT64); + case CIM_DATETIME: + case CIM_STRING: + return sizeof(WCHAR *); + default: + ERR("unhandled type %u\n", type); + break; + } + return sizeof(LONGLONG); +} + +static UINT get_column_size( const struct table *table, UINT column ) +{ + return get_type_size( table->columns[column].type & COL_TYPE_MASK ); +} + +static UINT get_column_offset( const struct table *table, UINT column ) +{ + UINT i, offset = 0; + for (i = 0; i < column; i++) offset += get_column_size( table, i ); + return offset; +} + +static UINT get_row_size( const struct table *table ) +{ + return get_column_offset( table, table->num_cols - 1 ) + get_column_size( table, table->num_cols - 1 ); +} + +HRESULT get_value( const struct table *table, UINT row, UINT column, LONGLONG *val ) +{ + UINT col_offset, row_size; + const BYTE *ptr; + + col_offset = get_column_offset( table, column ); + row_size = get_row_size( table ); + ptr = table->data + row * row_size + col_offset; + + if (table->columns[column].type & CIM_FLAG_ARRAY) + { + *val = (INT_PTR)*(const void **)ptr; + return S_OK; + } + switch (table->columns[column].type & COL_TYPE_MASK) + { + case CIM_BOOLEAN: + *val = *(const int *)ptr; + break; + case CIM_DATETIME: + case CIM_STRING: + *val = (INT_PTR)*(const WCHAR **)ptr; + break; + case CIM_SINT16: + *val = *(const INT16 *)ptr; + break; + case CIM_UINT16: + *val = *(const UINT16 *)ptr; + break; + case CIM_SINT32: + *val = *(const INT32 *)ptr; + break; + case CIM_UINT32: + *val = *(const UINT32 *)ptr; + break; + case CIM_SINT64: + *val = *(const INT64 *)ptr; + break; + case CIM_UINT64: + *val = *(const UINT64 *)ptr; + break; + default: + ERR("invalid column type %u\n", table->columns[column].type & COL_TYPE_MASK); + *val = 0; + break; + } + return S_OK; +} + +BSTR get_value_bstr( const struct table *table, UINT row, UINT column ) +{ + static const WCHAR fmt_signedW[] = {'%','d',0}; + static const WCHAR fmt_unsignedW[] = {'%','u',0}; + static const WCHAR fmt_signed64W[] = {'%','I','6','4','d',0}; + static const WCHAR fmt_unsigned64W[] = {'%','I','6','4','u',0}; + static const WCHAR fmt_strW[] = {'\"','%','s','\"',0}; + static const WCHAR trueW[] = {'T','R','U','E',0}; + static const WCHAR falseW[] = {'F','A','L','S','E',0}; + LONGLONG val; + BSTR ret; + WCHAR number[22]; + UINT len; + + if (table->columns[column].type & CIM_FLAG_ARRAY) + { + FIXME("array to string conversion not handled\n"); + return NULL; + } + if (get_value( table, row, column, &val ) != S_OK) return NULL; + + switch (table->columns[column].type & COL_TYPE_MASK) + { + case CIM_BOOLEAN: + if (val) return SysAllocString( trueW ); + else return SysAllocString( falseW ); + + case CIM_DATETIME: + case CIM_STRING: + if (!val) return NULL; + len = strlenW( (const WCHAR *)(INT_PTR)val ) + 2; + if (!(ret = SysAllocStringLen( NULL, len ))) return NULL; + sprintfW( ret, fmt_strW, (const WCHAR *)(INT_PTR)val ); + return ret; + + case CIM_SINT16: + case CIM_SINT32: + sprintfW( number, fmt_signedW, val ); + return SysAllocString( number ); + + case CIM_UINT16: + case CIM_UINT32: + sprintfW( number, fmt_unsignedW, val ); + return SysAllocString( number ); + + case CIM_SINT64: + wsprintfW( number, fmt_signed64W, val ); + return SysAllocString( number ); + + case CIM_UINT64: + wsprintfW( number, fmt_unsigned64W, val ); + return SysAllocString( number ); + + default: + FIXME("unhandled column type %u\n", table->columns[column].type & COL_TYPE_MASK); + break; + } + return NULL; +} + +HRESULT set_value( const struct table *table, UINT row, UINT column, LONGLONG val, + CIMTYPE type ) +{ + UINT col_offset, row_size; + BYTE *ptr; + + if ((table->columns[column].type & COL_TYPE_MASK) != type) return WBEM_E_TYPE_MISMATCH; + + col_offset = get_column_offset( table, column ); + row_size = get_row_size( table ); + ptr = table->data + row * row_size + col_offset; + + switch (table->columns[column].type & COL_TYPE_MASK) + { + case CIM_DATETIME: + case CIM_STRING: + *(WCHAR **)ptr = (WCHAR *)(INT_PTR)val; + break; + case CIM_SINT16: + *(INT16 *)ptr = val; + break; + case CIM_UINT16: + *(UINT16 *)ptr = val; + break; + case CIM_SINT32: + *(INT32 *)ptr = val; + break; + case CIM_UINT32: + *(UINT32 *)ptr = val; + break; + case CIM_SINT64: + *(INT64 *)ptr = val; + break; + case CIM_UINT64: + *(UINT64 *)ptr = val; + break; + default: + FIXME("unhandled column type %u\n", type); + return WBEM_E_FAILED; + } + return S_OK; +} + +HRESULT get_method( const struct table *table, const WCHAR *name, class_method **func ) +{ + UINT i, j; + + for (i = 0; i < table->num_rows; i++) + { + for (j = 0; j < table->num_cols; j++) + { + if (table->columns[j].type & COL_FLAG_METHOD && !strcmpW( table->columns[j].name, name )) + { + HRESULT hr; + LONGLONG val; + + if ((hr = get_value( table, i, j, &val )) != S_OK) return hr; + *func = (class_method *)(INT_PTR)val; + return S_OK; + } + } + } + return WBEM_E_INVALID_METHOD; + +} + +static void clear_table( struct table *table ) +{ + UINT i, j, type; + LONGLONG val; + + if (!table->data) return; + + for (i = 0; i < table->num_rows; i++) + { + for (j = 0; j < table->num_cols; j++) + { + if (!(table->columns[j].type & COL_FLAG_DYNAMIC)) continue; + + type = table->columns[j].type & COL_TYPE_MASK; + if (type == CIM_STRING || type == CIM_DATETIME || (type & CIM_FLAG_ARRAY)) + { + if (get_value( table, i, j, &val ) == S_OK) heap_free( (void *)(INT_PTR)val ); + } + } + } + if (table->fill) + { + table->num_rows = 0; + heap_free( table->data ); + table->data = NULL; + } +} + +void free_columns( struct column *columns, UINT num_cols ) +{ + UINT i; + + for (i = 0; i < num_cols; i++) + { + heap_free( (WCHAR *)columns[i].name ); + } + heap_free( columns ); +} + +void free_table( struct table *table ) +{ + if (!table) return; + + clear_table( table ); + if (table->flags & TABLE_FLAG_DYNAMIC) + { + TRACE("destroying %p\n", table); + heap_free( (WCHAR *)table->name ); + free_columns( (struct column *)table->columns, table->num_cols ); + list_remove( &table->entry ); + heap_free( table ); + } +} + +void release_table( struct table *table ) +{ + if (!InterlockedDecrement( &table->refs )) free_table( table ); +} + +struct table *addref_table( struct table *table ) +{ + InterlockedIncrement( &table->refs ); + return table; +} + +struct table *grab_table( const WCHAR *name ) +{ + struct table *table; + + LIST_FOR_EACH_ENTRY( table, table_list, struct table, entry ) + { + if (!strcmpiW( table->name, name )) + { + if (table->fill && !table->data) table->fill( table ); + TRACE("returning %p\n", table); + return addref_table( table ); + } + } + return NULL; +} + +struct table *create_table( const WCHAR *name, UINT num_cols, const struct column *columns, + UINT num_rows, BYTE *data, void (*fill)(struct table *) ) +{ + struct table *table; + + if (!(table = heap_alloc( sizeof(*table) ))) return NULL; + table->name = heap_strdupW( name ); + table->num_cols = num_cols; + table->columns = columns; + table->num_rows = num_rows; + table->data = data; + table->fill = fill; + table->flags = TABLE_FLAG_DYNAMIC; + table->refs = 0; + list_init( &table->entry ); + return table; +} + +BOOL add_table( struct table *table ) +{ + struct table *iter; + + LIST_FOR_EACH_ENTRY( iter, table_list, struct table, entry ) + { + if (!strcmpiW( iter->name, table->name )) + { + TRACE("table %s already exists\n", debugstr_w(table->name)); + return FALSE; + } + } + list_add_tail( table_list, &table->entry ); + TRACE("added %p\n", table); + return TRUE; +} + +BSTR get_method_name( const WCHAR *class, UINT index ) +{ + struct table *table; + UINT i, count = 0; + BSTR ret; + + if (!(table = grab_table( class ))) return NULL; + + for (i = 0; i < table->num_cols; i++) + { + if (table->columns[i].type & COL_FLAG_METHOD) + { + if (index == count) + { + ret = SysAllocString( table->columns[i].name ); + release_table( table ); + return ret; + } + count++; + } + } + release_table( table ); + return NULL; +} + +BSTR get_property_name( const WCHAR *class, UINT index ) +{ + struct table *table; + UINT i, count = 0; + BSTR ret; + + if (!(table = grab_table( class ))) return NULL; + + for (i = 0; i < table->num_cols; i++) + { + if (!(table->columns[i].type & COL_FLAG_METHOD)) + { + if (index == count) + { + ret = SysAllocString( table->columns[i].name ); + release_table( table ); + return ret; + } + count++; + } + } + release_table( table ); + return NULL; +} diff --git a/reactos/dll/win32/wbemprox/wbemlocator.c b/reactos/dll/win32/wbemprox/wbemlocator.c new file mode 100644 index 00000000000..c92cdd48c7c --- /dev/null +++ b/reactos/dll/win32/wbemprox/wbemlocator.c @@ -0,0 +1,231 @@ +/* + * Copyright 2009 Hans Leidekker for CodeWeavers + * + * 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 + */ + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H + +#define COBJMACROS + +#include "config.h" +#include + +#include "windef.h" +#include "winbase.h" +#include "objbase.h" +#include "oleauto.h" +#include "wbemcli.h" + +#include "wine/debug.h" +#include "wine/unicode.h" +#include "wbemprox_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wbemprox); + +typedef struct +{ + IWbemLocator IWbemLocator_iface; + LONG refs; +} wbem_locator; + +static inline wbem_locator *impl_from_IWbemLocator( IWbemLocator *iface ) +{ + return CONTAINING_RECORD(iface, wbem_locator, IWbemLocator_iface); +} + +static ULONG WINAPI wbem_locator_AddRef( + IWbemLocator *iface ) +{ + wbem_locator *wl = impl_from_IWbemLocator( iface ); + return InterlockedIncrement( &wl->refs ); +} + +static ULONG WINAPI wbem_locator_Release( + IWbemLocator *iface ) +{ + wbem_locator *wl = impl_from_IWbemLocator( iface ); + LONG refs = InterlockedDecrement( &wl->refs ); + if (!refs) + { + TRACE("destroying %p\n", wl); + heap_free( wl ); + } + return refs; +} + +static HRESULT WINAPI wbem_locator_QueryInterface( + IWbemLocator *iface, + REFIID riid, + void **ppvObject ) +{ + wbem_locator *This = impl_from_IWbemLocator( iface ); + + TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject ); + + if ( IsEqualGUID( riid, &IID_IWbemLocator ) || + IsEqualGUID( riid, &IID_IUnknown ) ) + { + *ppvObject = iface; + } + else + { + FIXME("interface %s not implemented\n", debugstr_guid(riid)); + return E_NOINTERFACE; + } + IWbemLocator_AddRef( iface ); + return S_OK; +} + +static BOOL is_local_machine( const WCHAR *server ) +{ + static const WCHAR dotW[] = {'.',0}; + WCHAR buffer[MAX_COMPUTERNAME_LENGTH + 1]; + DWORD len = sizeof(buffer) / sizeof(buffer[0]); + + if (!server || !strcmpW( server, dotW )) return TRUE; + if (GetComputerNameW( buffer, &len ) && !strcmpiW( server, buffer )) return TRUE; + return FALSE; +} + +static HRESULT parse_resource( const WCHAR *resource, WCHAR **server, WCHAR **namespace ) +{ + static const WCHAR rootW[] = {'R','O','O','T'}; + static const WCHAR cimv2W[] = {'C','I','M','V','2'}; + HRESULT hr = WBEM_E_INVALID_NAMESPACE; + const WCHAR *p, *q; + unsigned int len; + + *server = NULL; + *namespace = NULL; + p = q = resource; + if (*p == '\\' || *p == '/') + { + p++; + if (*p == '\\' || *p == '/') p++; + if (!*p) return WBEM_E_INVALID_NAMESPACE; + if (*p == '\\' || *p == '/') return WBEM_E_INVALID_PARAMETER; + q = p + 1; + while (*q && *q != '\\' && *q != '/') q++; + if (!*q) return WBEM_E_INVALID_NAMESPACE; + len = q - p; + if (!(*server = heap_alloc( (len + 1) * sizeof(WCHAR) ))) + { + hr = E_OUTOFMEMORY; + goto done; + } + memcpy( *server, p, len * sizeof(WCHAR) ); + (*server)[len] = 0; + q++; + } + if (!*q) goto done; + p = q; + while (*q && *q != '\\' && *q != '/') q++; + len = q - p; + if (len >= sizeof(rootW) / sizeof(rootW[0]) && memicmpW( rootW, p, len )) goto done; + if (!*q) + { + hr = S_OK; + goto done; + } + q++; + if ((len = strlenW( q )) != sizeof(cimv2W) / sizeof(cimv2W[0]) || memicmpW( q, cimv2W, len )) + goto done; + if (!(*namespace = heap_alloc( (len + 1) * sizeof(WCHAR) ))) hr = E_OUTOFMEMORY; + else + { + memcpy( *namespace, p, len * sizeof(WCHAR) ); + (*namespace)[len] = 0; + hr = S_OK; + } + +done: + if (hr != S_OK) + { + heap_free( *server ); + heap_free( *namespace ); + } + return hr; +} + +static HRESULT WINAPI wbem_locator_ConnectServer( + IWbemLocator *iface, + const BSTR NetworkResource, + const BSTR User, + const BSTR Password, + const BSTR Locale, + LONG SecurityFlags, + const BSTR Authority, + IWbemContext *pCtx, + IWbemServices **ppNamespace) +{ + HRESULT hr; + WCHAR *server, *namespace; + + TRACE("%p, %s, %s, %s, %s, 0x%08x, %s, %p, %p)\n", iface, debugstr_w(NetworkResource), debugstr_w(User), + debugstr_w(Password), debugstr_w(Locale), SecurityFlags, debugstr_w(Authority), pCtx, ppNamespace); + + hr = parse_resource( NetworkResource, &server, &namespace ); + if (hr != S_OK) return hr; + + if (!is_local_machine( server )) + { + FIXME("remote computer not supported\n"); + heap_free( server ); + heap_free( namespace ); + return WBEM_E_TRANSPORT_FAILURE; + } + if (User || Password || Authority) + FIXME("authentication not supported\n"); + if (Locale) + FIXME("specific locale not supported\n"); + if (SecurityFlags) + FIXME("unsupported flags\n"); + + hr = WbemServices_create( NULL, namespace, (void **)ppNamespace ); + heap_free( namespace ); + if (SUCCEEDED( hr )) + return WBEM_NO_ERROR; + + return WBEM_E_FAILED; +} + +static const IWbemLocatorVtbl wbem_locator_vtbl = +{ + wbem_locator_QueryInterface, + wbem_locator_AddRef, + wbem_locator_Release, + wbem_locator_ConnectServer +}; + +HRESULT WbemLocator_create( IUnknown *pUnkOuter, LPVOID *ppObj ) +{ + wbem_locator *wl; + + TRACE("(%p,%p)\n", pUnkOuter, ppObj); + + wl = heap_alloc( sizeof(*wl) ); + if (!wl) return E_OUTOFMEMORY; + + wl->IWbemLocator_iface.lpVtbl = &wbem_locator_vtbl; + wl->refs = 1; + + *ppObj = &wl->IWbemLocator_iface; + + TRACE("returning iface %p\n", *ppObj); + return S_OK; +} diff --git a/reactos/dll/win32/wbemprox/wbemprox.idl b/reactos/dll/win32/wbemprox/wbemprox.idl new file mode 100644 index 00000000000..4b19384bc7e --- /dev/null +++ b/reactos/dll/win32/wbemprox/wbemprox.idl @@ -0,0 +1,33 @@ +/* + * COM Classes for wbemprox + * + * Copyright 2010 Alexandre Julliard + * + * 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 + */ + +[ + helpstring("WBEM Locator"), + threading(both), + uuid(4590f811-1d3a-11d0-891f-00aa004b2e24) +] +coclass WbemLocator { interface IWbemLocator; } + +[ + helpstring("WBEM Administrative Locator"), + threading(both), + uuid(cb8555cc-9128-11d1-ad9b-00c04fd8fdff) +] +coclass WbemAdministrativeLocator { interface IWbemLocator; } diff --git a/reactos/dll/win32/wbemprox/wbemprox.rc b/reactos/dll/win32/wbemprox/wbemprox.rc new file mode 100644 index 00000000000..b22a92f0800 --- /dev/null +++ b/reactos/dll/win32/wbemprox/wbemprox.rc @@ -0,0 +1 @@ +1 WINE_REGISTRY wbemprox.rgs diff --git a/reactos/dll/win32/wbemprox/wbemprox.rgs b/reactos/dll/win32/wbemprox/wbemprox.rgs new file mode 100644 index 00000000000..7982412679b --- /dev/null +++ b/reactos/dll/win32/wbemprox/wbemprox.rgs @@ -0,0 +1,17 @@ +HKCR +{ + NoRemove Interface + { + } + NoRemove CLSID + { + '{4590F811-1D3A-11D0-891F-00AA004B2E24}' = s 'WBEM Locator' + { + InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both' } + } + '{CB8555CC-9128-11D1-AD9B-00C04FD8FDFF}' = s 'WBEM Administrative Locator' + { + InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both' } + } + } +} diff --git a/reactos/dll/win32/wbemprox/wbemprox.spec b/reactos/dll/win32/wbemprox/wbemprox.spec new file mode 100644 index 00000000000..b16365d0c9f --- /dev/null +++ b/reactos/dll/win32/wbemprox/wbemprox.spec @@ -0,0 +1,4 @@ +@ stdcall -private DllCanUnloadNow() +@ stdcall -private DllGetClassObject(ptr ptr ptr) +@ stdcall -private DllRegisterServer() +@ stdcall -private DllUnregisterServer() diff --git a/reactos/dll/win32/wbemprox/wbemprox_private.h b/reactos/dll/win32/wbemprox/wbemprox_private.h new file mode 100644 index 00000000000..efdde761eba --- /dev/null +++ b/reactos/dll/win32/wbemprox/wbemprox_private.h @@ -0,0 +1,297 @@ +/* + * Copyright 2009 Hans Leidekker for CodeWeavers + * + * 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 + */ + +#include "wine/debug.h" +#include "wine/list.h" +#include "wine/unicode.h" + +IClientSecurity client_security; +struct list *table_list; + +#define SIZEOF(array) (sizeof(array)/sizeof((array)[0])) + +enum param_direction +{ + PARAM_OUT = -1, + PARAM_INOUT = 0, + PARAM_IN = 1 +}; + +#define CIM_TYPE_MASK 0x00000fff + +#define COL_TYPE_MASK 0x0000ffff +#define COL_FLAG_DYNAMIC 0x00010000 +#define COL_FLAG_KEY 0x00020000 +#define COL_FLAG_METHOD 0x00040000 + +typedef HRESULT (class_method)(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **); + +struct column +{ + const WCHAR *name; + UINT type; + VARTYPE vartype; /* 0 for default mapping */ +}; + +#define TABLE_FLAG_DYNAMIC 0x00000001 + +struct table +{ + const WCHAR *name; + UINT num_cols; + const struct column *columns; + UINT num_rows; + BYTE *data; + void (*fill)(struct table *); + UINT flags; + struct list entry; + LONG refs; +}; + +struct property +{ + const WCHAR *name; + const WCHAR *class; + const struct property *next; +}; + +struct array +{ + UINT count; + void *ptr; +}; + +struct field +{ + UINT type; + VARTYPE vartype; /* 0 for default mapping */ + union + { + LONGLONG ival; + WCHAR *sval; + struct array *aval; + } u; +}; + +struct record +{ + UINT count; + struct field *fields; + struct table *table; +}; + +enum operator +{ + OP_EQ = 1, + OP_AND = 2, + OP_OR = 3, + OP_GT = 4, + OP_LT = 5, + OP_LE = 6, + OP_GE = 7, + OP_NE = 8, + OP_ISNULL = 9, + OP_NOTNULL = 10, + OP_LIKE = 11 +}; + +struct expr; +struct complex_expr +{ + enum operator op; + struct expr *left; + struct expr *right; +}; + +enum expr_type +{ + EXPR_COMPLEX = 1, + EXPR_UNARY = 2, + EXPR_PROPVAL = 3, + EXPR_SVAL = 4, + EXPR_IVAL = 5, + EXPR_BVAL = 6 +}; + +struct expr +{ + enum expr_type type; + union + { + struct complex_expr expr; + const struct property *propval; + const WCHAR *sval; + int ival; + } u; +}; + +struct view +{ + const struct property *proplist; + struct table *table; + const struct expr *cond; + UINT *result; + UINT count; +}; + +struct query +{ + LONG refs; + struct view *view; + struct list mem; +}; + +struct query *addref_query( struct query * ) DECLSPEC_HIDDEN; +void release_query( struct query *query ) DECLSPEC_HIDDEN; +HRESULT exec_query( const WCHAR *, IEnumWbemClassObject ** ) DECLSPEC_HIDDEN; +HRESULT parse_query( const WCHAR *, struct view **, struct list * ) DECLSPEC_HIDDEN; +HRESULT create_view( const struct property *, const WCHAR *, const struct expr *, + struct view ** ) DECLSPEC_HIDDEN; +void destroy_view( struct view * ) DECLSPEC_HIDDEN; +void init_table_list( void ) DECLSPEC_HIDDEN; +struct table *grab_table( const WCHAR * ) DECLSPEC_HIDDEN; +struct table *addref_table( struct table * ) DECLSPEC_HIDDEN; +void release_table( struct table * ) DECLSPEC_HIDDEN; +struct table *create_table( const WCHAR *, UINT, const struct column *, UINT, + BYTE *, void (*)(struct table *)) DECLSPEC_HIDDEN; +BOOL add_table( struct table * ) DECLSPEC_HIDDEN; +void free_columns( struct column *, UINT ) DECLSPEC_HIDDEN; +void free_table( struct table * ) DECLSPEC_HIDDEN; +UINT get_type_size( CIMTYPE ) DECLSPEC_HIDDEN; +HRESULT get_column_index( const struct table *, const WCHAR *, UINT * ) DECLSPEC_HIDDEN; +HRESULT get_value( const struct table *, UINT, UINT, LONGLONG * ) DECLSPEC_HIDDEN; +BSTR get_value_bstr( const struct table *, UINT, UINT ) DECLSPEC_HIDDEN; +HRESULT set_value( const struct table *, UINT, UINT, LONGLONG, CIMTYPE ) DECLSPEC_HIDDEN; +HRESULT get_method( const struct table *, const WCHAR *, class_method ** ) DECLSPEC_HIDDEN; +HRESULT get_propval( const struct view *, UINT, const WCHAR *, VARIANT *, + CIMTYPE *, LONG * ) DECLSPEC_HIDDEN; +HRESULT put_propval( const struct view *, UINT, const WCHAR *, VARIANT *, CIMTYPE ) DECLSPEC_HIDDEN; +HRESULT to_longlong( VARIANT *, LONGLONG *, CIMTYPE * ) DECLSPEC_HIDDEN; +SAFEARRAY *to_safearray( const struct array *, CIMTYPE ) DECLSPEC_HIDDEN; +VARTYPE to_vartype( CIMTYPE ) DECLSPEC_HIDDEN; +void destroy_array( struct array *, CIMTYPE ) DECLSPEC_HIDDEN; +HRESULT get_properties( const struct view *, SAFEARRAY ** ) DECLSPEC_HIDDEN; +HRESULT get_object( const WCHAR *, IWbemClassObject ** ) DECLSPEC_HIDDEN; +BSTR get_method_name( const WCHAR *, UINT ) DECLSPEC_HIDDEN; +BSTR get_property_name( const WCHAR *, UINT ) DECLSPEC_HIDDEN; +void set_variant( VARTYPE, LONGLONG, void *, VARIANT * ) DECLSPEC_HIDDEN; +HRESULT create_signature( const WCHAR *, const WCHAR *, enum param_direction, + IWbemClassObject ** ) DECLSPEC_HIDDEN; + +HRESULT WbemLocator_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN; +HRESULT WbemServices_create(IUnknown *, const WCHAR *, LPVOID *) DECLSPEC_HIDDEN; +HRESULT create_class_object(const WCHAR *, IEnumWbemClassObject *, UINT, + struct record *, IWbemClassObject **) DECLSPEC_HIDDEN; +HRESULT EnumWbemClassObject_create(IUnknown *, struct query *, LPVOID *) DECLSPEC_HIDDEN; +HRESULT WbemQualifierSet_create(IUnknown *, const WCHAR *, const WCHAR *, LPVOID *) DECLSPEC_HIDDEN; + +HRESULT process_get_owner(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; +HRESULT reg_enum_key(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; +HRESULT reg_enum_values(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; +HRESULT reg_get_stringvalue(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; +HRESULT service_pause_service(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; +HRESULT service_resume_service(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; +HRESULT service_start_service(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; +HRESULT service_stop_service(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; + +static void *heap_alloc( size_t len ) __WINE_ALLOC_SIZE(1); +static inline void *heap_alloc( size_t len ) +{ + return HeapAlloc( GetProcessHeap(), 0, len ); +} + +static void *heap_realloc( void *mem, size_t len ) __WINE_ALLOC_SIZE(2); +static inline void *heap_realloc( void *mem, size_t len ) +{ + return HeapReAlloc( GetProcessHeap(), 0, mem, len ); +} + +static void *heap_alloc_zero( size_t len ) __WINE_ALLOC_SIZE(1); +static inline void *heap_alloc_zero( size_t len ) +{ + return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, len ); +} + +static inline BOOL heap_free( void *mem ) +{ + return HeapFree( GetProcessHeap(), 0, mem ); +} + +static inline WCHAR *heap_strdupW( const WCHAR *src ) +{ + WCHAR *dst; + if (!src) return NULL; + if ((dst = heap_alloc( (strlenW( src ) + 1) * sizeof(WCHAR) ))) strcpyW( dst, src ); + return dst; +} + +static inline const char *debugstr_variant( const VARIANT *v ) +{ + if (!v) return "(null)"; + switch (V_VT(v)) + { + case VT_EMPTY: + return "{VT_EMPTY}"; + case VT_NULL: + return "{VT_NULL}"; + case VT_I4: + return wine_dbg_sprintf( "{VT_I4: %d}", V_I4(v) ); + case VT_R8: + return wine_dbg_sprintf( "{VT_R8: %lf}", V_R8(v) ); + case VT_BSTR: + return wine_dbg_sprintf( "{VT_BSTR: %s}", debugstr_w(V_BSTR(v)) ); + case VT_DISPATCH: + return wine_dbg_sprintf( "{VT_DISPATCH: %p}", V_DISPATCH(v) ); + case VT_BOOL: + return wine_dbg_sprintf( "{VT_BOOL: %x}", V_BOOL(v) ); + case VT_UNKNOWN: + return wine_dbg_sprintf( "{VT_UNKNOWN: %p}", V_UNKNOWN(v) ); + case VT_UINT: + return wine_dbg_sprintf( "{VT_UINT: %u}", V_UINT(v) ); + case VT_BSTR|VT_BYREF: + return wine_dbg_sprintf( "{VT_BSTR|VT_BYREF: ptr %p, data %s}", + V_BSTRREF(v), V_BSTRREF(v) ? debugstr_w( *V_BSTRREF(v) ) : NULL ); + default: + return wine_dbg_sprintf( "{vt %d}", V_VT(v) ); + } +} + +static const WCHAR class_processW[] = {'W','i','n','3','2','_','P','r','o','c','e','s','s',0}; +static const WCHAR class_serviceW[] = {'W','i','n','3','2','_','S','e','r','v','i','c','e',0}; +static const WCHAR class_stdregprovW[] = {'S','t','d','R','e','g','P','r','o','v',0}; + +static const WCHAR prop_nameW[] = {'N','a','m','e',0}; + +static const WCHAR method_enumkeyW[] = {'E','n','u','m','K','e','y',0}; +static const WCHAR method_enumvaluesW[] = {'E','n','u','m','V','a','l','u','e','s',0}; +static const WCHAR method_getownerW[] = {'G','e','t','O','w','n','e','r',0}; +static const WCHAR method_getstringvalueW[] = {'G','e','t','S','t','r','i','n','g','V','a','l','u','e',0}; +static const WCHAR method_pauseserviceW[] = {'P','a','u','s','e','S','e','r','v','i','c','e',0}; +static const WCHAR method_resumeserviceW[] = {'R','e','s','u','m','e','S','e','r','v','i','c','e',0}; +static const WCHAR method_startserviceW[] = {'S','t','a','r','t','S','e','r','v','i','c','e',0}; +static const WCHAR method_stopserviceW[] = {'S','t','o','p','S','e','r','v','i','c','e',0}; + +static const WCHAR param_defkeyW[] = {'h','D','e','f','K','e','y',0}; +static const WCHAR param_domainW[] = {'D','o','m','a','i','n',0}; +static const WCHAR param_namesW[] = {'s','N','a','m','e','s',0}; +static const WCHAR param_returnvalueW[] = {'R','e','t','u','r','n','V','a','l','u','e',0}; +static const WCHAR param_subkeynameW[] = {'s','S','u','b','K','e','y','N','a','m','e',0}; +static const WCHAR param_typesW[] = {'T','y','p','e','s',0}; +static const WCHAR param_userW[] = {'U','s','e','r',0}; +static const WCHAR param_valueW[] = {'s','V','a','l','u','e',0}; +static const WCHAR param_valuenameW[] = {'s','V','a','l','u','e','N','a','m','e',0}; diff --git a/reactos/dll/win32/wbemprox/wql.tab.c b/reactos/dll/win32/wbemprox/wql.tab.c new file mode 100644 index 00000000000..42b850b561b --- /dev/null +++ b/reactos/dll/win32/wbemprox/wql.tab.c @@ -0,0 +1,2437 @@ + +/* A Bison parser, made by GNU Bison 2.4.1. */ + +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "2.4.1" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 1 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + +/* Using locations. */ +#define YYLSP_NEEDED 0 + +/* Substitute the variable and function names. */ +#define yyparse wql_parse +#define yylex wql_lex +#define yyerror wql_error +#define yylval wql_lval +#define yychar wql_char +#define yydebug wql_debug +#define yynerrs wql_nerrs + + +/* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ +#line 1 "wql.y" + + +/* + * Copyright 2012 Hans Leidekker for CodeWeavers + * + * 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 + */ + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H + +#include "config.h" +#include + +#include "windef.h" +#include "winbase.h" +#include "objbase.h" +#include "oleauto.h" +#include "wbemcli.h" +#include "wbemprox_private.h" + +#include "wine/list.h" +#include "wine/debug.h" +#include "wine/unicode.h" + +#define YYLEX_PARAM ctx +#define YYPARSE_PARAM ctx +#define YYERROR_DEBUG 1 +#define YYERROR_VERBOSE 1 + +WINE_DEFAULT_DEBUG_CHANNEL(wbemprox); + +struct parser +{ + const WCHAR *cmd; + UINT idx; + UINT len; + HRESULT error; + struct view **view; + struct list *mem; +}; + +struct string +{ + const WCHAR *data; + int len; +}; + +static void *alloc_mem( struct parser *parser, UINT size ) +{ + struct list *mem = heap_alloc( sizeof(struct list) + size ); + list_add_tail( parser->mem, mem ); + return &mem[1]; +} + +static struct property *alloc_property( struct parser *parser, const WCHAR *class, const WCHAR *name ) +{ + struct property *prop = alloc_mem( parser, sizeof(*prop) ); + if (prop) + { + prop->name = name; + prop->class = class; + prop->next = NULL; + } + return prop; +} + +static WCHAR *get_string( struct parser *parser, const struct string *str ) +{ + const WCHAR *p = str->data; + int len = str->len; + WCHAR *ret; + + if ((p[0] == '\"' && p[len - 1] != '\"') || + (p[0] == '\'' && p[len - 1] != '\'')) return NULL; + if ((p[0] == '\"' && p[len - 1] == '\"') || + (p[0] == '\'' && p[len - 1] == '\'')) + { + p++; + len -= 2; + } + if (!(ret = alloc_mem( parser, (len + 1) * sizeof(WCHAR) ))) return NULL; + memcpy( ret, p, len * sizeof(WCHAR) ); + ret[len] = 0; + return ret; +} + +static int get_int( struct parser *parser ) +{ + const WCHAR *p = &parser->cmd[parser->idx]; + int i, ret = 0; + + for (i = 0; i < parser->len; i++) + { + if (p[i] < '0' || p[i] > '9') + { + ERR("should only be numbers here!\n"); + break; + } + ret = (p[i] - '0') + ret * 10; + } + return ret; +} + +static struct expr *expr_complex( struct parser *parser, struct expr *l, UINT op, struct expr *r ) +{ + struct expr *e = alloc_mem( parser, sizeof(*e) ); + if (e) + { + e->type = EXPR_COMPLEX; + e->u.expr.left = l; + e->u.expr.op = op; + e->u.expr.right = r; + } + return e; +} + +static struct expr *expr_unary( struct parser *parser, struct expr *l, UINT op ) +{ + struct expr *e = alloc_mem( parser, sizeof(*e) ); + if (e) + { + e->type = EXPR_UNARY; + e->u.expr.left = l; + e->u.expr.op = op; + e->u.expr.right = NULL; + } + return e; +} + +static struct expr *expr_ival( struct parser *parser, int val ) +{ + struct expr *e = alloc_mem( parser, sizeof *e ); + if (e) + { + e->type = EXPR_IVAL; + e->u.ival = val; + } + return e; +} + +static struct expr *expr_sval( struct parser *parser, const struct string *str ) +{ + struct expr *e = alloc_mem( parser, sizeof *e ); + if (e) + { + e->type = EXPR_SVAL; + e->u.sval = get_string( parser, str ); + if (!e->u.sval) + return NULL; /* e will be freed by query destructor */ + } + return e; +} + +static struct expr *expr_bval( struct parser *parser, int val ) +{ + struct expr *e = alloc_mem( parser, sizeof *e ); + if (e) + { + e->type = EXPR_BVAL; + e->u.ival = val; + } + return e; +} + +static struct expr *expr_propval( struct parser *parser, const struct property *prop ) +{ + struct expr *e = alloc_mem( parser, sizeof *e ); + if (e) + { + e->type = EXPR_PROPVAL; + e->u.propval = prop; + } + return e; +} + +static int wql_error( const char *str ); +static int wql_lex( void *val, struct parser *parser ); + +#define PARSER_BUBBLE_UP_VIEW( parser, result, current_view ) \ + *parser->view = current_view; \ + result = current_view + + + +/* Line 189 of yacc.c */ +#line 274 "wql.tab.c" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + TK_SELECT = 258, + TK_FROM = 259, + TK_STAR = 260, + TK_COMMA = 261, + TK_DOT = 262, + TK_IS = 263, + TK_LP = 264, + TK_RP = 265, + TK_NULL = 266, + TK_FALSE = 267, + TK_TRUE = 268, + TK_INTEGER = 269, + TK_WHERE = 270, + TK_SPACE = 271, + TK_MINUS = 272, + TK_ILLEGAL = 273, + TK_BY = 274, + TK_STRING = 275, + TK_ID = 276, + TK_OR = 277, + TK_AND = 278, + TK_NOT = 279, + TK_LIKE = 280, + TK_GE = 281, + TK_LE = 282, + TK_GT = 283, + TK_LT = 284, + TK_NE = 285, + TK_EQ = 286 + }; +#endif + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +{ + +/* Line 214 of yacc.c */ +#line 196 "wql.y" + + struct string str; + WCHAR *string; + struct property *proplist; + struct view *view; + struct expr *expr; + int integer; + + + +/* Line 214 of yacc.c */ +#line 352 "wql.tab.c" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif + + +/* Copy the second part of user declarations. */ + + +/* Line 264 of yacc.c */ +#line 364 "wql.tab.c" + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int yyi) +#else +static int +YYID (yyi) + int yyi; +#endif +{ + return yyi; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) + +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 9 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 67 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 32 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 10 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 35 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 65 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 286 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31 +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const yytype_uint8 yyprhs[] = +{ + 0, 0, 3, 7, 12, 19, 21, 25, 27, 31, + 33, 35, 37, 41, 45, 49, 53, 57, 61, 65, + 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, + 110, 112, 114, 116, 118, 120 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int8 yyrhs[] = +{ + 33, 0, -1, 3, 4, 36, -1, 3, 34, 4, + 36, -1, 3, 34, 4, 36, 15, 38, -1, 35, + -1, 35, 6, 34, -1, 5, -1, 36, 7, 36, + -1, 36, -1, 21, -1, 14, -1, 9, 38, 10, + -1, 38, 23, 38, -1, 38, 22, 38, -1, 40, + 31, 41, -1, 40, 28, 41, -1, 40, 29, 41, + -1, 40, 27, 41, -1, 40, 26, 41, -1, 40, + 30, 41, -1, 41, 31, 40, -1, 41, 28, 40, + -1, 41, 29, 40, -1, 41, 27, 40, -1, 41, + 26, 40, -1, 41, 30, 40, -1, 40, 25, 39, + -1, 40, 8, 11, -1, 40, 8, 24, 11, -1, + 20, -1, 35, -1, 37, -1, 20, -1, 13, -1, + 12, -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 223, 223, 235, 247, 262, 263, 267, 274, 280, + 289, 298, 305, 311, 317, 323, 329, 335, 341, 347, + 353, 359, 365, 371, 377, 383, 389, 395, 401, 407, + 416, 425, 434, 440, 446, 452 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "TK_SELECT", "TK_FROM", "TK_STAR", + "TK_COMMA", "TK_DOT", "TK_IS", "TK_LP", "TK_RP", "TK_NULL", "TK_FALSE", + "TK_TRUE", "TK_INTEGER", "TK_WHERE", "TK_SPACE", "TK_MINUS", + "TK_ILLEGAL", "TK_BY", "TK_STRING", "TK_ID", "TK_OR", "TK_AND", "TK_NOT", + "TK_LIKE", "TK_GE", "TK_LE", "TK_GT", "TK_LT", "TK_NE", "TK_EQ", + "$accept", "select", "proplist", "prop", "id", "number", "expr", + "string_val", "prop_val", "const_val", 0 +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 32, 33, 33, 33, 34, 34, 34, 35, 35, + 36, 37, 38, 38, 38, 38, 38, 38, 38, 38, + 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, + 39, 40, 41, 41, 41, 41 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 3, 4, 6, 1, 3, 1, 3, 1, + 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, + 1, 1, 1, 1, 1, 1 +}; + +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 0, 0, 0, 0, 7, 10, 0, 5, 9, 1, + 2, 0, 0, 0, 3, 6, 8, 0, 0, 35, + 34, 11, 33, 31, 32, 4, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 12, 14, 13, 28, 0, + 30, 27, 19, 18, 16, 17, 20, 15, 25, 24, + 22, 23, 26, 21, 29 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = +{ + -1, 2, 6, 23, 8, 24, 25, 51, 26, 27 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -20 +static const yytype_int8 yypact[] = +{ + 2, 3, 6, -10, -20, -20, 24, 31, 33, -20, + -20, -10, 4, -10, 26, -20, -20, 18, 18, -20, + -20, -20, -20, -20, -20, -19, -8, 20, -9, 18, + 18, 5, 23, 22, 22, 22, 22, 22, 22, -10, + -10, -10, -10, -10, -10, -20, 41, -20, -20, 54, + -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, + -20, -20, -20, -20, -20 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int8 yypgoto[] = +{ + -20, -20, 55, 14, -1, -20, 15, -20, 13, 25 +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -1 +static const yytype_uint8 yytable[] = +{ + 31, 45, 10, 29, 30, 1, 9, 3, 4, 4, + 14, 5, 16, 29, 30, 7, 48, 32, 33, 34, + 35, 36, 37, 38, 5, 5, 7, 18, 11, 49, + 19, 20, 21, 28, 19, 20, 21, 12, 22, 5, + 13, 17, 22, 50, 46, 47, 39, 40, 41, 42, + 43, 44, 58, 59, 60, 61, 62, 63, 52, 53, + 54, 55, 56, 57, 30, 64, 0, 15 +}; + +static const yytype_int8 yycheck[] = +{ + 8, 10, 3, 22, 23, 3, 0, 4, 5, 5, + 11, 21, 13, 22, 23, 1, 11, 25, 26, 27, + 28, 29, 30, 31, 21, 21, 12, 9, 4, 24, + 12, 13, 14, 18, 12, 13, 14, 6, 20, 21, + 7, 15, 20, 20, 29, 30, 26, 27, 28, 29, + 30, 31, 39, 40, 41, 42, 43, 44, 33, 34, + 35, 36, 37, 38, 23, 11, -1, 12 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 3, 33, 4, 5, 21, 34, 35, 36, 0, + 36, 4, 6, 7, 36, 34, 36, 15, 9, 12, + 13, 14, 20, 35, 37, 38, 40, 41, 38, 22, + 23, 8, 25, 26, 27, 28, 29, 30, 31, 26, + 27, 28, 29, 30, 31, 10, 38, 38, 11, 24, + 20, 39, 41, 41, 41, 41, 41, 41, 40, 40, + 40, 40, 40, 40, 11 +}; + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ + +#define YYFAIL goto yyerrlab + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (YYID (0)) + + +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (YYID (0)) +#endif + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#ifdef YYLEX_PARAM +# define YYLEX yylex (&yylval, YYLEX_PARAM) +#else +# define YYLEX yylex (&yylval) +#endif + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (YYID (0)) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +#else +static void +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (YYID (0)) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_reduce_print (YYSTYPE *yyvsp, int yyrule) +#else +static void +yy_reduce_print (yyvsp, yyrule) + YYSTYPE *yyvsp; + int yyrule; +#endif +{ + int yynrhs = yyr2[yyrule]; + int yyi; + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyvsp, Rule); \ +} while (YYID (0)) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static YYSIZE_T +yystrlen (const char *yystr) +#else +static YYSIZE_T +yystrlen (yystr) + const char *yystr; +#endif +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static char * +yystpcpy (char *yydest, const char *yysrc) +#else +static char * +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +#endif +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) +{ + int yyn = yypact[yystate]; + + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; + else + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; + } +} +#endif /* YYERROR_VERBOSE */ + + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +#else +static void +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; +#endif +{ + YYUSE (yyvaluep); + + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + switch (yytype) + { + + default: + break; + } +} + +/* Prevent warnings from -Wmissing-prototypes. */ +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (void); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ + + + + + +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ + +#ifdef YYPARSE_PARAM +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) +#else +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif +#else /* ! YYPARSE_PARAM */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void) +#else +int +yyparse () + +#endif +#endif +{ +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; + + /* Number of syntax errors so far. */ + int yynerrs; + + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + yyssp = yyss; + yyvsp = yyvs; + + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + *++yyvsp = yylval; + + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 2: + +/* Line 1455 of yacc.c */ +#line 224 "wql.y" + { + HRESULT hr; + struct parser *parser = ctx; + struct view *view; + + hr = create_view( NULL, (yyvsp[(3) - (3)].string), NULL, &view ); + if (hr != S_OK) + YYABORT; + + PARSER_BUBBLE_UP_VIEW( parser, (yyval.view), view ); + ;} + break; + + case 3: + +/* Line 1455 of yacc.c */ +#line 236 "wql.y" + { + HRESULT hr; + struct parser *parser = ctx; + struct view *view; + + hr = create_view( (yyvsp[(2) - (4)].proplist), (yyvsp[(4) - (4)].string), NULL, &view ); + if (hr != S_OK) + YYABORT; + + PARSER_BUBBLE_UP_VIEW( parser, (yyval.view), view ); + ;} + break; + + case 4: + +/* Line 1455 of yacc.c */ +#line 248 "wql.y" + { + HRESULT hr; + struct parser *parser = ctx; + struct view *view; + + hr = create_view( (yyvsp[(2) - (6)].proplist), (yyvsp[(4) - (6)].string), (yyvsp[(6) - (6)].expr), &view ); + if (hr != S_OK) + YYABORT; + + PARSER_BUBBLE_UP_VIEW( parser, (yyval.view), view ); + ;} + break; + + case 6: + +/* Line 1455 of yacc.c */ +#line 264 "wql.y" + { + (yyvsp[(1) - (3)].proplist)->next = (yyvsp[(3) - (3)].proplist); + ;} + break; + + case 7: + +/* Line 1455 of yacc.c */ +#line 268 "wql.y" + { + (yyval.proplist) = NULL; + ;} + break; + + case 8: + +/* Line 1455 of yacc.c */ +#line 275 "wql.y" + { + (yyval.proplist) = alloc_property( ctx, (yyvsp[(1) - (3)].string), (yyvsp[(3) - (3)].string) ); + if (!(yyval.proplist)) + YYABORT; + ;} + break; + + case 9: + +/* Line 1455 of yacc.c */ +#line 281 "wql.y" + { + (yyval.proplist) = alloc_property( ctx, NULL, (yyvsp[(1) - (1)].string) ); + if (!(yyval.proplist)) + YYABORT; + ;} + break; + + case 10: + +/* Line 1455 of yacc.c */ +#line 290 "wql.y" + { + (yyval.string) = get_string( ctx, &(yyvsp[(1) - (1)].str) ); + if (!(yyval.string)) + YYABORT; + ;} + break; + + case 11: + +/* Line 1455 of yacc.c */ +#line 299 "wql.y" + { + (yyval.integer) = get_int( ctx ); + ;} + break; + + case 12: + +/* Line 1455 of yacc.c */ +#line 306 "wql.y" + { + (yyval.expr) = (yyvsp[(2) - (3)].expr); + if (!(yyval.expr)) + YYABORT; + ;} + break; + + case 13: + +/* Line 1455 of yacc.c */ +#line 312 "wql.y" + { + (yyval.expr) = expr_complex( ctx, (yyvsp[(1) - (3)].expr), OP_AND, (yyvsp[(3) - (3)].expr) ); + if (!(yyval.expr)) + YYABORT; + ;} + break; + + case 14: + +/* Line 1455 of yacc.c */ +#line 318 "wql.y" + { + (yyval.expr) = expr_complex( ctx, (yyvsp[(1) - (3)].expr), OP_OR, (yyvsp[(3) - (3)].expr) ); + if (!(yyval.expr)) + YYABORT; + ;} + break; + + case 15: + +/* Line 1455 of yacc.c */ +#line 324 "wql.y" + { + (yyval.expr) = expr_complex( ctx, (yyvsp[(1) - (3)].expr), OP_EQ, (yyvsp[(3) - (3)].expr) ); + if (!(yyval.expr)) + YYABORT; + ;} + break; + + case 16: + +/* Line 1455 of yacc.c */ +#line 330 "wql.y" + { + (yyval.expr) = expr_complex( ctx, (yyvsp[(1) - (3)].expr), OP_GT, (yyvsp[(3) - (3)].expr) ); + if (!(yyval.expr)) + YYABORT; + ;} + break; + + case 17: + +/* Line 1455 of yacc.c */ +#line 336 "wql.y" + { + (yyval.expr) = expr_complex( ctx, (yyvsp[(1) - (3)].expr), OP_LT, (yyvsp[(3) - (3)].expr) ); + if (!(yyval.expr)) + YYABORT; + ;} + break; + + case 18: + +/* Line 1455 of yacc.c */ +#line 342 "wql.y" + { + (yyval.expr) = expr_complex( ctx, (yyvsp[(1) - (3)].expr), OP_LE, (yyvsp[(3) - (3)].expr) ); + if (!(yyval.expr)) + YYABORT; + ;} + break; + + case 19: + +/* Line 1455 of yacc.c */ +#line 348 "wql.y" + { + (yyval.expr) = expr_complex( ctx, (yyvsp[(1) - (3)].expr), OP_GE, (yyvsp[(3) - (3)].expr) ); + if (!(yyval.expr)) + YYABORT; + ;} + break; + + case 20: + +/* Line 1455 of yacc.c */ +#line 354 "wql.y" + { + (yyval.expr) = expr_complex( ctx, (yyvsp[(1) - (3)].expr), OP_NE, (yyvsp[(3) - (3)].expr) ); + if (!(yyval.expr)) + YYABORT; + ;} + break; + + case 21: + +/* Line 1455 of yacc.c */ +#line 360 "wql.y" + { + (yyval.expr) = expr_complex( ctx, (yyvsp[(1) - (3)].expr), OP_EQ, (yyvsp[(3) - (3)].expr) ); + if (!(yyval.expr)) + YYABORT; + ;} + break; + + case 22: + +/* Line 1455 of yacc.c */ +#line 366 "wql.y" + { + (yyval.expr) = expr_complex( ctx, (yyvsp[(1) - (3)].expr), OP_GT, (yyvsp[(3) - (3)].expr) ); + if (!(yyval.expr)) + YYABORT; + ;} + break; + + case 23: + +/* Line 1455 of yacc.c */ +#line 372 "wql.y" + { + (yyval.expr) = expr_complex( ctx, (yyvsp[(1) - (3)].expr), OP_LT, (yyvsp[(3) - (3)].expr) ); + if (!(yyval.expr)) + YYABORT; + ;} + break; + + case 24: + +/* Line 1455 of yacc.c */ +#line 378 "wql.y" + { + (yyval.expr) = expr_complex( ctx, (yyvsp[(1) - (3)].expr), OP_LE, (yyvsp[(3) - (3)].expr) ); + if (!(yyval.expr)) + YYABORT; + ;} + break; + + case 25: + +/* Line 1455 of yacc.c */ +#line 384 "wql.y" + { + (yyval.expr) = expr_complex( ctx, (yyvsp[(1) - (3)].expr), OP_GE, (yyvsp[(3) - (3)].expr) ); + if (!(yyval.expr)) + YYABORT; + ;} + break; + + case 26: + +/* Line 1455 of yacc.c */ +#line 390 "wql.y" + { + (yyval.expr) = expr_complex( ctx, (yyvsp[(1) - (3)].expr), OP_NE, (yyvsp[(3) - (3)].expr) ); + if (!(yyval.expr)) + YYABORT; + ;} + break; + + case 27: + +/* Line 1455 of yacc.c */ +#line 396 "wql.y" + { + (yyval.expr) = expr_complex( ctx, (yyvsp[(1) - (3)].expr), OP_LIKE, (yyvsp[(3) - (3)].expr) ); + if (!(yyval.expr)) + YYABORT; + ;} + break; + + case 28: + +/* Line 1455 of yacc.c */ +#line 402 "wql.y" + { + (yyval.expr) = expr_unary( ctx, (yyvsp[(1) - (3)].expr), OP_ISNULL ); + if (!(yyval.expr)) + YYABORT; + ;} + break; + + case 29: + +/* Line 1455 of yacc.c */ +#line 408 "wql.y" + { + (yyval.expr) = expr_unary( ctx, (yyvsp[(1) - (4)].expr), OP_NOTNULL ); + if (!(yyval.expr)) + YYABORT; + ;} + break; + + case 30: + +/* Line 1455 of yacc.c */ +#line 417 "wql.y" + { + (yyval.expr) = expr_sval( ctx, &(yyvsp[(1) - (1)].str) ); + if (!(yyval.expr)) + YYABORT; + ;} + break; + + case 31: + +/* Line 1455 of yacc.c */ +#line 426 "wql.y" + { + (yyval.expr) = expr_propval( ctx, (yyvsp[(1) - (1)].proplist) ); + if (!(yyval.expr)) + YYABORT; + ;} + break; + + case 32: + +/* Line 1455 of yacc.c */ +#line 435 "wql.y" + { + (yyval.expr) = expr_ival( ctx, (yyvsp[(1) - (1)].integer) ); + if (!(yyval.expr)) + YYABORT; + ;} + break; + + case 33: + +/* Line 1455 of yacc.c */ +#line 441 "wql.y" + { + (yyval.expr) = expr_sval( ctx, &(yyvsp[(1) - (1)].str) ); + if (!(yyval.expr)) + YYABORT; + ;} + break; + + case 34: + +/* Line 1455 of yacc.c */ +#line 447 "wql.y" + { + (yyval.expr) = expr_bval( ctx, -1 ); + if (!(yyval.expr)) + YYABORT; + ;} + break; + + case 35: + +/* Line 1455 of yacc.c */ +#line 453 "wql.y" + { + (yyval.expr) = expr_bval( ctx, 0 ); + if (!(yyval.expr)) + YYABORT; + ;} + break; + + + +/* Line 1455 of yacc.c */ +#line 1980 "wql.tab.c" + default: break; + } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else + { + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (yymsg); + } + else + { + yyerror (YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } + } +#endif + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + *++yyvsp = yylval; + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined(yyoverflow) || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); +} + + + +/* Line 1675 of yacc.c */ +#line 460 "wql.y" + + +HRESULT parse_query( const WCHAR *str, struct view **view, struct list *mem ) +{ + struct parser parser; + int ret; + + *view = NULL; + + parser.cmd = str; + parser.idx = 0; + parser.len = 0; + parser.error = WBEM_E_INVALID_QUERY; + parser.view = view; + parser.mem = mem; + + ret = wql_parse( &parser ); + TRACE("wql_parse returned %d\n", ret); + if (ret) + { + if (*parser.view) + { + destroy_view( *parser.view ); + *parser.view = NULL; + } + return parser.error; + } + return S_OK; +} + +static const char id_char[] = +{ + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +}; + +struct keyword +{ + const WCHAR *name; + unsigned int len; + int type; +}; + +#define MAX_TOKEN_LEN 6 + +static const WCHAR andW[] = {'A','N','D'}; +static const WCHAR byW[] = {'B','Y'}; +static const WCHAR falseW[] = {'F','A','L','S','E'}; +static const WCHAR fromW[] = {'F','R','O','M'}; +static const WCHAR isW[] = {'I','S'}; +static const WCHAR likeW[] = {'L','I','K','E'}; +static const WCHAR notW[] = {'N','O','T'}; +static const WCHAR nullW[] = {'N','U','L','L'}; +static const WCHAR orW[] = {'O','R'}; +static const WCHAR selectW[] = {'S','E','L','E','C','T'}; +static const WCHAR trueW[] = {'T','R','U','E'}; +static const WCHAR whereW[] = {'W','H','E','R','E'}; + +static const struct keyword keyword_table[] = +{ + { andW, SIZEOF(andW), TK_AND }, + { byW, SIZEOF(byW), TK_BY }, + { falseW, SIZEOF(falseW), TK_FALSE }, + { fromW, SIZEOF(fromW), TK_FROM }, + { isW, SIZEOF(isW), TK_IS }, + { likeW, SIZEOF(likeW), TK_LIKE }, + { notW, SIZEOF(notW), TK_NOT }, + { nullW, SIZEOF(nullW), TK_NULL }, + { orW, SIZEOF(orW), TK_OR }, + { selectW, SIZEOF(selectW), TK_SELECT }, + { trueW, SIZEOF(trueW), TK_TRUE }, + { whereW, SIZEOF(whereW), TK_WHERE } +}; + +static int cmp_keyword( const void *arg1, const void *arg2 ) +{ + const struct keyword *key1 = arg1, *key2 = arg2; + int len = min( key1->len, key2->len ); + int ret; + + if ((ret = memicmpW( key1->name, key2->name, len ))) return ret; + if (key1->len < key2->len) return -1; + else if (key1->len > key2->len) return 1; + return 0; +} + +static int keyword_type( const WCHAR *str, unsigned int len ) +{ + struct keyword key, *ret; + + if (len > MAX_TOKEN_LEN) return TK_ID; + + key.name = str; + key.len = len; + key.type = 0; + ret = bsearch( &key, keyword_table, SIZEOF(keyword_table), sizeof(struct keyword), cmp_keyword ); + if (ret) return ret->type; + return TK_ID; +} + +static int get_token( const WCHAR *s, int *token ) +{ + int i; + + switch (*s) + { + case ' ': + case '\t': + case '\n': + for (i = 1; isspaceW( s[i] ); i++) {} + *token = TK_SPACE; + return i; + case '-': + if (!s[1]) return -1; + *token = TK_MINUS; + return 1; + case '(': + *token = TK_LP; + return 1; + case ')': + *token = TK_RP; + return 1; + case '*': + *token = TK_STAR; + return 1; + case '=': + *token = TK_EQ; + return 1; + case '<': + if (s[1] == '=' ) + { + *token = TK_LE; + return 2; + } + else if (s[1] == '>') + { + *token = TK_NE; + return 2; + } + else + { + *token = TK_LT; + return 1; + } + case '>': + if (s[1] == '=') + { + *token = TK_GE; + return 2; + } + else + { + *token = TK_GT; + return 1; + } + case '!': + if (s[1] != '=') + { + *token = TK_ILLEGAL; + return 2; + } + else + { + *token = TK_NE; + return 2; + } + case ',': + *token = TK_COMMA; + return 1; + case '\"': + case '\'': + { + for (i = 1; s[i]; i++) + { + if (s[i] == s[0]) break; + } + if (s[i]) i++; + *token = TK_STRING; + return i; + } + case '.': + if (!isdigitW( s[1] )) + { + *token = TK_DOT; + return 1; + } + /* fall through */ + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + *token = TK_INTEGER; + for (i = 1; isdigitW( s[i] ); i++) {} + return i; + default: + if (!id_char[*s]) break; + + for (i = 1; id_char[s[i]]; i++) {} + *token = keyword_type( s, i ); + return i; + } + *token = TK_ILLEGAL; + return 1; +} + +static int wql_lex( void *p, struct parser *parser ) +{ + struct string *str = p; + int token = -1; + do + { + parser->idx += parser->len; + if (!parser->cmd[parser->idx]) return 0; + parser->len = get_token( &parser->cmd[parser->idx], &token ); + if (!parser->len) break; + + str->data = &parser->cmd[parser->idx]; + str->len = parser->len; + } while (token == TK_SPACE); + return token; +} + +static int wql_error( const char *str ) +{ + ERR("%s\n", str); + return 0; +} + diff --git a/reactos/dll/win32/wbemprox/wql.y b/reactos/dll/win32/wbemprox/wql.y new file mode 100644 index 00000000000..8e347c22e5b --- /dev/null +++ b/reactos/dll/win32/wbemprox/wql.y @@ -0,0 +1,698 @@ +%{ + +/* + * Copyright 2012 Hans Leidekker for CodeWeavers + * + * 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 + */ + +#include "config.h" +#include + +#include "windef.h" +#include "winbase.h" +#include "wbemcli.h" +#include "wbemprox_private.h" + +#include "wine/list.h" +#include "wine/debug.h" +#include "wine/unicode.h" + +#define YYLEX_PARAM ctx +#define YYPARSE_PARAM ctx +#define YYERROR_DEBUG 1 +#define YYERROR_VERBOSE 1 + +WINE_DEFAULT_DEBUG_CHANNEL(wbemprox); + +struct parser +{ + const WCHAR *cmd; + UINT idx; + UINT len; + HRESULT error; + struct view **view; + struct list *mem; +}; + +struct string +{ + const WCHAR *data; + int len; +}; + +static void *alloc_mem( struct parser *parser, UINT size ) +{ + struct list *mem = heap_alloc( sizeof(struct list) + size ); + list_add_tail( parser->mem, mem ); + return &mem[1]; +} + +static struct property *alloc_property( struct parser *parser, const WCHAR *class, const WCHAR *name ) +{ + struct property *prop = alloc_mem( parser, sizeof(*prop) ); + if (prop) + { + prop->name = name; + prop->class = class; + prop->next = NULL; + } + return prop; +} + +static WCHAR *get_string( struct parser *parser, const struct string *str ) +{ + const WCHAR *p = str->data; + int len = str->len; + WCHAR *ret; + + if ((p[0] == '\"' && p[len - 1] != '\"') || + (p[0] == '\'' && p[len - 1] != '\'')) return NULL; + if ((p[0] == '\"' && p[len - 1] == '\"') || + (p[0] == '\'' && p[len - 1] == '\'')) + { + p++; + len -= 2; + } + if (!(ret = alloc_mem( parser, (len + 1) * sizeof(WCHAR) ))) return NULL; + memcpy( ret, p, len * sizeof(WCHAR) ); + ret[len] = 0; + return ret; +} + +static int get_int( struct parser *parser ) +{ + const WCHAR *p = &parser->cmd[parser->idx]; + int i, ret = 0; + + for (i = 0; i < parser->len; i++) + { + if (p[i] < '0' || p[i] > '9') + { + ERR("should only be numbers here!\n"); + break; + } + ret = (p[i] - '0') + ret * 10; + } + return ret; +} + +static struct expr *expr_complex( struct parser *parser, struct expr *l, UINT op, struct expr *r ) +{ + struct expr *e = alloc_mem( parser, sizeof(*e) ); + if (e) + { + e->type = EXPR_COMPLEX; + e->u.expr.left = l; + e->u.expr.op = op; + e->u.expr.right = r; + } + return e; +} + +static struct expr *expr_unary( struct parser *parser, struct expr *l, UINT op ) +{ + struct expr *e = alloc_mem( parser, sizeof(*e) ); + if (e) + { + e->type = EXPR_UNARY; + e->u.expr.left = l; + e->u.expr.op = op; + e->u.expr.right = NULL; + } + return e; +} + +static struct expr *expr_ival( struct parser *parser, int val ) +{ + struct expr *e = alloc_mem( parser, sizeof *e ); + if (e) + { + e->type = EXPR_IVAL; + e->u.ival = val; + } + return e; +} + +static struct expr *expr_sval( struct parser *parser, const struct string *str ) +{ + struct expr *e = alloc_mem( parser, sizeof *e ); + if (e) + { + e->type = EXPR_SVAL; + e->u.sval = get_string( parser, str ); + if (!e->u.sval) + return NULL; /* e will be freed by query destructor */ + } + return e; +} + +static struct expr *expr_bval( struct parser *parser, int val ) +{ + struct expr *e = alloc_mem( parser, sizeof *e ); + if (e) + { + e->type = EXPR_BVAL; + e->u.ival = val; + } + return e; +} + +static struct expr *expr_propval( struct parser *parser, const struct property *prop ) +{ + struct expr *e = alloc_mem( parser, sizeof *e ); + if (e) + { + e->type = EXPR_PROPVAL; + e->u.propval = prop; + } + return e; +} + +static int wql_error( const char *str ); +static int wql_lex( void *val, struct parser *parser ); + +#define PARSER_BUBBLE_UP_VIEW( parser, result, current_view ) \ + *parser->view = current_view; \ + result = current_view + +%} + +%pure-parser + +%union +{ + struct string str; + WCHAR *string; + struct property *proplist; + struct view *view; + struct expr *expr; + int integer; +} + +%token TK_SELECT TK_FROM TK_STAR TK_COMMA TK_DOT TK_IS TK_LP TK_RP TK_NULL TK_FALSE TK_TRUE +%token TK_INTEGER TK_WHERE TK_SPACE TK_MINUS TK_ILLEGAL TK_BY +%token TK_STRING TK_ID + +%type id +%type prop proplist +%type select +%type expr prop_val const_val string_val +%type number + +%left TK_OR +%left TK_AND +%left TK_NOT +%left TK_EQ TK_NE TK_LT TK_GT TK_LE TK_GE TK_LIKE + +%% + +select: + TK_SELECT TK_FROM id + { + HRESULT hr; + struct parser *parser = ctx; + struct view *view; + + hr = create_view( NULL, $3, NULL, &view ); + if (hr != S_OK) + YYABORT; + + PARSER_BUBBLE_UP_VIEW( parser, $$, view ); + } + | TK_SELECT proplist TK_FROM id + { + HRESULT hr; + struct parser *parser = ctx; + struct view *view; + + hr = create_view( $2, $4, NULL, &view ); + if (hr != S_OK) + YYABORT; + + PARSER_BUBBLE_UP_VIEW( parser, $$, view ); + } + | TK_SELECT proplist TK_FROM id TK_WHERE expr + { + HRESULT hr; + struct parser *parser = ctx; + struct view *view; + + hr = create_view( $2, $4, $6, &view ); + if (hr != S_OK) + YYABORT; + + PARSER_BUBBLE_UP_VIEW( parser, $$, view ); + } + ; + +proplist: + prop + | prop TK_COMMA proplist + { + $1->next = $3; + } + | TK_STAR + { + $$ = NULL; + } + ; + +prop: + id TK_DOT id + { + $$ = alloc_property( ctx, $1, $3 ); + if (!$$) + YYABORT; + } + | id + { + $$ = alloc_property( ctx, NULL, $1 ); + if (!$$) + YYABORT; + } + ; + +id: + TK_ID + { + $$ = get_string( ctx, &$1 ); + if (!$$) + YYABORT; + } + ; + +number: + TK_INTEGER + { + $$ = get_int( ctx ); + } + ; + +expr: + TK_LP expr TK_RP + { + $$ = $2; + if (!$$) + YYABORT; + } + | expr TK_AND expr + { + $$ = expr_complex( ctx, $1, OP_AND, $3 ); + if (!$$) + YYABORT; + } + | expr TK_OR expr + { + $$ = expr_complex( ctx, $1, OP_OR, $3 ); + if (!$$) + YYABORT; + } + | prop_val TK_EQ const_val + { + $$ = expr_complex( ctx, $1, OP_EQ, $3 ); + if (!$$) + YYABORT; + } + | prop_val TK_GT const_val + { + $$ = expr_complex( ctx, $1, OP_GT, $3 ); + if (!$$) + YYABORT; + } + | prop_val TK_LT const_val + { + $$ = expr_complex( ctx, $1, OP_LT, $3 ); + if (!$$) + YYABORT; + } + | prop_val TK_LE const_val + { + $$ = expr_complex( ctx, $1, OP_LE, $3 ); + if (!$$) + YYABORT; + } + | prop_val TK_GE const_val + { + $$ = expr_complex( ctx, $1, OP_GE, $3 ); + if (!$$) + YYABORT; + } + | prop_val TK_NE const_val + { + $$ = expr_complex( ctx, $1, OP_NE, $3 ); + if (!$$) + YYABORT; + } + | const_val TK_EQ prop_val + { + $$ = expr_complex( ctx, $1, OP_EQ, $3 ); + if (!$$) + YYABORT; + } + | const_val TK_GT prop_val + { + $$ = expr_complex( ctx, $1, OP_GT, $3 ); + if (!$$) + YYABORT; + } + | const_val TK_LT prop_val + { + $$ = expr_complex( ctx, $1, OP_LT, $3 ); + if (!$$) + YYABORT; + } + | const_val TK_LE prop_val + { + $$ = expr_complex( ctx, $1, OP_LE, $3 ); + if (!$$) + YYABORT; + } + | const_val TK_GE prop_val + { + $$ = expr_complex( ctx, $1, OP_GE, $3 ); + if (!$$) + YYABORT; + } + | const_val TK_NE prop_val + { + $$ = expr_complex( ctx, $1, OP_NE, $3 ); + if (!$$) + YYABORT; + } + | prop_val TK_LIKE string_val + { + $$ = expr_complex( ctx, $1, OP_LIKE, $3 ); + if (!$$) + YYABORT; + } + | prop_val TK_IS TK_NULL + { + $$ = expr_unary( ctx, $1, OP_ISNULL ); + if (!$$) + YYABORT; + } + | prop_val TK_IS TK_NOT TK_NULL + { + $$ = expr_unary( ctx, $1, OP_NOTNULL ); + if (!$$) + YYABORT; + } + ; + +string_val: + TK_STRING + { + $$ = expr_sval( ctx, &$1 ); + if (!$$) + YYABORT; + } + ; + +prop_val: + prop + { + $$ = expr_propval( ctx, $1 ); + if (!$$) + YYABORT; + } + ; + +const_val: + number + { + $$ = expr_ival( ctx, $1 ); + if (!$$) + YYABORT; + } + | TK_STRING + { + $$ = expr_sval( ctx, &$1 ); + if (!$$) + YYABORT; + } + | TK_TRUE + { + $$ = expr_bval( ctx, -1 ); + if (!$$) + YYABORT; + } + | TK_FALSE + { + $$ = expr_bval( ctx, 0 ); + if (!$$) + YYABORT; + } + ; + +%% + +HRESULT parse_query( const WCHAR *str, struct view **view, struct list *mem ) +{ + struct parser parser; + int ret; + + *view = NULL; + + parser.cmd = str; + parser.idx = 0; + parser.len = 0; + parser.error = WBEM_E_INVALID_QUERY; + parser.view = view; + parser.mem = mem; + + ret = wql_parse( &parser ); + TRACE("wql_parse returned %d\n", ret); + if (ret) + { + if (*parser.view) + { + destroy_view( *parser.view ); + *parser.view = NULL; + } + return parser.error; + } + return S_OK; +} + +static const char id_char[] = +{ + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +}; + +struct keyword +{ + const WCHAR *name; + unsigned int len; + int type; +}; + +#define MAX_TOKEN_LEN 6 + +static const WCHAR andW[] = {'A','N','D'}; +static const WCHAR byW[] = {'B','Y'}; +static const WCHAR falseW[] = {'F','A','L','S','E'}; +static const WCHAR fromW[] = {'F','R','O','M'}; +static const WCHAR isW[] = {'I','S'}; +static const WCHAR likeW[] = {'L','I','K','E'}; +static const WCHAR notW[] = {'N','O','T'}; +static const WCHAR nullW[] = {'N','U','L','L'}; +static const WCHAR orW[] = {'O','R'}; +static const WCHAR selectW[] = {'S','E','L','E','C','T'}; +static const WCHAR trueW[] = {'T','R','U','E'}; +static const WCHAR whereW[] = {'W','H','E','R','E'}; + +static const struct keyword keyword_table[] = +{ + { andW, SIZEOF(andW), TK_AND }, + { byW, SIZEOF(byW), TK_BY }, + { falseW, SIZEOF(falseW), TK_FALSE }, + { fromW, SIZEOF(fromW), TK_FROM }, + { isW, SIZEOF(isW), TK_IS }, + { likeW, SIZEOF(likeW), TK_LIKE }, + { notW, SIZEOF(notW), TK_NOT }, + { nullW, SIZEOF(nullW), TK_NULL }, + { orW, SIZEOF(orW), TK_OR }, + { selectW, SIZEOF(selectW), TK_SELECT }, + { trueW, SIZEOF(trueW), TK_TRUE }, + { whereW, SIZEOF(whereW), TK_WHERE } +}; + +static int cmp_keyword( const void *arg1, const void *arg2 ) +{ + const struct keyword *key1 = arg1, *key2 = arg2; + int len = min( key1->len, key2->len ); + int ret; + + if ((ret = memicmpW( key1->name, key2->name, len ))) return ret; + if (key1->len < key2->len) return -1; + else if (key1->len > key2->len) return 1; + return 0; +} + +static int keyword_type( const WCHAR *str, unsigned int len ) +{ + struct keyword key, *ret; + + if (len > MAX_TOKEN_LEN) return TK_ID; + + key.name = str; + key.len = len; + key.type = 0; + ret = bsearch( &key, keyword_table, SIZEOF(keyword_table), sizeof(struct keyword), cmp_keyword ); + if (ret) return ret->type; + return TK_ID; +} + +static int get_token( const WCHAR *s, int *token ) +{ + int i; + + switch (*s) + { + case ' ': + case '\t': + case '\n': + for (i = 1; isspaceW( s[i] ); i++) {} + *token = TK_SPACE; + return i; + case '-': + if (!s[1]) return -1; + *token = TK_MINUS; + return 1; + case '(': + *token = TK_LP; + return 1; + case ')': + *token = TK_RP; + return 1; + case '*': + *token = TK_STAR; + return 1; + case '=': + *token = TK_EQ; + return 1; + case '<': + if (s[1] == '=' ) + { + *token = TK_LE; + return 2; + } + else if (s[1] == '>') + { + *token = TK_NE; + return 2; + } + else + { + *token = TK_LT; + return 1; + } + case '>': + if (s[1] == '=') + { + *token = TK_GE; + return 2; + } + else + { + *token = TK_GT; + return 1; + } + case '!': + if (s[1] != '=') + { + *token = TK_ILLEGAL; + return 2; + } + else + { + *token = TK_NE; + return 2; + } + case ',': + *token = TK_COMMA; + return 1; + case '\"': + case '\'': + { + for (i = 1; s[i]; i++) + { + if (s[i] == s[0]) break; + } + if (s[i]) i++; + *token = TK_STRING; + return i; + } + case '.': + if (!isdigitW( s[1] )) + { + *token = TK_DOT; + return 1; + } + /* fall through */ + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + *token = TK_INTEGER; + for (i = 1; isdigitW( s[i] ); i++) {} + return i; + default: + if (!id_char[*s]) break; + + for (i = 1; id_char[s[i]]; i++) {} + *token = keyword_type( s, i ); + return i; + } + *token = TK_ILLEGAL; + return 1; +} + +static int wql_lex( void *p, struct parser *parser ) +{ + struct string *str = p; + int token = -1; + do + { + parser->idx += parser->len; + if (!parser->cmd[parser->idx]) return 0; + parser->len = get_token( &parser->cmd[parser->idx], &token ); + if (!parser->len) break; + + str->data = &parser->cmd[parser->idx]; + str->len = parser->len; + } while (token == TK_SPACE); + return token; +} + +static int wql_error( const char *str ) +{ + ERR("%s\n", str); + return 0; +} diff --git a/reactos/include/psdk/CMakeLists.txt b/reactos/include/psdk/CMakeLists.txt index c62b3245ee1..af6208daa02 100644 --- a/reactos/include/psdk/CMakeLists.txt +++ b/reactos/include/psdk/CMakeLists.txt @@ -108,6 +108,8 @@ list(APPEND SOURCE urlmon.idl vmr9.idl # vmrender.idl + wbemcli.idl + wbemprov.idl wia_lh.idl wia_xp.idl wincodec.idl @@ -120,16 +122,12 @@ list(APPEND SOURCE ctfutb.idl xmllite.idl) -if(NOT MSVC) - list(APPEND SOURCE - wbemcli.idl) -endif() - add_idl_headers(psdk ${SOURCE}) - add_typelib(stdole2.idl) add_custom_target(stdole2 DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/stdole2.tlb) +add_idl_headers(d3d_idl_headers d3d10.idl d3dcommon.idl) + add_iid_library(dxgi_uuids dxgi.idl) add_iid_library(wuguid wuapi.idl) add_iid_library(xml_uuids msxml2.idl) diff --git a/reactos/include/psdk/d3d10.idl b/reactos/include/psdk/d3d10.idl new file mode 100644 index 00000000000..73a9e62a650 --- /dev/null +++ b/reactos/include/psdk/d3d10.idl @@ -0,0 +1,1600 @@ +/* + * Copyright 2007 Andras Kovacs + * + * 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 + */ + +import "oaidl.idl"; +import "ocidl.idl"; +import "dxgi.idl"; +import "d3dcommon.idl"; + +cpp_quote("#ifndef _D3D10_CONSTANTS") +cpp_quote("#define _D3D10_CONSTANTS") +const float D3D10_DEFAULT_BLEND_FACTOR_ALPHA = 1.0; +const float D3D10_DEFAULT_BLEND_FACTOR_BLUE = 1.0; +const float D3D10_DEFAULT_BLEND_FACTOR_GREEN = 1.0; +const float D3D10_DEFAULT_BLEND_FACTOR_RED = 1.0; +const float D3D10_DEFAULT_BORDER_COLOR_COMPONENT = 0.0; +const float D3D10_DEFAULT_SLOPE_SCALED_DEPTH_BIAS = 0.0; +const float D3D10_DEFAULT_DEPTH_BIAS_CLAMP = 0.0; +const float D3D10_DEFAULT_MAX_ANISOTROPY = 16.0; +const float D3D10_DEFAULT_MIP_LOD_BIAS = 0.0; +const float D3D10_DEFAULT_VIEWPORT_MAX_DEPTH = 0.0; +const float D3D10_DEFAULT_VIEWPORT_MIN_DEPTH = 0.0; +const float D3D10_FLOAT16_FUSED_TOLERANCE_IN_ULP = 0.6; +const float D3D10_FLOAT32_MAX = 3.402823466e+38; +const float D3D10_FLOAT32_TO_INTEGER_TOLERANCE_IN_ULP = 0.6; +const float D3D10_FLOAT_TO_SRGB_EXPONENT_DENOMINATOR = 2.4; +const float D3D10_FLOAT_TO_SRGB_EXPONENT_NUMERATOR = 1.0; +const float D3D10_FLOAT_TO_SRGB_OFFSET = 0.055; +const float D3D10_FLOAT_TO_SRGB_SCALE_1 = 12.92; +const float D3D10_FLOAT_TO_SRGB_SCALE_2 = 1.055; +const float D3D10_FLOAT_TO_SRGB_THRESHOLD = 0.0031308; +const float D3D10_FTOI_INSTRUCTION_MAX_INPUT = 2147483647.999; +const float D3D10_FTOI_INSTRUCTION_MIN_INPUT = -2147483648.999; +const float D3D10_FTOU_INSTRUCTION_MAX_INPUT = 4294967295.999; +const float D3D10_FTOU_INSTRUCTION_MIN_INPUT = 0.0; +const float D3D10_LINEAR_GAMMA = 1.0; +const float D3D10_MAX_BORDER_COLOR_COMPONENT = 1.0; +const float D3D10_MAX_DEPTH = 1.0; +const float D3D10_MAX_POSITION_VALUE = 3.402823466e+34; +const float D3D10_MIN_BORDER_COLOR_COMPONENT = 0.0; +const float D3D10_MIN_DEPTH = 0.0; +const float D3D10_MIP_LOD_BIAS_MAX = 15.99; +const float D3D10_MIP_LOD_BIAS_MIN = -16.0; +const float D3D10_PS_PIXEL_CENTER_FRACTIONAL_COMPONENT = 0.5; +const float D3D10_MULTISAMPLE_ANTIALIAS_LINE_WIDTH = 1.4; +const float D3D10_SRGB_GAMMA = 2.2; +const float D3D10_SRGB_TO_FLOAT_DENOMINATOR_1 = 12.92; +const float D3D10_SRGB_TO_FLOAT_DENOMINATOR_2 = 1.055; +const float D3D10_SRGB_TO_FLOAT_EXPONENT = 2.4; +const float D3D10_SRGB_TO_FLOAT_OFFSET = 0.055; +const float D3D10_SRGB_TO_FLOAT_THRESHOLD = 0.04045; +const float D3D10_SRGB_TO_FLOAT_TOLERANCE_IN_ULP = 0.5; +const float D3D10_PS_LEGACY_PIXEL_CENTER_FRACTIONAL_COMPONENT = 0.0; +const float D3D_SPEC_VERSION = 1.050005; +const unsigned int D3D10_16BIT_INDEX_STRIP_CUT_VALUE = 0xffff; +const unsigned int D3D10_32BIT_INDEX_STRIP_CUT_VALUE = 0xffffffff; +const unsigned int D3D10_8BIT_INDEX_STRIP_CUT_VALUE = 0xff; +const unsigned int D3D10_ARRAY_AXIS_ADDRESS_RANGE_BIT_COUNT = 9; +const unsigned int D3D10_CLIP_OR_CULL_DISTANCE_COUNT = 8; +const unsigned int D3D10_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT = 2; +const unsigned int D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT = 14; +const unsigned int D3D10_COMMONSHADER_CONSTANT_BUFFER_COMPONENTS = 4; +const unsigned int D3D10_COMMONSHADER_CONSTANT_BUFFER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D10_COMMONSHADER_CONSTANT_BUFFER_HW_SLOT_COUNT = 15; +const unsigned int D3D10_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COMPONENTS = 4; +const unsigned int D3D10_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COUNT = 15; +const unsigned int D3D10_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READS_PER_INST = 1; +const unsigned int D3D10_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READ_PORTS = 1; +const unsigned int D3D10_COMMONSHADER_FLOWCONTROL_NESTING_LIMIT = 64; +const unsigned int D3D10_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COMPONENTS = 4; +const unsigned int D3D10_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COUNT = 1; +const unsigned int D3D10_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READS_PER_INST = 1; +const unsigned int D3D10_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READ_PORTS = 1; +const unsigned int D3D10_COMMONSHADER_IMMEDIATE_VALUE_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D10_COMMONSHADER_INPUT_RESOURCE_REGISTER_COMPONENTS = 1; +const unsigned int D3D10_COMMONSHADER_INPUT_RESOURCE_REGISTER_COUNT = 128; +const unsigned int D3D10_COMMONSHADER_INPUT_RESOURCE_REGISTER_READS_PER_INST = 1; +const unsigned int D3D10_COMMONSHADER_INPUT_RESOURCE_REGISTER_READ_PORTS = 1; +const unsigned int D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT = 128; +const unsigned int D3D10_COMMONSHADER_SAMPLER_REGISTER_COMPONENTS = 1; +const unsigned int D3D10_COMMONSHADER_SAMPLER_REGISTER_COUNT = 16; +const unsigned int D3D10_COMMONSHADER_SAMPLER_REGISTER_READS_PER_INST = 1; +const unsigned int D3D10_COMMONSHADER_SAMPLER_REGISTER_READ_PORTS = 1; +const unsigned int D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT = 16; +const unsigned int D3D10_COMMONSHADER_SUBROUTINE_NESTING_LIMIT = 32; +const unsigned int D3D10_COMMONSHADER_TEMP_REGISTER_COMPONENTS = 4; +const unsigned int D3D10_COMMONSHADER_TEMP_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D10_COMMONSHADER_TEMP_REGISTER_COUNT = 4096; +const unsigned int D3D10_COMMONSHADER_TEMP_REGISTER_READS_PER_INST = 3; +const unsigned int D3D10_COMMONSHADER_TEMP_REGISTER_READ_PORTS = 3; +const unsigned int D3D10_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MAX = 10; +const int D3D10_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MIN = -10; +const int D3D10_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE = -8; +const unsigned int D3D10_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE = 7; +const unsigned int D3D10_DEFAULT_DEPTH_BIAS = 0; +const unsigned int D3D10_DEFAULT_RENDER_TARGET_ARRAY_INDEX = 0; +const unsigned int D3D10_DEFAULT_SAMPLE_MASK = 0xffffffff; +const unsigned int D3D10_DEFAULT_SCISSOR_ENDX = 0; +const unsigned int D3D10_DEFAULT_SCISSOR_ENDY = 0; +const unsigned int D3D10_DEFAULT_SCISSOR_STARTX = 0; +const unsigned int D3D10_DEFAULT_SCISSOR_STARTY = 0; +const unsigned int D3D10_DEFAULT_STENCIL_READ_MASK = 0xff; +const unsigned int D3D10_DEFAULT_STENCIL_REFERENCE = 0; +const unsigned int D3D10_DEFAULT_STENCIL_WRITE_MASK = 0xff; +const unsigned int D3D10_DEFAULT_VIEWPORT_AND_SCISSORRECT_INDEX = 0; +const unsigned int D3D10_DEFAULT_VIEWPORT_HEIGHT = 0; +const unsigned int D3D10_DEFAULT_VIEWPORT_TOPLEFTX = 0; +const unsigned int D3D10_DEFAULT_VIEWPORT_TOPLEFTY = 0; +const unsigned int D3D10_DEFAULT_VIEWPORT_WIDTH = 0; +const unsigned int D3D10_GS_INPUT_PRIM_CONST_REGISTER_COMPONENTS = 1; +const unsigned int D3D10_GS_INPUT_PRIM_CONST_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D10_GS_INPUT_PRIM_CONST_REGISTER_COUNT = 1; +const unsigned int D3D10_GS_INPUT_PRIM_CONST_REGISTER_READS_PER_INST = 2; +const unsigned int D3D10_GS_INPUT_PRIM_CONST_REGISTER_READ_PORTS = 1; +const unsigned int D3D10_GS_INPUT_REGISTER_COMPONENTS = 4; +const unsigned int D3D10_GS_INPUT_REGISTER_COMPONENT_BIT_COUNT =32; +const unsigned int D3D10_GS_INPUT_REGISTER_COUNT = 16; +const unsigned int D3D10_GS_INPUT_REGISTER_READS_PER_INST = 2; +const unsigned int D3D10_GS_INPUT_REGISTER_READ_PORTS = 1; +const unsigned int D3D10_GS_INPUT_REGISTER_VERTICES = 6; +const unsigned int D3D10_GS_OUTPUT_ELEMENTS = 32; +const unsigned int D3D10_GS_OUTPUT_REGISTER_COMPONENTS = 4; +const unsigned int D3D10_GS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D10_GS_OUTPUT_REGISTER_COUNT = 32; +const unsigned int D3D10_IA_DEFAULT_INDEX_BUFFER_OFFSET_IN_BYTES = 0; +const unsigned int D3D10_IA_DEFAULT_PRIMITIVE_TOPOLOGY = 0; +const unsigned int D3D10_IA_DEFAULT_VERTEX_BUFFER_OFFSET_IN_BYTES = 0; +const unsigned int D3D10_IA_INDEX_INPUT_RESOURCE_SLOT_COUNT = 1; +const unsigned int D3D10_IA_INSTANCE_ID_BIT_COUNT = 32; +const unsigned int D3D10_IA_INTEGER_ARITHMETIC_BIT_COUNT = 32; +const unsigned int D3D10_IA_PRIMITIVE_ID_BIT_COUNT = 32; +const unsigned int D3D10_IA_VERTEX_ID_BIT_COUNT = 32; +const unsigned int D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT = 16; +const unsigned int D3D10_IA_VERTEX_INPUT_STRUCTURE_ELEMENTS_COMPONENTS = 64; +const unsigned int D3D10_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT = 16; +const unsigned int D3D10_INTEGER_DIVIDE_BY_ZERO_QUOTIENT = 0xffffffff; +const unsigned int D3D10_INTEGER_DIVIDE_BY_ZERO_REMAINDER = 0xffffffff; +const unsigned int D3D10_MAX_MAXANISOTROPY = 16; +const unsigned int D3D10_MAX_MULTISAMPLE_SAMPLE_COUNT = 32; +const unsigned int D3D10_MAX_TEXTURE_DIMENSION_2_TO_EXP = 17; +const unsigned int D3D10_MIN_MAXANISOTROPY = 0; +const unsigned int D3D10_MIP_LOD_FRACTIONAL_BIT_COUNT = 6; +const unsigned int D3D10_MIP_LOD_RANGE_BIT_COUNT = 8; +const unsigned int D3D10_NONSAMPLE_FETCH_OUT_OF_RANGE_ACCESS_RESULT = 0; +const unsigned int D3D10_PIXEL_ADDRESS_RANGE_BIT_COUNT = 13; +const unsigned int D3D10_PRE_SCISSOR_PIXEL_ADDRESS_RANGE_BIT_COUNT = 15; +const unsigned int D3D10_PS_FRONTFACING_DEFAULT_VALUE = 0xffffffff; +const unsigned int D3D10_PS_FRONTFACING_FALSE_VALUE = 0; +const unsigned int D3D10_PS_FRONTFACING_TRUE_VALUE = 0xffffffff; +const unsigned int D3D10_PS_INPUT_REGISTER_COMPONENTS = 4; +const unsigned int D3D10_PS_INPUT_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D10_PS_INPUT_REGISTER_COUNT = 32; +const unsigned int D3D10_PS_INPUT_REGISTER_READS_PER_INST = 2; +const unsigned int D3D10_PS_INPUT_REGISTER_READ_PORTS = 1; +const unsigned int D3D10_PS_OUTPUT_DEPTH_REGISTER_COMPONENTS = 1; +const unsigned int D3D10_PS_OUTPUT_DEPTH_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D10_PS_OUTPUT_DEPTH_REGISTER_COUNT = 1; +const unsigned int D3D10_PS_OUTPUT_REGISTER_COMPONENTS = 4; +const unsigned int D3D10_PS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D10_PS_OUTPUT_REGISTER_COUNT = 8; +const unsigned int D3D10_REQ_BLEND_OBJECT_COUNT_PER_CONTEXT = 4096; +const unsigned int D3D10_REQ_BUFFER_RESOURCE_TEXEL_COUNT_2_TO_EXP = 27; +const unsigned int D3D10_REQ_CONSTANT_BUFFER_ELEMENT_COUNT = 4096; +const unsigned int D3D10_REQ_DEPTH_STENCIL_OBJECT_COUNT_PER_CONTEXT = 4096; +const unsigned int D3D10_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP = 32; +const unsigned int D3D10_REQ_DRAW_VERTEX_COUNT_2_TO_EXP = 32; +const unsigned int D3D10_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION = 8192; +const unsigned int D3D10_REQ_GS_INVOCATION_32BIT_OUTPUT_COMPONENT_LIMIT = 1024; +const unsigned int D3D10_REQ_IMMEDIATE_CONSTANT_BUFFER_ELEMENT_COUNT = 4096; +const unsigned int D3D10_REQ_MAXANISOTROPY = 16; +const unsigned int D3D10_REQ_MIP_LEVELS = 14; +const unsigned int D3D10_REQ_MULTI_ELEMENT_STRUCTURE_SIZE_IN_BYTES = 2048; +const unsigned int D3D10_REQ_RASTERIZER_OBJECT_COUNT_PER_CONTEXT = 4096; +const unsigned int D3D10_REQ_RENDER_TO_BUFFER_WINDOW_WIDTH = 8192; +const unsigned int D3D10_REQ_RESOURCE_SIZE_IN_MEGABYTES = 128; +const unsigned int D3D10_REQ_RESOURCE_VIEW_COUNT_PER_CONTEXT_2_TO_EXP = 20; +const unsigned int D3D10_REQ_SAMPLER_OBJECT_COUNT_PER_CONTEXT = 4096; +const unsigned int D3D10_REQ_TEXTURE1D_ARRAY_AXIS_DIMENSION = 512; +const unsigned int D3D10_REQ_TEXTURE1D_U_DIMENSION = 8192; +const unsigned int D3D10_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION = 512; +const unsigned int D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION = 8192; +const unsigned int D3D10_REQ_TEXTURE3D_U_V_OR_W_DIMENSION = 2048; +const unsigned int D3D10_REQ_TEXTURECUBE_DIMENSION = 8192; +const unsigned int D3D10_RESINFO_INSTRUCTION_MISSING_COMPONENT_RETVAL = 0; +const unsigned int D3D10_SHADER_MAJOR_VERSION = 4; +const unsigned int D3D10_SHADER_MINOR_VERSION = 0; +const unsigned int D3D10_SHIFT_INSTRUCTION_PAD_VALUE = 0; +const unsigned int D3D10_SHIFT_INSTRUCTION_SHIFT_VALUE_BIT_COUNT = 5; +const unsigned int D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT = 8; +const unsigned int D3D10_SO_BUFFER_MAX_STRIDE_IN_BYTES = 2048; +const unsigned int D3D10_SO_BUFFER_MAX_WRITE_WINDOW_IN_BYTES = 256; +const unsigned int D3D10_SO_BUFFER_SLOT_COUNT = 4; +const unsigned int D3D10_SO_DDI_REGISTER_INDEX_DENOTING_GAP = 0xffffffff; +const unsigned int D3D10_SO_MULTIPLE_BUFFER_ELEMENTS_PER_BUFFER = 1; +const unsigned int D3D10_SO_SINGLE_BUFFER_COMPONENT_LIMIT = 64; +const unsigned int D3D10_STANDARD_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D10_STANDARD_COMPONENT_BIT_COUNT_DOUBLED = 64; +const unsigned int D3D10_STANDARD_MAXIMUM_ELEMENT_ALIGNMENT_BYTE_MULTIPLE = 4; +const unsigned int D3D10_STANDARD_PIXEL_COMPONENT_COUNT = 128; +const unsigned int D3D10_STANDARD_PIXEL_ELEMENT_COUNT = 32; +const unsigned int D3D10_STANDARD_VECTOR_SIZE = 4; +const unsigned int D3D10_STANDARD_VERTEX_ELEMENT_COUNT = 16; +const unsigned int D3D10_STANDARD_VERTEX_TOTAL_COMPONENT_COUNT = 64; +const unsigned int D3D10_SUBPIXEL_FRACTIONAL_BIT_COUNT = 8; +const unsigned int D3D10_SUBTEXEL_FRACTIONAL_BIT_COUNT = 6; +const unsigned int D3D10_TEXEL_ADDRESS_RANGE_BIT_COUNT = 18; +const unsigned int D3D10_UNBOUND_MEMORY_ACCESS_RESULT = 0; +const unsigned int D3D10_VIEWPORT_AND_SCISSORRECT_MAX_INDEX = 15; +const unsigned int D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE = 16; +const unsigned int D3D10_VIEWPORT_BOUNDS_MAX = 16383; +const int D3D10_VIEWPORT_BOUNDS_MIN = -16384; +const unsigned int D3D10_VS_INPUT_REGISTER_COMPONENTS = 4; +const unsigned int D3D10_VS_INPUT_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D10_VS_INPUT_REGISTER_COUNT = 16; +const unsigned int D3D10_VS_INPUT_REGISTER_READS_PER_INST = 2; +const unsigned int D3D10_VS_INPUT_REGISTER_READ_PORTS = 1; +const unsigned int D3D10_VS_OUTPUT_REGISTER_COMPONENTS = 4; +const unsigned int D3D10_VS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT = 32; +const unsigned int D3D10_VS_OUTPUT_REGISTER_COUNT = 16; +const unsigned int D3D10_WHQL_CONTEXT_COUNT_FOR_RESOURCE_LIMIT = 10; +const unsigned int D3D10_WHQL_DRAWINDEXED_INDEX_COUNT_2_TO_EXP = 25; +const unsigned int D3D10_WHQL_DRAW_VERTEX_COUNT_2_TO_EXP = 25; +const unsigned int D3D_MAJOR_VERSION = 10; +const unsigned int D3D_MINOR_VERSION = 0; +const unsigned int D3D_SPEC_DATE_DAY = 8; +const unsigned int D3D_SPEC_DATE_MONTH = 8; +const unsigned int D3D_SPEC_DATE_YEAR = 2006; +cpp_quote("#endif") + +const unsigned int D3D10_APPEND_ALIGNED_ELEMENT = 0xffffffff; +const unsigned int _FACD3D10 = 0x87; +const unsigned int _FACD3D10DEBUG = _FACD3D10 + 1; +const unsigned int D3D10_FILTER_TYPE_MASK = 0x3; +const unsigned int D3D10_SDK_VERSION = 29; + +cpp_quote("#define MAKE_D3D10_HRESULT(code) MAKE_HRESULT( 1, _FACD3D10, code)") +cpp_quote("#define MAKE_D3D10_STATUS(code) MAKE_HRESULT( 0, _FACD3D10, code)") +cpp_quote("#define D3D10_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS MAKE_D3D10_HRESULT(1)") +cpp_quote("#define D3D10_ERROR_FILE_NOT_FOUND MAKE_D3D10_HRESULT(2)") + +typedef enum D3D10_BLEND { + D3D10_BLEND_ZERO = 1, + D3D10_BLEND_ONE = 2, + D3D10_BLEND_SRC_COLOR = 3, + D3D10_BLEND_INV_SRC_COLOR = 4, + D3D10_BLEND_SRC_ALPHA = 5, + D3D10_BLEND_INV_SRC_ALPHA = 6, + D3D10_BLEND_DEST_ALPHA = 7, + D3D10_BLEND_INV_DEST_ALPHA = 8, + D3D10_BLEND_DEST_COLOR = 9, + D3D10_BLEND_INV_DEST_COLOR = 10, + D3D10_BLEND_SRC_ALPHA_SAT = 11, + D3D10_BLEND_BLEND_FACTOR = 14, + D3D10_BLEND_INV_BLEND_FACTOR = 15, + D3D10_BLEND_SRC1_COLOR = 16, + D3D10_BLEND_INV_SRC1_COLOR = 17, + D3D10_BLEND_SRC1_ALPHA = 18, + D3D10_BLEND_INV_SRC1_ALPHA = 19 +} D3D10_BLEND; + +typedef enum D3D10_BLEND_OP { + D3D10_BLEND_OP_ADD = 1, + D3D10_BLEND_OP_SUBTRACT, + D3D10_BLEND_OP_REV_SUBTRACT, + D3D10_BLEND_OP_MIN, + D3D10_BLEND_OP_MAX, +} D3D10_BLEND_OP; + +typedef struct D3D10_BLEND_DESC { + BOOL AlphaToCoverageEnable; + BOOL BlendEnable[8]; + D3D10_BLEND SrcBlend; + D3D10_BLEND DestBlend; + D3D10_BLEND_OP BlendOp; + D3D10_BLEND SrcBlendAlpha; + D3D10_BLEND DestBlendAlpha; + D3D10_BLEND_OP BlendOpAlpha; + UINT8 RenderTargetWriteMask[8]; +} D3D10_BLEND_DESC; + +typedef enum D3D10_DEPTH_WRITE_MASK { + D3D10_DEPTH_WRITE_MASK_ZERO, + D3D10_DEPTH_WRITE_MASK_ALL, +} D3D10_DEPTH_WRITE_MASK; + +typedef enum D3D10_COMPARISON_FUNC { + D3D10_COMPARISON_NEVER = 1, + D3D10_COMPARISON_LESS, + D3D10_COMPARISON_EQUAL, + D3D10_COMPARISON_LESS_EQUAL, + D3D10_COMPARISON_GREATER, + D3D10_COMPARISON_NOT_EQUAL, + D3D10_COMPARISON_GREATER_EQUAL, + D3D10_COMPARISON_ALWAYS, +} D3D10_COMPARISON_FUNC; + +typedef enum D3D10_STENCIL_OP { + D3D10_STENCIL_OP_KEEP = 1, + D3D10_STENCIL_OP_ZERO, + D3D10_STENCIL_OP_REPLACE, + D3D10_STENCIL_OP_INCR_SAT, + D3D10_STENCIL_OP_DECR_SAT, + D3D10_STENCIL_OP_INVERT, + D3D10_STENCIL_OP_INCR, + D3D10_STENCIL_OP_DECR, +} D3D10_STENCIL_OP; + +typedef struct D3D10_DEPTH_STENCILOP_DESC { + D3D10_STENCIL_OP StencilFailOp; + D3D10_STENCIL_OP StencilDepthFailOp; + D3D10_STENCIL_OP StencilPassOp; + D3D10_COMPARISON_FUNC StencilFunc; +} D3D10_DEPTH_STENCILOP_DESC; + +typedef struct D3D10_DEPTH_STENCIL_DESC { + BOOL DepthEnable; + D3D10_DEPTH_WRITE_MASK DepthWriteMask; + D3D10_COMPARISON_FUNC DepthFunc; + BOOL StencilEnable; + UINT8 StencilReadMask; + UINT8 StencilWriteMask; + D3D10_DEPTH_STENCILOP_DESC FrontFace; + D3D10_DEPTH_STENCILOP_DESC BackFace; +} D3D10_DEPTH_STENCIL_DESC; + +typedef enum D3D10_FILL_MODE { + D3D10_FILL_WIREFRAME = 2, + D3D10_FILL_SOLID, +} D3D10_FILL_MODE; + +typedef enum D3D10_CULL_MODE { + D3D10_CULL_NONE = 1, + D3D10_CULL_FRONT, + D3D10_CULL_BACK, +} D3D10_CULL_MODE; + +typedef struct D3D10_RASTERIZER_DESC { + D3D10_FILL_MODE FillMode; + D3D10_CULL_MODE CullMode; + BOOL FrontCounterClockwise; + INT DepthBias; + FLOAT DepthBiasClamp; + FLOAT SlopeScaledDepthBias; + BOOL DepthClipEnable; + BOOL ScissorEnable; + BOOL MultisampleEnable; + BOOL AntialiasedLineEnable; +} D3D10_RASTERIZER_DESC; + +typedef enum D3D10_FILTER { + D3D10_FILTER_MIN_MAG_MIP_POINT = 0, + D3D10_FILTER_MIN_MAG_POINT_MIP_LINEAR = 0x1, + D3D10_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x4, + D3D10_FILTER_MIN_POINT_MAG_MIP_LINEAR = 0x5, + D3D10_FILTER_MIN_LINEAR_MAG_MIP_POINT = 0x10, + D3D10_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x11, + D3D10_FILTER_MIN_MAG_LINEAR_MIP_POINT = 0x14, + D3D10_FILTER_MIN_MAG_MIP_LINEAR = 0x15, + D3D10_FILTER_ANISOTROPIC = 0x55, + D3D10_FILTER_COMPARISON_MIN_MAG_MIP_POINT = 0x80, + D3D10_FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR = 0x81, + D3D10_FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x84, + D3D10_FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR = 0x85, + D3D10_FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT = 0x90, + D3D10_FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x91, + D3D10_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT = 0x94, + D3D10_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR = 0x95, + D3D10_FILTER_COMPARISON_ANISOTROPIC = 0xd5, + D3D10_FILTER_TEXT_1BIT = 0x80000000 +} D3D10_FILTER; + +typedef enum D3D10_TEXTURE_ADDRESS_MODE { + D3D10_TEXTURE_ADDRESS_WRAP = 1, + D3D10_TEXTURE_ADDRESS_MIRROR, + D3D10_TEXTURE_ADDRESS_CLAMP, + D3D10_TEXTURE_ADDRESS_BORDER, + D3D10_TEXTURE_ADDRESS_MIRROR_ONCE, +} D3D10_TEXTURE_ADDRESS_MODE; + +typedef struct D3D10_SAMPLER_DESC { + D3D10_FILTER Filter; + D3D10_TEXTURE_ADDRESS_MODE AddressU; + D3D10_TEXTURE_ADDRESS_MODE AddressV; + D3D10_TEXTURE_ADDRESS_MODE AddressW; + FLOAT MipLODBias; + UINT MaxAnisotropy; + D3D10_COMPARISON_FUNC ComparisonFunc; + FLOAT BorderColor[4]; + FLOAT MinLOD; + FLOAT MaxLOD; +} D3D10_SAMPLER_DESC; + +typedef enum D3D10_COUNTER { + D3D10_COUNTER_GPU_IDLE, + D3D10_COUNTER_VERTEX_PROCESSING, + D3D10_COUNTER_GEOMETRY_PROCESSING, + D3D10_COUNTER_PIXEL_PROCESSING, + D3D10_COUNTER_OTHER_GPU_PROCESSING, + D3D10_COUNTER_HOST_ADAPTER_BANDWIDTH_UTILIZATION, + D3D10_COUNTER_LOCAL_VIDMEM_BANDWIDTH_UTILIZATION, + D3D10_COUNTER_VERTEX_THROUGHPUT_UTILIZATION, + D3D10_COUNTER_TRIANGLE_SETUP_THROUGHPUT_UTILIZATION, + D3D10_COUNTER_FILLRATE_THROUGHPUT_UTILIZATION, + D3D10_COUNTER_VS_MEMORY_LIMITED, + D3D10_COUNTER_VS_COMPUTATION_LIMITED, + D3D10_COUNTER_GS_MEMORY_LIMITED, + D3D10_COUNTER_GS_COMPUTATION_LIMITED, + D3D10_COUNTER_PS_MEMORY_LIMITED, + D3D10_COUNTER_PS_COMPUTATION_LIMITED, + D3D10_COUNTER_POST_TRANSFORM_CACHE_HIT_RATE, + D3D10_COUNTER_TEXTURE_CACHE_HIT_RATE, + D3D10_COUNTER_DEVICE_DEPENDENT_0 = 0x40000000 +} D3D10_COUNTER; + +typedef struct D3D10_COUNTER_DESC { + D3D10_COUNTER Counter; + UINT MiscFlags; +} D3D10_COUNTER_DESC; + +typedef enum D3D10_COUNTER_TYPE { + D3D10_COUNTER_TYPE_FLOAT32, + D3D10_COUNTER_TYPE_UINT16, + D3D10_COUNTER_TYPE_UINT32, + D3D10_COUNTER_TYPE_UINT64, +} D3D10_COUNTER_TYPE; + +typedef struct D3D10_COUNTER_INFO { + D3D10_COUNTER LastDeviceDependentCounter; + UINT NumSimultaneousCounters; + UINT8 NumDetectableParallelUnits; +} D3D10_COUNTER_INFO; + +typedef enum D3D10_RESOURCE_DIMENSION { + D3D10_RESOURCE_DIMENSION_UNKNOWN, + D3D10_RESOURCE_DIMENSION_BUFFER, + D3D10_RESOURCE_DIMENSION_TEXTURE1D, + D3D10_RESOURCE_DIMENSION_TEXTURE2D, + D3D10_RESOURCE_DIMENSION_TEXTURE3D, +} D3D10_RESOURCE_DIMENSION; + +typedef enum D3D10_USAGE { + D3D10_USAGE_DEFAULT, + D3D10_USAGE_IMMUTABLE, + D3D10_USAGE_DYNAMIC, + D3D10_USAGE_STAGING, +} D3D10_USAGE; + +typedef enum D3D10_BIND_FLAG { + D3D10_BIND_VERTEX_BUFFER = 0x1, + D3D10_BIND_INDEX_BUFFER = 0x2, + D3D10_BIND_CONSTANT_BUFFER = 0x4, + D3D10_BIND_SHADER_RESOURCE = 0x8, + D3D10_BIND_STREAM_OUTPUT = 0x10, + D3D10_BIND_RENDER_TARGET = 0x20, + D3D10_BIND_DEPTH_STENCIL = 0x40 +} D3D10_BIND_FLAG; + +typedef struct D3D10_BUFFER_DESC { + UINT ByteWidth; + D3D10_USAGE Usage; + UINT BindFlags; + UINT CPUAccessFlags; + UINT MiscFlags; +} D3D10_BUFFER_DESC; + +cpp_quote("#if !defined(D3D10_NO_HELPERS) && defined(__cplusplus)") +cpp_quote("struct CD3D10_BUFFER_DESC : public D3D10_BUFFER_DESC {") +cpp_quote(" CD3D10_BUFFER_DESC() {}" ) +cpp_quote(" explicit CD3D10_BUFFER_DESC(const D3D10_BUFFER_DESC &o) : D3D10_BUFFER_DESC(o) {}") +cpp_quote(" explicit CD3D10_BUFFER_DESC(UINT byteWidth, UINT bindFlags, D3D10_USAGE usage = D3D10_USAGE_DEFAULT, UINT cpuaccessFlags = 0, UINT miscFlags = 0 ) {") +cpp_quote(" ByteWidth = byteWidth;") +cpp_quote(" Usage = usage;") +cpp_quote(" BindFlags = bindFlags;") +cpp_quote(" CPUAccessFlags = cpuaccessFlags;") +cpp_quote(" MiscFlags = miscFlags;") +cpp_quote(" }") +cpp_quote(" ~CD3D10_BUFFER_DESC() {}") +cpp_quote(" operator const D3D10_BUFFER_DESC&() const {") +cpp_quote(" return *this;") +cpp_quote(" }") +cpp_quote("};") +cpp_quote("#endif") + +typedef enum D3D10_MAP { + D3D10_MAP_READ = 1, + D3D10_MAP_WRITE, + D3D10_MAP_READ_WRITE, + D3D10_MAP_WRITE_DISCARD, + D3D10_MAP_WRITE_NO_OVERWRITE, +} D3D10_MAP; + +typedef struct D3D10_TEXTURE1D_DESC { + UINT Width; + UINT MipLevels; + UINT ArraySize; + DXGI_FORMAT Format; + D3D10_USAGE Usage; + UINT BindFlags; + UINT CPUAccessFlags; + UINT MiscFlags; +} D3D10_TEXTURE1D_DESC; + +cpp_quote("#if !defined(D3D10_NO_HELPERS) && defined(__cplusplus)") +cpp_quote("struct CD3D10_TEXTURE1D_DESC : public D3D10_TEXTURE1D_DESC {") +cpp_quote(" CD3D10_TEXTURE1D_DESC() {}") +cpp_quote(" explicit CD3D10_TEXTURE1D_DESC(const D3D10_TEXTURE1D_DESC &o) : D3D10_TEXTURE1D_DESC(o) {}") +cpp_quote(" explicit CD3D10_TEXTURE1D_DESC(DXGI_FORMAT format, UINT width, UINT arraySize = 1, UINT mipLevels = 0,") +cpp_quote(" UINT bindFlags = D3D10_BIND_SHADER_RESOURCE, D3D10_USAGE usage = D3D10_USAGE_DEFAULT, UINT cpuaccessFlags = 0,") +cpp_quote(" UINT miscFlags = 0) {") +cpp_quote(" Width = width;") +cpp_quote(" MipLevels = mipLevels;") +cpp_quote(" ArraySize = arraySize;") +cpp_quote(" Format = format;") +cpp_quote(" Usage = usage;") +cpp_quote(" BindFlags = bindFlags;") +cpp_quote(" CPUAccessFlags = cpuaccessFlags;") +cpp_quote(" MiscFlags = miscFlags;") +cpp_quote(" }") +cpp_quote(" ~CD3D10_TEXTURE1D_DESC() {}") +cpp_quote(" operator const D3D10_TEXTURE1D_DESC&() const {") +cpp_quote(" return *this;") +cpp_quote(" }") +cpp_quote("};") +cpp_quote("#endif") + +typedef struct D3D10_TEXTURE2D_DESC { + UINT Width; + UINT Height; + UINT MipLevels; + UINT ArraySize; + DXGI_FORMAT Format; + DXGI_SAMPLE_DESC SampleDesc; + D3D10_USAGE Usage; + UINT BindFlags; + UINT CPUAccessFlags; + UINT MiscFlags; +} D3D10_TEXTURE2D_DESC; + +cpp_quote("#if !defined(D3D10_NO_HELPERS) && defined(__cplusplus)") +cpp_quote("struct CD3D10_TEXTURE2D_DESC : public D3D10_TEXTURE2D_DESC {") +cpp_quote(" CD3D10_TEXTURE2D_DESC() {}" ) +cpp_quote(" explicit CD3D10_TEXTURE2D_DESC(const D3D10_TEXTURE2D_DESC &o) : D3D10_TEXTURE2D_DESC(o) {}") +cpp_quote(" explicit CD3D10_TEXTURE2D_DESC(DXGI_FORMAT format, UINT width, UINT height,") +cpp_quote(" UINT arraySize = 1,") +cpp_quote(" UINT mipLevels = 0,") +cpp_quote(" UINT bindFlags = D3D10_BIND_SHADER_RESOURCE,") +cpp_quote(" D3D10_USAGE usage = D3D10_USAGE_DEFAULT,") +cpp_quote(" UINT cpuaccessFlags = 0,") +cpp_quote(" UINT sampleCount = 1,") +cpp_quote(" UINT sampleQuality = 0,") +cpp_quote(" UINT miscFlags = 0) {") +cpp_quote(" Width = width;" ) +cpp_quote(" Height = height;" ) +cpp_quote(" MipLevels = mipLevels;" ) +cpp_quote(" ArraySize = arraySize;" ) +cpp_quote(" Format = format;" ) +cpp_quote(" SampleDesc.Count = sampleCount;" ) +cpp_quote(" SampleDesc.Quality = sampleQuality;" ) +cpp_quote(" Usage = usage;" ) +cpp_quote(" BindFlags = bindFlags;" ) +cpp_quote(" CPUAccessFlags = cpuaccessFlags;" ) +cpp_quote(" MiscFlags = miscFlags;" ) +cpp_quote(" }") +cpp_quote(" ~CD3D10_TEXTURE2D_DESC() {}") +cpp_quote(" operator const D3D10_TEXTURE2D_DESC&() const {") +cpp_quote(" return *this;") +cpp_quote(" }") +cpp_quote("};") +cpp_quote("#endif") + +typedef struct D3D10_TEXTURE3D_DESC { + UINT Width; + UINT Height; + UINT Depth; + UINT MipLevels; + DXGI_FORMAT Format; + D3D10_USAGE Usage; + UINT BindFlags; + UINT CPUAccessFlags; + UINT MiscFlags; +} D3D10_TEXTURE3D_DESC; + +typedef enum D3D10_DSV_DIMENSION +{ + D3D10_DSV_DIMENSION_UNKNOWN, + D3D10_DSV_DIMENSION_TEXTURE1D, + D3D10_DSV_DIMENSION_TEXTURE1DARRAY, + D3D10_DSV_DIMENSION_TEXTURE2D, + D3D10_DSV_DIMENSION_TEXTURE2DARRAY, + D3D10_DSV_DIMENSION_TEXTURE2DMS, + D3D10_DSV_DIMENSION_TEXTURE2DMSARRAY, +} D3D10_DSV_DIMENSION; + +typedef struct D3D10_TEX1D_DSV { + UINT MipSlice; +} D3D10_TEX1D_DSV; + +typedef struct D3D10_TEX1D_ARRAY_DSV { + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; +} D3D10_TEX1D_ARRAY_DSV; + +typedef struct D3D10_TEX2D_DSV { + UINT MipSlice; +} D3D10_TEX2D_DSV; + +typedef struct D3D10_TEX2D_ARRAY_DSV { + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; +} D3D10_TEX2D_ARRAY_DSV; + +typedef struct D3D10_TEX2DMS_DSV { + UINT UnusedField_NothingToDefine; +} D3D10_TEX2DMS_DSV; + +typedef struct D3D10_TEX2DMS_ARRAY_DSV { + UINT FirstArraySlice; + UINT ArraySize; +} D3D10_TEX2DMS_ARRAY_DSV; + +typedef struct D3D10_DEPTH_STENCIL_VIEW_DESC { + DXGI_FORMAT Format; + D3D10_DSV_DIMENSION ViewDimension; + union { + D3D10_TEX1D_DSV Texture1D; + D3D10_TEX1D_ARRAY_DSV Texture1DArray; + D3D10_TEX2D_DSV Texture2D; + D3D10_TEX2D_ARRAY_DSV Texture2DArray; + D3D10_TEX2DMS_DSV Texture2DMS; + D3D10_TEX2DMS_ARRAY_DSV Texture2DMSArray; + }; +} D3D10_DEPTH_STENCIL_VIEW_DESC; + +typedef enum D3D10_RTV_DIMENSION { + D3D10_RTV_DIMENSION_UNKNOWN, + D3D10_RTV_DIMENSION_BUFFER, + D3D10_RTV_DIMENSION_TEXTURE1D, + D3D10_RTV_DIMENSION_TEXTURE1DARRAY, + D3D10_RTV_DIMENSION_TEXTURE2D, + D3D10_RTV_DIMENSION_TEXTURE2DARRAY, + D3D10_RTV_DIMENSION_TEXTURE2DMS, + D3D10_RTV_DIMENSION_TEXTURE2DMSARRAY, + D3D10_RTV_DIMENSION_TEXTURE3D, +} D3D10_RTV_DIMENSION; + +typedef struct D3D10_BUFFER_RTV { + UINT ElementOffset; + UINT ElementWidth; +} D3D10_BUFFER_RTV; + +typedef struct D3D10_TEX1D_RTV { + UINT MipSlice; +} D3D10_TEX1D_RTV; + +typedef struct D3D10_TEX1D_ARRAY_RTV { + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; +} D3D10_TEX1D_ARRAY_RTV; + +typedef struct D3D10_TEX2D_RTV { + UINT MipSlice; +} D3D10_TEX2D_RTV; + +typedef struct D3D10_TEX2D_ARRAY_RTV { + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; +} D3D10_TEX2D_ARRAY_RTV; + +typedef struct D3D10_TEX2DMS_RTV { + UINT UnusedField_NothingToDefine; +} D3D10_TEX2DMS_RTV; + +typedef struct D3D10_TEX2DMS_ARRAY_RTV { + UINT FirstArraySlice; + UINT ArraySize; +} D3D10_TEX2DMS_ARRAY_RTV; + +typedef struct D3D10_TEX3D_RTV { + UINT MipSlice; + UINT FirstWSlice; + UINT WSize; +} D3D10_TEX3D_RTV; + +typedef struct D3D10_RENDER_TARGET_VIEW_DESC { + DXGI_FORMAT Format; + D3D10_RTV_DIMENSION ViewDimension; + union { + D3D10_BUFFER_RTV Buffer; + D3D10_TEX1D_RTV Texture1D; + D3D10_TEX1D_ARRAY_RTV Texture1DArray; + D3D10_TEX2D_RTV Texture2D; + D3D10_TEX2D_ARRAY_RTV Texture2DArray; + D3D10_TEX2DMS_RTV Texture2DMS; + D3D10_TEX2DMS_ARRAY_RTV Texture2DMSArray; + D3D10_TEX3D_RTV Texture3D; + }; +} D3D10_RENDER_TARGET_VIEW_DESC; + +typedef D3D_SRV_DIMENSION D3D10_SRV_DIMENSION; + +typedef struct D3D10_BUFFER_SRV { + UINT ElementOffset; + UINT ElementWidth; +} D3D10_BUFFER_SRV; + +typedef struct D3D10_TEX1D_SRV { + UINT MostDetailedMip; + UINT MipLevels; +} D3D10_TEX1D_SRV; + +typedef struct D3D10_TEX1D_ARRAY_SRV { + UINT MostDetailedMip; + UINT MipLevels; + UINT FirstArraySlice; + UINT ArraySize; +} D3D10_TEX1D_ARRAY_SRV; + +typedef struct D3D10_TEX2D_SRV { + UINT MostDetailedMip; + UINT MipLevels; +} D3D10_TEX2D_SRV; + +typedef struct D3D10_TEX2D_ARRAY_SRV { + UINT MostDetailedMip; + UINT MipLevels; + UINT FirstArraySlice; + UINT ArraySize; +} D3D10_TEX2D_ARRAY_SRV; + +typedef struct D3D10_TEX2DMS_SRV { + UINT UnusedField_NothingToDefine; +} D3D10_TEX2DMS_SRV; + +typedef struct D3D10_TEX2DMS_ARRAY_SRV { + UINT FirstArraySlice; + UINT ArraySize; +} D3D10_TEX2DMS_ARRAY_SRV; + +typedef struct D3D10_TEX3D_SRV { + UINT MostDetailedMip; + UINT MipLevels; +} D3D10_TEX3D_SRV; + +typedef struct D3D10_TEXCUBE_SRV { + UINT MostDetailedMip; + UINT MipLevels; +} D3D10_TEXCUBE_SRV; + +typedef struct D3D10_SHADER_RESOURCE_VIEW_DESC { + DXGI_FORMAT Format; + D3D10_SRV_DIMENSION ViewDimension; + union { + D3D10_BUFFER_SRV Buffer; + D3D10_TEX1D_SRV Texture1D; + D3D10_TEX1D_ARRAY_SRV Texture1DArray; + D3D10_TEX2D_SRV Texture2D; + D3D10_TEX2D_ARRAY_SRV Texture2DArray; + D3D10_TEX2DMS_SRV Texture2DMS; + D3D10_TEX2DMS_ARRAY_SRV Texture2DMSArray; + D3D10_TEX3D_SRV Texture3D; + D3D10_TEXCUBE_SRV TextureCube; + }; +} D3D10_SHADER_RESOURCE_VIEW_DESC; + +typedef struct D3D10_BOX { + UINT left; + UINT top; + UINT front; + UINT right; + UINT bottom; + UINT back; +} D3D10_BOX; + +typedef struct D3D10_SUBRESOURCE_DATA { + const void *pSysMem; + UINT SysMemPitch; + UINT SysMemSlicePitch; +} D3D10_SUBRESOURCE_DATA; + +typedef struct D3D10_SO_DECLARATION_ENTRY { + LPCSTR SemanticName; + UINT SemanticIndex; + BYTE StartComponent; + BYTE ComponentCount; + BYTE OutputSlot; +} D3D10_SO_DECLARATION_ENTRY; + +typedef enum D3D10_INPUT_CLASSIFICATION { + D3D10_INPUT_PER_VERTEX_DATA, + D3D10_INPUT_PER_INSTANCE_DATA, +} D3D10_INPUT_CLASSIFICATION; + +typedef struct D3D10_INPUT_ELEMENT_DESC { + LPCSTR SemanticName; + UINT SemanticIndex; + DXGI_FORMAT Format; + UINT InputSlot; + UINT AlignedByteOffset; + D3D10_INPUT_CLASSIFICATION InputSlotClass; + UINT InstanceDataStepRate; +} D3D10_INPUT_ELEMENT_DESC; + +typedef enum D3D10_QUERY { + D3D10_QUERY_EVENT, + D3D10_QUERY_OCCLUSION, + D3D10_QUERY_TIMESTAMP, + D3D10_QUERY_TIMESTAMP_DISJOINT, + D3D10_QUERY_PIPELINE_STATISTICS, + D3D10_QUERY_OCCLUSION_PREDICATE, + D3D10_QUERY_SO_STATISTICS, + D3D10_QUERY_SO_OVERFLOW_PREDICATE, +} D3D10_QUERY; + +typedef struct D3D10_QUERY_DESC { + D3D10_QUERY Query; + UINT MiscFlags; +} D3D10_QUERY_DESC; + +typedef D3D_PRIMITIVE_TOPOLOGY D3D10_PRIMITIVE_TOPOLOGY; + +typedef D3D_PRIMITIVE D3D10_PRIMITIVE; + +typedef RECT D3D10_RECT; + +typedef struct D3D10_VIEWPORT { + INT TopLeftX; + INT TopLeftY; + UINT Width; + UINT Height; + FLOAT MinDepth; + FLOAT MaxDepth; +} D3D10_VIEWPORT; + +typedef struct D3D10_MAPPED_TEXTURE2D { + void *pData; + UINT RowPitch; +} D3D10_MAPPED_TEXTURE2D; + +typedef struct D3D10_MAPPED_TEXTURE3D { + void *pData; + UINT RowPitch; + UINT DepthPitch; +} D3D10_MAPPED_TEXTURE3D; + +typedef enum D3D10_CPU_ACCESS_FLAG { + D3D10_CPU_ACCESS_WRITE = 0x10000, + D3D10_CPU_ACCESS_READ = 0x20000 +} D3D10_CPU_ACCESS_FLAG; + +typedef enum D3D10_RESOURCE_MISC_FLAG { + D3D10_RESOURCE_MISC_GENERATE_MIPS = 0x0001, + D3D10_RESOURCE_MISC_SHARED = 0x0002, + D3D10_RESOURCE_MISC_TEXTURECUBE = 0x0004, + D3D10_RESOURCE_MISC_SHARED_KEYEDMUTEX = 0x0010, + D3D10_RESOURCE_MISC_GDI_COMPATIBLE = 0x0020 +} D3D10_RESOURCE_MISC_FLAG; + +typedef enum D3D10_MAP_FLAG { + D3D10_MAP_FLAG_DO_NOT_WAIT = 0x100000, +} D3D10_MAP_FLAG; + +typedef enum D3D10_CLEAR_FLAG { + D3D10_CLEAR_DEPTH = 0x1, + D3D10_CLEAR_STENCIL = 0x2 +} D3D10_CLEAR_FLAG; + +typedef enum D3D10_COLOR_WRITE_ENABLE { + D3D10_COLOR_WRITE_ENABLE_RED = 0x1, + D3D10_COLOR_WRITE_ENABLE_GREEN = 0x2, + D3D10_COLOR_WRITE_ENABLE_BLUE = 0x4, + D3D10_COLOR_WRITE_ENABLE_ALPHA = 0x8, + D3D10_COLOR_WRITE_ENABLE_ALL = (D3D10_COLOR_WRITE_ENABLE_RED | D3D10_COLOR_WRITE_ENABLE_GREEN | + D3D10_COLOR_WRITE_ENABLE_BLUE | D3D10_COLOR_WRITE_ENABLE_ALPHA) +} D3D10_COLOR_WRITE_ENABLE; + +typedef enum D3D10_TEXTURECUBE_FACE { + D3D10_TEXTURECUBE_FACE_POSITIVE_X, + D3D10_TEXTURECUBE_FACE_NEGATIVE_X, + D3D10_TEXTURECUBE_FACE_POSITIVE_Y, + D3D10_TEXTURECUBE_FACE_NEGATIVE_Y, + D3D10_TEXTURECUBE_FACE_POSITIVE_Z, + D3D10_TEXTURECUBE_FACE_NEGATIVE_Z, +} D3D10_TEXTURECUBE_FACE; + +typedef enum D3D10_ASYNC_GETDATA_FLAG { + D3D10_ASYNC_GETDATA_DONOTFLUSH = 0x1, +} D3D10_ASYNC_GETDATA_FLAG; + +typedef enum D3D10_FILTER_TYPE { + D3D10_FILTER_TYPE_POINT, + D3D10_FILTER_TYPE_LINEAR +} D3D10_FILTER_TYPE; + +typedef enum D3D10_QUERY_MISC_FLAG { + D3D10_QUERY_MISC_PREDICATEHINT = 0x1 +} D3D10_QUERY_MISC_FLAG; + +typedef struct D3D10_QUERY_DATA_TIMESTAMP_DISJOINT { + UINT64 Frequency; + BOOL Disjoint; +} D3D10_QUERY_DATA_TIMESTAMP_DISJOINT; + +typedef struct D3D10_QUERY_DATA_PIPELINE_STATISTICS { + UINT64 IAVertices; + UINT64 IAPrimitives; + UINT64 VSInvocations; + UINT64 GSInvocations; + UINT64 GSPrimitives; + UINT64 CInvocations; + UINT64 CPrimitives; + UINT64 PSInvocations; +} D3D10_QUERY_DATA_PIPELINE_STATISTICS; + +typedef struct D3D10_QUERY_DATA_SO_STATISTICS { + UINT64 NumPrimitivesWritten; + UINT64 PrimitivesStorageNeeded; +} D3D10_QUERY_DATA_SO_STATISTICS; + +typedef enum D3D10_CREATE_DEVICE_FLAG { + D3D10_CREATE_DEVICE_SINGLETHREADED = 0x1, + D3D10_CREATE_DEVICE_DEBUG = 0x2, + D3D10_CREATE_DEVICE_SWITCH_TO_REF = 0x4, + D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS = 0x8, + D3D10_CREATE_DEVICE_ALLOW_NULL_FROM_MAP = 0x10, + D3D10_CREATE_DEVICE_BGRA_SUPPORT = 0x20, + D3D10_CREATE_DEVICE_STRICT_VALIDATION = 0x0200 +} D3D10_CREATE_DEVICE_FLAG; + +/* Core */ + +interface ID3D10Device; + +[ + object, + local, + uuid(9b7e4c00-342c-4106-a19f-4f2704f689f0) +] +interface ID3D10DeviceChild : IUnknown +{ + void GetDevice( + [out] ID3D10Device **ppDevice); + HRESULT GetPrivateData( + [in] REFGUID guid, + [in, out] UINT *pDataSize, + [out] void *pData); + HRESULT SetPrivateData( + [in] REFGUID guid, + [in] UINT DataSize, + [in] const void *pData); + HRESULT SetPrivateDataInterface( + [in] REFGUID guid, + [in] const IUnknown *pData); +} + +/* Resource */ + +[ + object, + local, + uuid(9b7e4c01-342c-4106-a19f-4f2704f689f0) +] +interface ID3D10Resource : ID3D10DeviceChild +{ + void GetType( + [out] D3D10_RESOURCE_DIMENSION *rType); + void SetEvictionPriority( + [in] UINT EvictionPriority); + UINT GetEvictionPriority(); +} + +[ + object, + local, + uuid(9b7e4c02-342c-4106-a19f-4f2704f689f0) +] +interface ID3D10Buffer : ID3D10Resource +{ + HRESULT Map( + [in] D3D10_MAP MapType, + [in] UINT MapFlags, + [out] void **ppData); + void Unmap(); + void GetDesc( + [out] D3D10_BUFFER_DESC *pDesc); +} + +[ + object, + local, + uuid(9b7e4c03-342c-4106-a19f-4f2704f689F0) +] +interface ID3D10Texture1D : ID3D10Resource +{ + HRESULT Map( + [in] UINT Subresource, + [in] D3D10_MAP MapType, + [in] UINT MapFlags, + [out] void **ppData); + void Unmap( + [in] UINT Subresource); + void GetDesc( + [out] D3D10_TEXTURE1D_DESC *pDesc); +} + +[ + object, + local, + uuid(9b7e4c04-342c-4106-a19f-4f2704f689F0) +] +interface ID3D10Texture2D : ID3D10Resource +{ + HRESULT Map( + [in] UINT Subresource, + [in] D3D10_MAP MapType, + [in] UINT MapFlags, + [out] D3D10_MAPPED_TEXTURE2D *pMappedTex2D); + void Unmap( + [in] UINT Subresource); + void GetDesc( + [out] D3D10_TEXTURE2D_DESC *pDesc); +} + +[ + object, + local, + uuid(9b7e4c05-342c-4106-a19f-4f2704f689F0) +] +interface ID3D10Texture3D : ID3D10Resource +{ + HRESULT Map( + [in] UINT Subresource, + [in] D3D10_MAP MapType, + [in] UINT MapFlags, + [out] D3D10_MAPPED_TEXTURE3D *pMappedTex3D); + void Unmap( + [in] UINT Subresource); + void GetDesc( + [out] D3D10_TEXTURE3D_DESC *pDesc); +} + +[ + object, + local, + uuid(c902b03f-60a7-49ba-9936-2a3ab37a7e33) +] +interface ID3D10View : ID3D10DeviceChild +{ + void GetResource( + [out] ID3D10Resource **ppResource); +} + +[ + object, + local, + uuid(9b7e4c09-342c-4106-a19f-4f2704f689f0) +] +interface ID3D10DepthStencilView : ID3D10View +{ + void GetDesc( + [out] D3D10_DEPTH_STENCIL_VIEW_DESC *pDesc); +} + + +[ + object, + local, + uuid(9b7e4c08-342c-4106-a19f-4f2704f689f0) +] +interface ID3D10RenderTargetView : ID3D10View +{ + void GetDesc( + [out] D3D10_RENDER_TARGET_VIEW_DESC *pDesc); +} + +[ + object, + local, + uuid(9b7e4c07-342c-4106-a19f-4f2704f689f0) +] +interface ID3D10ShaderResourceView : ID3D10View +{ + void GetDesc( + [out] D3D10_SHADER_RESOURCE_VIEW_DESC *pDesc); +} + +/* Resource End */ + +[ + object, + local, + uuid(edad8d19-8a35-4d6d-8566-2ea276cde161) +] +interface ID3D10BlendState : ID3D10DeviceChild +{ + void GetDesc( + [out] D3D10_BLEND_DESC *pDesc); +} + +[ + object, + local, + uuid(2b4b1cc8-a4ad-41f8-8322-ca86fc3ec675) +] +interface ID3D10DepthStencilState : ID3D10DeviceChild +{ + void GetDesc( + [out] D3D10_DEPTH_STENCIL_DESC *pDesc); +} + +[ + object, + local, + uuid(6316be88-54cd-4040-ab44-20461bc81f68) +] +interface ID3D10GeometryShader : ID3D10DeviceChild +{ +} + +[ + object, + local, + uuid(9b7e4c0b-342c-4106-a19f-4f2704f689f0) +] +interface ID3D10InputLayout : ID3D10DeviceChild +{ +} + +[ + object, + local, + uuid(4968b601-9d00-4cde-8346-8e7f675819b6) +] +interface ID3D10PixelShader : ID3D10DeviceChild +{ +} + +[ + object, + local, + uuid(a2a07292-89af-4345-be2e-c53d9fbb6e9f) +] +interface ID3D10RasterizerState : ID3D10DeviceChild +{ + void GetDesc( + [out] D3D10_RASTERIZER_DESC *pDesc); +} + +[ + object, + local, + uuid(9b7e4c0c-342c-4106-a19f-4f2704f689f0) +] +interface ID3D10SamplerState : ID3D10DeviceChild +{ + void GetDesc( + [out] D3D10_SAMPLER_DESC *pDesc); +} + +[ + object, + local, + uuid(9b7e4c0a-342c-4106-a19f-4f2704f689f0) +] +interface ID3D10VertexShader : ID3D10DeviceChild +{ +} + +[ + object, + local, + uuid(9b7e4c0d-342c-4106-a19f-4f2704f689f0) +] +interface ID3D10Asynchronous : ID3D10DeviceChild +{ + void Begin(); + void End(); + HRESULT GetData( + [out] void *pData, + [in] UINT DataSize, + [in] UINT GetDataFlags); + UINT GetDataSize(); +} + +[ + object, + local, + uuid(9b7e4c11-342c-4106-a19f-4f2704f689f0) +] +interface ID3D10Counter : ID3D10Asynchronous +{ + void GetDesc( + [out] D3D10_COUNTER_DESC *pDesc); +} + +[ + object, + local, + uuid(9b7e4C0e-342C-4106-a19f-4f2704f689f0) +] +interface ID3D10Query : ID3D10Asynchronous +{ + void GetDesc( + [out] D3D10_QUERY_DESC *pDesc); +} + +[ + object, + local, + uuid(9b7e4c10-342c-4106-a19f-4f2704f689f0) +] +interface ID3D10Predicate : ID3D10Query +{ +} + +[ + object, + local, + uuid(9b7e4c0f-342c-4106-a19f-4f2704f689f0) +] +interface ID3D10Device : IUnknown +{ + void VSSetConstantBuffers( + [in] UINT StartSlot, + [in] UINT NumBuffers, + [in] ID3D10Buffer *const *ppConstantBuffers); + void PSSetShaderResources( + [in] UINT StartSlot, + [in] UINT NumViews, + [in] ID3D10ShaderResourceView *const *ppShaderResourceViews); + void PSSetShader( + [in] ID3D10PixelShader *pPixelShader); + void PSSetSamplers( + [in] UINT StartSlot, + [in] UINT NumSamplers, + [in]ID3D10SamplerState *const *ppSamplers); + void VSSetShader( + [in] ID3D10VertexShader *pVertexShader); + void DrawIndexed( + [in] UINT IndexCount, + [in] UINT StartIndexLocation, + [in] INT BaseVertexLocation); + void Draw( + [in] UINT VertexCount, + [in] UINT StartVertexLocation); + void PSSetConstantBuffers( + [in] UINT StartSlot, + [in] UINT NumBuffers, + [in] ID3D10Buffer *const *ppConstantBuffers); + void IASetInputLayout( + [in] ID3D10InputLayout *pInputLayout); + void IASetVertexBuffers( + [in] UINT StartSlot, + [in] UINT NumBuffers, + [in] ID3D10Buffer *const *ppVertexBuffers, + [in] const UINT *pStrides, + [in] const UINT *pOffsets); + void IASetIndexBuffer( + [in] ID3D10Buffer *pIndexBuffer, + [in] DXGI_FORMAT Format, + [in] UINT Offset); + void DrawIndexedInstanced( + [in] UINT IndexCountPerInstance, + [in] UINT InstanceCount, + [in] UINT StartIndexLocation, + [in] INT BaseVertexLocation, + [in] UINT StartInstanceLocation); + void DrawInstanced( + [in] UINT VertexCountPerInstance, + [in] UINT InstanceCount, + [in] UINT StartVertexLocation, + [in] UINT StartInstanceLocation); + void GSSetConstantBuffers( + [in] UINT StartSlot, + [in] UINT NumBuffers, + [in] ID3D10Buffer *const *ppConstantBuffers); + void GSSetShader( + [in] ID3D10GeometryShader *pShader); + void IASetPrimitiveTopology( + [in] D3D10_PRIMITIVE_TOPOLOGY Topology); + void VSSetShaderResources( + [in] UINT StartSlot, + [in] UINT NumViews, + [in] ID3D10ShaderResourceView *const *ppShaderResourceViews); + void VSSetSamplers( + [in] UINT StartSlot, + [in] UINT NumSamplers, + [in] ID3D10SamplerState *const *ppSamplers); + void SetPredication( + [in] ID3D10Predicate *pPredicate, + [in] BOOL PredicateValue); + void GSSetShaderResources( + [in] UINT StartSlot, + [in] UINT NumViews, + [in] ID3D10ShaderResourceView * const *ppShaderResourceViews); + void GSSetSamplers( + [in] UINT StartSlot, + [in] UINT NumSamplers, + [in] ID3D10SamplerState *const *ppSamplers); + void OMSetRenderTargets( + [in] UINT NumViews, + [in] ID3D10RenderTargetView *const *ppRenderTargetViews, + [in] ID3D10DepthStencilView *pDepthStencilView); + void OMSetBlendState( + [in] ID3D10BlendState *pBlendState, + [in] const FLOAT BlendFactor[4], + [in] UINT SampleMask); + void OMSetDepthStencilState( + [in] ID3D10DepthStencilState *pDepthStencilState, + [in] UINT StencilRef); + void SOSetTargets( + [in] UINT NumBuffers, + [in] ID3D10Buffer *const *ppSOTargets, + [in] const UINT *pOffsets); + void DrawAuto(); + void RSSetState( + [in] ID3D10RasterizerState *pRasterizerState); + void RSSetViewports( + [in] UINT NumViewports, + [in] const D3D10_VIEWPORT *pViewports); + void RSSetScissorRects( + [in] UINT NumRects, + [in] const D3D10_RECT *pRects); + void CopySubresourceRegion( + [in] ID3D10Resource *pDstResource, + [in] UINT DstSubresource, + [in] UINT DstX, + [in] UINT DstY, + [in] UINT DstZ, + [in] ID3D10Resource *pSrcResource, + [in] UINT SrcSubresource, + [in] const D3D10_BOX *pSrcBox); + void CopyResource( + [in] ID3D10Resource *pDstResource, + [in] ID3D10Resource *pSrcResource); + void UpdateSubresource( + [in] ID3D10Resource *pDstResource, + [in] UINT DstSubresource, + [in] const D3D10_BOX *pDstBox, + [in] const void *pSrcData, + [in] UINT SrcRowPitch, + [in] UINT SrcDepthPitch); + void ClearRenderTargetView( + [in] ID3D10RenderTargetView *pRenderTargetView, + [in] const FLOAT ColorRGBA[4]); + void ClearDepthStencilView( + [in] ID3D10DepthStencilView *pDepthStencilView, + [in] UINT ClearFlags, + [in] FLOAT Depth, + [in] UINT8 Stencil); + void GenerateMips( + [in] ID3D10ShaderResourceView *pShaderResourceView); + void ResolveSubresource( + [in] ID3D10Resource *pDstResource, + [in] UINT DstSubresource, + [in] ID3D10Resource *pSrcResource, + [in] UINT SrcSubresource, + [in] DXGI_FORMAT Format); + void VSGetConstantBuffers( + [in] UINT StartSlot, + [in] UINT NumBuffers, + [out] ID3D10Buffer **ppConstantBuffers); + void PSGetShaderResources( + [in] UINT StartSlot, + [in] UINT NumViews, + [out] ID3D10ShaderResourceView **ppShaderResourceViews); + void PSGetShader( + [out] ID3D10PixelShader **ppPixelShader); + void PSGetSamplers( + [in] UINT StartSlot, + [in] UINT NumSamplers, + [out] ID3D10SamplerState **ppSamplers); + void VSGetShader( + [out] ID3D10VertexShader **ppVertexShader); + void PSGetConstantBuffers( + [in] UINT StartSlot, + [in] UINT NumBuffers, + [out] ID3D10Buffer **ppConstantBuffers); + void IAGetInputLayout( + [out] ID3D10InputLayout **ppInputLayout); + void IAGetVertexBuffers( + [in] UINT StartSlot, + [in] UINT NumBuffers, + [out] ID3D10Buffer **ppVertexBuffers, + [out] UINT *pStrides, + [out] UINT *pOffsets); + void IAGetIndexBuffer( + [out] ID3D10Buffer **pIndexBuffer, + [out] DXGI_FORMAT *Format, + [out] UINT *Offset); + void GSGetConstantBuffers( + [in] UINT StartSlot, + [in] UINT NumBuffers, + [out] ID3D10Buffer **ppConstantBuffers); + void GSGetShader( + [out] ID3D10GeometryShader **ppGeometryShader); + void IAGetPrimitiveTopology( + [out] D3D10_PRIMITIVE_TOPOLOGY *pTopology); + void VSGetShaderResources( + [in] UINT StartSlot, + [in] UINT NumViews, + [out] ID3D10ShaderResourceView **ppShaderResourceViews); + void VSGetSamplers( + [in] UINT StartSlot, + [in] UINT NumSamplers, + [out] ID3D10SamplerState **ppSamplers); + void GetPredication( + [out] ID3D10Predicate **ppPredicate, + [out] BOOL *pPredicateValue); + void GSGetShaderResources( + [in] UINT StartSlot, + [in] UINT NumViews, + [out] ID3D10ShaderResourceView **ppShaderResourceViews); + void GSGetSamplers( + [in] UINT StartSlot, + [in] UINT NumSamplers, + [out] ID3D10SamplerState **ppSamplers); + void OMGetRenderTargets( + [in] UINT NumViews, + [out] ID3D10RenderTargetView **ppRenderTargetViews, + [out] ID3D10DepthStencilView **ppDepthStencilView); + void OMGetBlendState( + [out] ID3D10BlendState **ppBlendState, + [out] FLOAT BlendFactor[4], + [out] UINT *pSampleMask); + void OMGetDepthStencilState( + [out] ID3D10DepthStencilState **ppDepthStencilState, + [out] UINT *pStencilRef); + void SOGetTargets( + [in] UINT NumBuffers, + [out] ID3D10Buffer **ppSOTargets, + [out] UINT *pOffsets); + void RSGetState( + [out] ID3D10RasterizerState **ppRasterizerState); + void RSGetViewports( + [in, out] UINT *NumViewports, + [out] D3D10_VIEWPORT *pViewports); + void RSGetScissorRects( + [in, out] UINT *NumRects, + [out] D3D10_RECT *pRects); + HRESULT GetDeviceRemovedReason(); + HRESULT SetExceptionMode( + [in] UINT RaiseFlags); + UINT GetExceptionMode(); + HRESULT GetPrivateData( + [in] REFGUID guid, + [in, out] UINT *pDataSize, + [out] void *pData); + HRESULT SetPrivateData( + [in] REFGUID guid, + [in] UINT DataSize, + [in] const void *pData); + HRESULT SetPrivateDataInterface( + [in] REFGUID guid, + [in] const IUnknown *pData); + void ClearState(); + void Flush(); + HRESULT CreateBuffer( + [in] const D3D10_BUFFER_DESC *pDesc, + [in] const D3D10_SUBRESOURCE_DATA *pInitialData, + [out] ID3D10Buffer **ppBuffer); + HRESULT CreateTexture1D( + [in] const D3D10_TEXTURE1D_DESC *pDesc, + [in] const D3D10_SUBRESOURCE_DATA *pInitialData, + [out] ID3D10Texture1D **ppTexture1D); + HRESULT CreateTexture2D( + [in] const D3D10_TEXTURE2D_DESC *pDesc, + [in] const D3D10_SUBRESOURCE_DATA *pInitialData, + [out] ID3D10Texture2D **ppTexture2D); + HRESULT CreateTexture3D( + [in] const D3D10_TEXTURE3D_DESC *pDesc, + [in] const D3D10_SUBRESOURCE_DATA *pInitialData, + [out] ID3D10Texture3D **ppTexture3D); + HRESULT CreateShaderResourceView( + [in] ID3D10Resource *pResource, + [in] const D3D10_SHADER_RESOURCE_VIEW_DESC *pDesc, + [out] ID3D10ShaderResourceView **ppSRView); + HRESULT CreateRenderTargetView( + [in] ID3D10Resource *pResource, + [in] const D3D10_RENDER_TARGET_VIEW_DESC *pDesc, + [out] ID3D10RenderTargetView **ppRTView); + HRESULT CreateDepthStencilView( + [in] ID3D10Resource *pResource, + [in] const D3D10_DEPTH_STENCIL_VIEW_DESC *pDesc, + [out] ID3D10DepthStencilView **ppDepthStencilView); + HRESULT CreateInputLayout( + [in] const D3D10_INPUT_ELEMENT_DESC *pInputElementDescs, + [in] UINT NumElements, + [in] const void *pShaderBytecodeWithInputSignature, + [in] SIZE_T BytecodeLength, + [out] ID3D10InputLayout **ppInputLayout); + HRESULT CreateVertexShader( + [in] const void *pShaderBytecode, + [in] SIZE_T BytecodeLength, + [out] ID3D10VertexShader **ppVertexShader); + HRESULT CreateGeometryShader( + [in] const void *pShaderBytecode, + [in] SIZE_T BytecodeLength, + [out] ID3D10GeometryShader **ppGeometryShader); + HRESULT CreateGeometryShaderWithStreamOutput( + [in] const void *pShaderBytecode, + [in] SIZE_T BytecodeLength, + [in] const D3D10_SO_DECLARATION_ENTRY *pSODeclaration, + [in] UINT NumEntries, + [in] UINT OutputStreamStride, + [out] ID3D10GeometryShader **ppGeometryShader); + HRESULT CreatePixelShader( + [in] const void *pShaderBytecode, + [in] SIZE_T BytecodeLength, + [out] ID3D10PixelShader **ppPixelShader); + HRESULT CreateBlendState( + [in] const D3D10_BLEND_DESC *pBlendStateDesc, + [out] ID3D10BlendState **ppBlendState); + HRESULT CreateDepthStencilState( + [in] const D3D10_DEPTH_STENCIL_DESC *pDepthStencilDesc, + [out] ID3D10DepthStencilState **ppDepthStencilState); + HRESULT CreateRasterizerState( + [in] const D3D10_RASTERIZER_DESC *pRasterizerDesc, + [out] ID3D10RasterizerState **ppRasterizerState); + HRESULT CreateSamplerState( + [in] const D3D10_SAMPLER_DESC *pSamplerDesc, + [out] ID3D10SamplerState **ppSamplerState); + HRESULT CreateQuery( + [in] const D3D10_QUERY_DESC *pQueryDesc, + [out] ID3D10Query **ppQuery); + HRESULT CreatePredicate( + [in] const D3D10_QUERY_DESC *pPredicateDesc, + [out] ID3D10Predicate **ppPredicate); + HRESULT CreateCounter( + [in] const D3D10_COUNTER_DESC *pCounterDesc, + [out] ID3D10Counter **ppCounter); + HRESULT CheckFormatSupport( + [in] DXGI_FORMAT Format, + [out] UINT *pFormatSupport); + HRESULT CheckMultisampleQualityLevels( + [in] DXGI_FORMAT Format, + [in] UINT SampleCount, + [out] UINT *pNumQualityLevels); + void CheckCounterInfo( + [out] D3D10_COUNTER_INFO *pCounterInfo); + HRESULT CheckCounter( + [in] const D3D10_COUNTER_DESC *pDesc, + [out] D3D10_COUNTER_TYPE *pType, + [out] UINT *pActiveCounters, + [out] LPSTR szName, + [in, out] UINT *pNameLength, + [out] LPSTR szUnits, + [in, out] UINT *pUnitsLength, + [out] LPSTR szDescription, + [in, out] UINT *pDescriptionLength); + UINT GetCreationFlags(); + HRESULT OpenSharedResource( + [in] HANDLE hResource, + [in] REFIID ReturnedInterface, + [out] void **ppResource); + void SetTextFilterSize( + [in] UINT Width, + [in] UINT Height); + void GetTextFilterSize( + [out] UINT *pWidth, + [out] UINT *pHeight); +} + +[ + object, + local, + uuid(9b7e4e00-342c-4106-a19f-4f2704f689f0) +] +interface ID3D10Multithread : IUnknown +{ + void Enter(); + void Leave(); + BOOL SetMultithreadProtected( + [in] BOOL bMTProtect); + BOOL GetMultithreadProtected(); +} + +cpp_quote("#ifndef D3D10_IGNORE_SDK_LAYERS") +cpp_quote("/* FIXME: # include */") +cpp_quote("#endif") +cpp_quote("#include \"d3d10misc.h\"") +cpp_quote("#include \"d3d10shader.h\"") +cpp_quote("#include \"d3d10effect.h\"") diff --git a/reactos/include/psdk/d3d10effect.h b/reactos/include/psdk/d3d10effect.h new file mode 100644 index 00000000000..521cd4b7fff --- /dev/null +++ b/reactos/include/psdk/d3d10effect.h @@ -0,0 +1,857 @@ +/* + * Copyright 2009 Henri Verbeet for CodeWeavers + * + * 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 + * + */ + +#ifndef __WINE_D3D10EFFECT_H +#define __WINE_D3D10EFFECT_H + +#include "d3d10.h" + +#define D3D10_EFFECT_VARIABLE_POOLED 0x1 +#define D3D10_EFFECT_VARIABLE_ANNOTATION 0x2 +#define D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT 0x4 + +#ifndef D3D10_BYTES_FROM_BITS +#define D3D10_BYTES_FROM_BITS(x) (((x) + 7) >> 3) +#endif + +typedef enum _D3D10_DEVICE_STATE_TYPES +{ + D3D10_DST_SO_BUFFERS = 1, + D3D10_DST_OM_RENDER_TARGETS, + D3D10_DST_DEPTH_STENCIL_STATE, + D3D10_DST_BLEND_STATE, + D3D10_DST_VS, + D3D10_DST_VS_SAMPLERS, + D3D10_DST_VS_SHADER_RESOURCES, + D3D10_DST_VS_CONSTANT_BUFFERS, + D3D10_DST_GS, + D3D10_DST_GS_SAMPLERS, + D3D10_DST_GS_SHADER_RESOURCES, + D3D10_DST_GS_CONSTANT_BUFFERS, + D3D10_DST_PS, + D3D10_DST_PS_SAMPLERS, + D3D10_DST_PS_SHADER_RESOURCES, + D3D10_DST_PS_CONSTANT_BUFFERS, + D3D10_DST_IA_VERTEX_BUFFERS, + D3D10_DST_IA_INDEX_BUFFER, + D3D10_DST_IA_INPUT_LAYOUT, + D3D10_DST_IA_PRIMITIVE_TOPOLOGY, + D3D10_DST_RS_VIEWPORTS, + D3D10_DST_RS_SCISSOR_RECTS, + D3D10_DST_RS_RASTERIZER_STATE, + D3D10_DST_PREDICATION, +} D3D10_DEVICE_STATE_TYPES; + +typedef struct _D3D10_EFFECT_TYPE_DESC +{ + LPCSTR TypeName; + D3D10_SHADER_VARIABLE_CLASS Class; + D3D10_SHADER_VARIABLE_TYPE Type; + UINT Elements; + UINT Members; + UINT Rows; + UINT Columns; + UINT PackedSize; + UINT UnpackedSize; + UINT Stride; +} D3D10_EFFECT_TYPE_DESC; + +typedef struct _D3D10_EFFECT_VARIABLE_DESC +{ + LPCSTR Name; + LPCSTR Semantic; + UINT Flags; + UINT Annotations; + UINT BufferOffset; + UINT ExplicitBindPoint; +} D3D10_EFFECT_VARIABLE_DESC; + +typedef struct _D3D10_TECHNIQUE_DESC +{ + LPCSTR Name; + UINT Passes; + UINT Annotations; +} D3D10_TECHNIQUE_DESC; + +typedef struct _D3D10_STATE_BLOCK_MASK +{ + BYTE VS; + BYTE VSSamplers[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT)]; + BYTE VSShaderResources[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT)]; + BYTE VSConstantBuffers[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT)]; + BYTE GS; + BYTE GSSamplers[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT)]; + BYTE GSShaderResources[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT)]; + BYTE GSConstantBuffers[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT)]; + BYTE PS; + BYTE PSSamplers[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT)]; + BYTE PSShaderResources[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT)]; + BYTE PSConstantBuffers[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT)]; + BYTE IAVertexBuffers[D3D10_BYTES_FROM_BITS(D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT)]; + BYTE IAIndexBuffer; + BYTE IAInputLayout; + BYTE IAPrimitiveTopology; + BYTE OMRenderTargets; + BYTE OMDepthStencilState; + BYTE OMBlendState; + BYTE RSViewports; + BYTE RSScissorRects; + BYTE RSRasterizerState; + BYTE SOBuffers; + BYTE Predication; +} D3D10_STATE_BLOCK_MASK; + +typedef struct _D3D10_EFFECT_DESC +{ + BOOL IsChildEffect; + UINT ConstantBuffers; + UINT SharedConstantBuffers; + UINT GlobalVariables; + UINT SharedGlobalVariables; + UINT Techniques; +} D3D10_EFFECT_DESC; + +typedef struct _D3D10_EFFECT_SHADER_DESC +{ + const BYTE *pInputSignature; + BOOL IsInline; + const BYTE *pBytecode; + UINT BytecodeLength; + LPCSTR SODecl; + UINT NumInputSignatureEntries; + UINT NumOutputSignatureEntries; +} D3D10_EFFECT_SHADER_DESC; + +typedef struct _D3D10_PASS_DESC +{ + LPCSTR Name; + UINT Annotations; + BYTE *pIAInputSignature; + SIZE_T IAInputSignatureSize; + UINT StencilRef; + UINT SampleMask; + FLOAT BlendFactor[4]; +} D3D10_PASS_DESC; + +typedef struct _D3D10_PASS_SHADER_DESC +{ + struct ID3D10EffectShaderVariable *pShaderVariable; + UINT ShaderIndex; +} D3D10_PASS_SHADER_DESC; + +#define D3D10_EFFECT_COMPILE_CHILD_EFFECT 0x0001 +#define D3D10_EFFECT_COMPILE_ALLOW_SLOW_OPS 0x0002 +#define D3D10_EFFECT_SINGLE_THREADED 0x0008 + +DEFINE_GUID(IID_ID3D10EffectType, 0x4e9e1ddc, 0xcd9d, 0x4772, 0xa8, 0x37, 0x00, 0x18, 0x0b, 0x9b, 0x88, 0xfd); + +#define INTERFACE ID3D10EffectType +DECLARE_INTERFACE(ID3D10EffectType) +{ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_TYPE_DESC *desc) PURE; + STDMETHOD_(struct ID3D10EffectType *, GetMemberTypeByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectType *, GetMemberTypeByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectType *, GetMemberTypeBySemantic)(THIS_ LPCSTR semantic) PURE; + STDMETHOD_(LPCSTR, GetMemberName)(THIS_ UINT index) PURE; + STDMETHOD_(LPCSTR, GetMemberSemantic)(THIS_ UINT index) PURE; +}; +#undef INTERFACE + +DEFINE_GUID(IID_ID3D10EffectVariable, 0xae897105, 0x00e6, 0x45bf, 0xbb, 0x8e, 0x28, 0x1d, 0xd6, 0xdb, 0x8e, 0x1b); + +#define INTERFACE ID3D10EffectVariable +DECLARE_INTERFACE(ID3D10EffectVariable) +{ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectType *, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *desc) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberBySemantic)(THIS_ LPCSTR semantic) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetElement)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectConstantBuffer *, GetParentConstantBuffer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectScalarVariable *, AsScalar)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectVectorVariable *, AsVector)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectMatrixVariable *, AsMatrix)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectStringVariable *, AsString)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectShaderResourceVariable *, AsShaderResource)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectRenderTargetViewVariable *, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectDepthStencilViewVariable *, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectConstantBuffer *, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectShaderVariable *, AsShader)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectBlendVariable *, AsBlend)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectDepthStencilVariable *, AsDepthStencil)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectRasterizerVariable *, AsRasterizer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectSamplerVariable *, AsSampler)(THIS) PURE; + STDMETHOD(SetRawValue)(THIS_ void *data, UINT offset, UINT count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *data, UINT offset, UINT count) PURE; +}; +#undef INTERFACE + +DEFINE_GUID(IID_ID3D10EffectConstantBuffer, 0x56648f4d, 0xcc8b, 0x4444, 0xa5, 0xad, 0xb5, 0xa3, 0xd7, 0x6e, 0x91, 0xb3); + +#define INTERFACE ID3D10EffectConstantBuffer +DECLARE_INTERFACE_(ID3D10EffectConstantBuffer, ID3D10EffectVariable) +{ + /* ID3D10EffectVariable methods */ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectType *, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *desc) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberBySemantic)(THIS_ LPCSTR semantic) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetElement)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectConstantBuffer *, GetParentConstantBuffer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectScalarVariable *, AsScalar)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectVectorVariable *, AsVector)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectMatrixVariable *, AsMatrix)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectStringVariable *, AsString)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectShaderResourceVariable *, AsShaderResource)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectRenderTargetViewVariable *, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectDepthStencilViewVariable *, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectConstantBuffer *, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectShaderVariable *, AsShader)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectBlendVariable *, AsBlend)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectDepthStencilVariable *, AsDepthStencil)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectRasterizerVariable *, AsRasterizer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectSamplerVariable *, AsSampler)(THIS) PURE; + STDMETHOD(SetRawValue)(THIS_ void *data, UINT offset, UINT count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *data, UINT offset, UINT count) PURE; + /* ID3D10EffectConstantBuffer methods */ + STDMETHOD(SetConstantBuffer)(THIS_ ID3D10Buffer *buffer) PURE; + STDMETHOD(GetConstantBuffer)(THIS_ ID3D10Buffer **buffer) PURE; + STDMETHOD(SetTextureBuffer)(THIS_ ID3D10ShaderResourceView *view) PURE; + STDMETHOD(GetTextureBuffer)(THIS_ ID3D10ShaderResourceView **view) PURE; +}; +#undef INTERFACE + +DEFINE_GUID(IID_ID3D10EffectScalarVariable, 0x00e48f7b, 0xd2c8, 0x49e8, 0xa8, 0x6c, 0x02, 0x2d, 0xee, 0x53, 0x43, 0x1f); + +#define INTERFACE ID3D10EffectScalarVariable +DECLARE_INTERFACE_(ID3D10EffectScalarVariable, ID3D10EffectVariable) +{ + /* ID3D10EffectVariable methods */ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectType *, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *desc) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberBySemantic)(THIS_ LPCSTR semantic) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetElement)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectConstantBuffer *, GetParentConstantBuffer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectScalarVariable *, AsScalar)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectVectorVariable *, AsVector)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectMatrixVariable *, AsMatrix)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectStringVariable *, AsString)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectShaderResourceVariable *, AsShaderResource)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectRenderTargetViewVariable *, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectDepthStencilViewVariable *, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectConstantBuffer *, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectShaderVariable *, AsShader)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectBlendVariable *, AsBlend)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectDepthStencilVariable *, AsDepthStencil)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectRasterizerVariable *, AsRasterizer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectSamplerVariable *, AsSampler)(THIS) PURE; + STDMETHOD(SetRawValue)(THIS_ void *data, UINT offset, UINT count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *data, UINT offset, UINT count) PURE; + /* ID3D10EffectScalarVariable methods */ + STDMETHOD(SetFloat)(THIS_ float value) PURE; + STDMETHOD(GetFloat)(THIS_ float *value) PURE; + STDMETHOD(SetFloatArray)(THIS_ float *values, UINT offset, UINT count) PURE; + STDMETHOD(GetFloatArray)(THIS_ float *values, UINT offset, UINT count) PURE; + STDMETHOD(SetInt)(THIS_ int value) PURE; + STDMETHOD(GetInt)(THIS_ int *value) PURE; + STDMETHOD(SetIntArray)(THIS_ int *values, UINT offset, UINT count) PURE; + STDMETHOD(GetIntArray)(THIS_ int *values, UINT offset, UINT count) PURE; + STDMETHOD(SetBool)(THIS_ BOOL value) PURE; + STDMETHOD(GetBool)(THIS_ BOOL *value) PURE; + STDMETHOD(SetBoolArray)(THIS_ BOOL *values, UINT offset, UINT count) PURE; + STDMETHOD(GetBoolArray)(THIS_ BOOL *values, UINT offset, UINT count) PURE; +}; +#undef INTERFACE + +DEFINE_GUID(IID_ID3D10EffectVectorVariable, 0x62b98c44, 0x1f82, 0x4c67, 0xbc, 0xd0, 0x72, 0xcf, 0x8f, 0x21, 0x7e, 0x81); + +#define INTERFACE ID3D10EffectVectorVariable +DECLARE_INTERFACE_(ID3D10EffectVectorVariable, ID3D10EffectVariable) +{ + /* ID3D10EffectVariable methods */ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectType *, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *desc) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberBySemantic)(THIS_ LPCSTR semantic) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetElement)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectConstantBuffer *, GetParentConstantBuffer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectScalarVariable *, AsScalar)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectVectorVariable *, AsVector)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectMatrixVariable *, AsMatrix)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectStringVariable *, AsString)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectShaderResourceVariable *, AsShaderResource)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectRenderTargetViewVariable *, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectDepthStencilViewVariable *, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectConstantBuffer *, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectShaderVariable *, AsShader)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectBlendVariable *, AsBlend)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectDepthStencilVariable *, AsDepthStencil)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectRasterizerVariable *, AsRasterizer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectSamplerVariable *, AsSampler)(THIS) PURE; + STDMETHOD(SetRawValue)(THIS_ void *data, UINT offset, UINT count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *data, UINT offset, UINT count) PURE; + /* ID3D10EffectVectorVariable methods */ + STDMETHOD(SetBoolVector)(THIS_ BOOL *value) PURE; + STDMETHOD(SetIntVector)(THIS_ int *value) PURE; + STDMETHOD(SetFloatVector)(THIS_ float *value) PURE; + STDMETHOD(GetBoolVector)(THIS_ BOOL *value) PURE; + STDMETHOD(GetIntVector)(THIS_ int *value) PURE; + STDMETHOD(GetFloatVector)(THIS_ float *value) PURE; + STDMETHOD(SetBoolVectorArray)(THIS_ BOOL *values, UINT offset, UINT count) PURE; + STDMETHOD(SetIntVectorArray)(THIS_ int *values, UINT offset, UINT count) PURE; + STDMETHOD(SetFloatVectorArray)(THIS_ float *values, UINT offset, UINT count) PURE; + STDMETHOD(GetBoolVectorArray)(THIS_ BOOL *values, UINT offset, UINT count) PURE; + STDMETHOD(GetIntVectorArray)(THIS_ int *values, UINT offset, UINT count) PURE; + STDMETHOD(GetFloatVectorArray)(THIS_ float *values, UINT offset, UINT count) PURE; +}; +#undef INTERFACE + +DEFINE_GUID(IID_ID3D10EffectMatrixVariable, 0x50666c24, 0xb82f, 0x4eed, 0xa1, 0x72, 0x5b, 0x6e, 0x7e, 0x85, 0x22, 0xe0); + +#define INTERFACE ID3D10EffectMatrixVariable +DECLARE_INTERFACE_(ID3D10EffectMatrixVariable, ID3D10EffectVariable) +{ + /* ID3D10EffectVariable methods */ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectType *, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *desc) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberBySemantic)(THIS_ LPCSTR semantic) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetElement)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectConstantBuffer *, GetParentConstantBuffer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectScalarVariable *, AsScalar)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectVectorVariable *, AsVector)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectMatrixVariable *, AsMatrix)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectStringVariable *, AsString)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectShaderResourceVariable *, AsShaderResource)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectRenderTargetViewVariable *, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectDepthStencilViewVariable *, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectConstantBuffer *, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectShaderVariable *, AsShader)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectBlendVariable *, AsBlend)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectDepthStencilVariable *, AsDepthStencil)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectRasterizerVariable *, AsRasterizer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectSamplerVariable *, AsSampler)(THIS) PURE; + STDMETHOD(SetRawValue)(THIS_ void *data, UINT offset, UINT count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *data, UINT offset, UINT count) PURE; + /* ID3D10EffectMatrixVariable methods */ + STDMETHOD(SetMatrix)(THIS_ float *data) PURE; + STDMETHOD(GetMatrix)(THIS_ float *data) PURE; + STDMETHOD(SetMatrixArray)(THIS_ float *data, UINT offset, UINT count) PURE; + STDMETHOD(GetMatrixArray)(THIS_ float *data, UINT offset, UINT count) PURE; + STDMETHOD(SetMatrixTranspose)(THIS_ float *data) PURE; + STDMETHOD(GetMatrixTranspose)(THIS_ float *data) PURE; + STDMETHOD(SetMatrixTransposeArray)(THIS_ float *data, UINT offset, UINT count) PURE; + STDMETHOD(GetMatrixTransposeArray)(THIS_ float *data, UINT offset, UINT count) PURE; +}; +#undef INTERFACE + +DEFINE_GUID(IID_ID3D10EffectStringVariable, 0x71417501, 0x8df9, 0x4e0a, 0xa7, 0x8a, 0x25, 0x5f, 0x97, 0x56, 0xba, 0xff); + +#define INTERFACE ID3D10EffectStringVariable +DECLARE_INTERFACE_(ID3D10EffectStringVariable, ID3D10EffectVariable) +{ + /* ID3D10EffectVariable methods */ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectType *, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *desc) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberBySemantic)(THIS_ LPCSTR semantic) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetElement)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectConstantBuffer *, GetParentConstantBuffer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectScalarVariable *, AsScalar)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectVectorVariable *, AsVector)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectMatrixVariable *, AsMatrix)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectStringVariable *, AsString)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectShaderResourceVariable *, AsShaderResource)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectRenderTargetViewVariable *, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectDepthStencilViewVariable *, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectConstantBuffer *, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectShaderVariable *, AsShader)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectBlendVariable *, AsBlend)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectDepthStencilVariable *, AsDepthStencil)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectRasterizerVariable *, AsRasterizer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectSamplerVariable *, AsSampler)(THIS) PURE; + STDMETHOD(SetRawValue)(THIS_ void *data, UINT offset, UINT count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *data, UINT offset, UINT count) PURE; + /* ID3D10EffectStringVariable methods */ + STDMETHOD(GetString)(THIS_ LPCSTR *str) PURE; + STDMETHOD(GetStringArray)(THIS_ LPCSTR *strs, UINT offset, UINT count) PURE; +}; +#undef INTERFACE + +DEFINE_GUID(IID_ID3D10EffectShaderResourceVariable, + 0xc0a7157b, 0xd872, 0x4b1d, 0x80, 0x73, 0xef, 0xc2, 0xac, 0xd4, 0xb1, 0xfc); + +#define INTERFACE ID3D10EffectShaderResourceVariable +DECLARE_INTERFACE_(ID3D10EffectShaderResourceVariable, ID3D10EffectVariable) +{ + /* ID3D10EffectVariable methods */ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectType *, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *desc) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberBySemantic)(THIS_ LPCSTR semantic) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetElement)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectConstantBuffer *, GetParentConstantBuffer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectScalarVariable *, AsScalar)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectVectorVariable *, AsVector)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectMatrixVariable *, AsMatrix)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectStringVariable *, AsString)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectShaderResourceVariable *, AsShaderResource)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectRenderTargetViewVariable *, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectDepthStencilViewVariable *, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectConstantBuffer *, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectShaderVariable *, AsShader)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectBlendVariable *, AsBlend)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectDepthStencilVariable *, AsDepthStencil)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectRasterizerVariable *, AsRasterizer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectSamplerVariable *, AsSampler)(THIS) PURE; + STDMETHOD(SetRawValue)(THIS_ void *data, UINT offset, UINT count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *data, UINT offset, UINT count) PURE; + /* ID3D10EffectShaderResourceVariable methods */ + STDMETHOD(SetResource)(THIS_ ID3D10ShaderResourceView *resource) PURE; + STDMETHOD(GetResource)(THIS_ ID3D10ShaderResourceView **resource) PURE; + STDMETHOD(SetResourceArray)(THIS_ ID3D10ShaderResourceView **resources, UINT offset, UINT count) PURE; + STDMETHOD(GetResourceArray)(THIS_ ID3D10ShaderResourceView **resources, UINT offset, UINT count) PURE; +}; +#undef INTERFACE + +DEFINE_GUID(IID_ID3D10EffectRenderTargetViewVariable, + 0x28ca0cc3, 0xc2c9, 0x40bb, 0xb5, 0x7f, 0x67, 0xb7, 0x37, 0x12, 0x2b, 0x17); + +#define INTERFACE ID3D10EffectRenderTargetViewVariable +DECLARE_INTERFACE_(ID3D10EffectRenderTargetViewVariable, ID3D10EffectVariable) +{ + /* ID3D10EffectVariable methods */ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectType *, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *desc) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberBySemantic)(THIS_ LPCSTR semantic) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetElement)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectConstantBuffer *, GetParentConstantBuffer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectScalarVariable *, AsScalar)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectVectorVariable *, AsVector)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectMatrixVariable *, AsMatrix)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectStringVariable *, AsString)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectShaderResourceVariable *, AsShaderResource)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectRenderTargetViewVariable *, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectDepthStencilViewVariable *, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectConstantBuffer *, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectShaderVariable *, AsShader)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectBlendVariable *, AsBlend)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectDepthStencilVariable *, AsDepthStencil)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectRasterizerVariable *, AsRasterizer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectSamplerVariable *, AsSampler)(THIS) PURE; + STDMETHOD(SetRawValue)(THIS_ void *data, UINT offset, UINT count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *data, UINT offset, UINT count) PURE; + /* ID3D10EffectRenderTargetViewVariable methods */ + STDMETHOD(SetRenderTarget)(THIS_ ID3D10RenderTargetView *view) PURE; + STDMETHOD(GetRenderTarget)(THIS_ ID3D10RenderTargetView **view) PURE; + STDMETHOD(SetRenderTargetArray)(THIS_ ID3D10RenderTargetView **views, UINT offset, UINT count) PURE; + STDMETHOD(GetRenderTargetArray)(THIS_ ID3D10RenderTargetView **views, UINT offset, UINT count) PURE; +}; +#undef INTERFACE + +DEFINE_GUID(IID_ID3D10EffectDepthStencilViewVariable, + 0x3e02c918, 0xcc79, 0x4985, 0xb6, 0x22, 0x2d, 0x92, 0xad, 0x70, 0x16, 0x23); + +#define INTERFACE ID3D10EffectDepthStencilViewVariable +DECLARE_INTERFACE_(ID3D10EffectDepthStencilViewVariable, ID3D10EffectVariable) +{ + /* ID3D10EffectVariable methods */ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectType *, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *desc) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberBySemantic)(THIS_ LPCSTR semantic) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetElement)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectConstantBuffer *, GetParentConstantBuffer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectScalarVariable *, AsScalar)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectVectorVariable *, AsVector)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectMatrixVariable *, AsMatrix)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectStringVariable *, AsString)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectShaderResourceVariable *, AsShaderResource)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectRenderTargetViewVariable *, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectDepthStencilViewVariable *, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectConstantBuffer *, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectShaderVariable *, AsShader)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectBlendVariable *, AsBlend)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectDepthStencilVariable *, AsDepthStencil)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectRasterizerVariable *, AsRasterizer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectSamplerVariable *, AsSampler)(THIS) PURE; + STDMETHOD(SetRawValue)(THIS_ void *data, UINT offset, UINT count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *data, UINT offset, UINT count) PURE; + /* ID3D10EffectDepthStencilViewVariable methods */ + STDMETHOD(SetDepthStencil)(THIS_ ID3D10DepthStencilView *view) PURE; + STDMETHOD(GetDepthStencil)(THIS_ ID3D10DepthStencilView **view) PURE; + STDMETHOD(SetDepthStencilArray)(THIS_ ID3D10DepthStencilView **views, UINT offset, UINT count) PURE; + STDMETHOD(GetDepthStencilArray)(THIS_ ID3D10DepthStencilView **views, UINT offset, UINT count) PURE; +}; +#undef INTERFACE + +DEFINE_GUID(IID_ID3D10EffectShaderVariable, 0x80849279, 0xc799, 0x4797, 0x8c, 0x33, 0x04, 0x07, 0xa0, 0x7d, 0x9e, 0x06); + +#define INTERFACE ID3D10EffectShaderVariable +DECLARE_INTERFACE_(ID3D10EffectShaderVariable, ID3D10EffectVariable) +{ + /* ID3D10EffectVariable methods */ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectType *, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *desc) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberBySemantic)(THIS_ LPCSTR semantic) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetElement)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectConstantBuffer *, GetParentConstantBuffer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectScalarVariable *, AsScalar)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectVectorVariable *, AsVector)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectMatrixVariable *, AsMatrix)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectStringVariable *, AsString)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectShaderResourceVariable *, AsShaderResource)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectRenderTargetViewVariable *, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectDepthStencilViewVariable *, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectConstantBuffer *, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectShaderVariable *, AsShader)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectBlendVariable *, AsBlend)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectDepthStencilVariable *, AsDepthStencil)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectRasterizerVariable *, AsRasterizer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectSamplerVariable *, AsSampler)(THIS) PURE; + STDMETHOD(SetRawValue)(THIS_ void *data, UINT offset, UINT count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *data, UINT offset, UINT count) PURE; + /* ID3D10EffectShaderVariable methods */ + STDMETHOD(GetShaderDesc)(THIS_ UINT index, D3D10_EFFECT_SHADER_DESC *desc) PURE; + STDMETHOD(GetVertexShader)(THIS_ UINT index, ID3D10VertexShader **shader) PURE; + STDMETHOD(GetGeometryShader)(THIS_ UINT index, ID3D10GeometryShader **shader) PURE; + STDMETHOD(GetPixelShader)(THIS_ UINT index, ID3D10PixelShader **shader) PURE; + STDMETHOD(GetInputSignatureElementDesc)(THIS_ UINT shader_index, UINT element_index, + D3D10_SIGNATURE_PARAMETER_DESC *desc) PURE; + STDMETHOD(GetOutputSignatureElementDesc)(THIS_ UINT shader_index, UINT element_index, + D3D10_SIGNATURE_PARAMETER_DESC *desc) PURE; +}; +#undef INTERFACE + +DEFINE_GUID(IID_ID3D10EffectBlendVariable, 0x1fcd2294, 0xdf6d, 0x4eae, 0x86, 0xb3, 0x0e, 0x91, 0x60, 0xcf, 0xb0, 0x7b); + +#define INTERFACE ID3D10EffectBlendVariable +DECLARE_INTERFACE_(ID3D10EffectBlendVariable, ID3D10EffectVariable) +{ + /* ID3D10EffectVariable methods */ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectType *, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *desc) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberBySemantic)(THIS_ LPCSTR semantic) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetElement)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectConstantBuffer *, GetParentConstantBuffer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectScalarVariable *, AsScalar)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectVectorVariable *, AsVector)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectMatrixVariable *, AsMatrix)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectStringVariable *, AsString)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectShaderResourceVariable *, AsShaderResource)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectRenderTargetViewVariable *, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectDepthStencilViewVariable *, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectConstantBuffer *, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectShaderVariable *, AsShader)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectBlendVariable *, AsBlend)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectDepthStencilVariable *, AsDepthStencil)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectRasterizerVariable *, AsRasterizer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectSamplerVariable *, AsSampler)(THIS) PURE; + STDMETHOD(SetRawValue)(THIS_ void *data, UINT offset, UINT count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *data, UINT offset, UINT count) PURE; + /* ID3D10EffectBlendVariable methods */ + STDMETHOD(GetBlendState)(THIS_ UINT index, ID3D10BlendState **blend_state) PURE; + STDMETHOD(GetBackingStore)(THIS_ UINT index, D3D10_BLEND_DESC *desc) PURE; +}; +#undef INTERFACE + +DEFINE_GUID(IID_ID3D10EffectDepthStencilVariable, + 0xaf482368, 0x330a, 0x46a5, 0x9a, 0x5c, 0x01, 0xc7, 0x1a, 0xf2, 0x4c, 0x8d); + +#define INTERFACE ID3D10EffectDepthStencilVariable +DECLARE_INTERFACE_(ID3D10EffectDepthStencilVariable, ID3D10EffectVariable) +{ + /* ID3D10EffectVariable methods */ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectType *, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *desc) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberBySemantic)(THIS_ LPCSTR semantic) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetElement)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectConstantBuffer *, GetParentConstantBuffer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectScalarVariable *, AsScalar)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectVectorVariable *, AsVector)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectMatrixVariable *, AsMatrix)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectStringVariable *, AsString)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectShaderResourceVariable *, AsShaderResource)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectRenderTargetViewVariable *, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectDepthStencilViewVariable *, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectConstantBuffer *, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectShaderVariable *, AsShader)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectBlendVariable *, AsBlend)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectDepthStencilVariable *, AsDepthStencil)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectRasterizerVariable *, AsRasterizer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectSamplerVariable *, AsSampler)(THIS) PURE; + STDMETHOD(SetRawValue)(THIS_ void *data, UINT offset, UINT count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *data, UINT offset, UINT count) PURE; + /* ID3D10EffectDepthStencilVariable methods */ + STDMETHOD(GetDepthStencilState)(THIS_ UINT index, ID3D10DepthStencilState **depth_stencil_state) PURE; + STDMETHOD(GetBackingStore)(THIS_ UINT index, D3D10_DEPTH_STENCIL_DESC *desc) PURE; +}; +#undef INTERFACE + +DEFINE_GUID(IID_ID3D10EffectRasterizerVariable, + 0x21af9f0e, 0x4d94, 0x4ea9, 0x97, 0x85, 0x2c, 0xb7, 0x6b, 0x8c, 0x0b, 0x34); + +#define INTERFACE ID3D10EffectRasterizerVariable +DECLARE_INTERFACE_(ID3D10EffectRasterizerVariable, ID3D10EffectVariable) +{ + /* ID3D10EffectVariable methods */ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectType *, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *desc) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberBySemantic)(THIS_ LPCSTR semantic) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetElement)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectConstantBuffer *, GetParentConstantBuffer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectScalarVariable *, AsScalar)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectVectorVariable *, AsVector)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectMatrixVariable *, AsMatrix)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectStringVariable *, AsString)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectShaderResourceVariable *, AsShaderResource)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectRenderTargetViewVariable *, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectDepthStencilViewVariable *, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectConstantBuffer *, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectShaderVariable *, AsShader)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectBlendVariable *, AsBlend)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectDepthStencilVariable *, AsDepthStencil)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectRasterizerVariable *, AsRasterizer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectSamplerVariable *, AsSampler)(THIS) PURE; + STDMETHOD(SetRawValue)(THIS_ void *data, UINT offset, UINT count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *data, UINT offset, UINT count) PURE; + /* ID3D10EffectRasterizerVariable methods */ + STDMETHOD(GetRasterizerState)(THIS_ UINT index, ID3D10RasterizerState **rasterizer_state) PURE; + STDMETHOD(GetBackingStore)(THIS_ UINT index, D3D10_RASTERIZER_DESC *desc) PURE; +}; +#undef INTERFACE + +DEFINE_GUID(IID_ID3D10EffectSamplerVariable, + 0x6530d5c7, 0x07e9, 0x4271, 0xa4, 0x18, 0xe7, 0xce, 0x4b, 0xd1, 0xe4, 0x80); + +#define INTERFACE ID3D10EffectSamplerVariable +DECLARE_INTERFACE_(ID3D10EffectSamplerVariable, ID3D10EffectVariable) +{ + /* ID3D10EffectVariable methods */ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectType *, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *desc) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetMemberBySemantic)(THIS_ LPCSTR semantic) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetElement)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectConstantBuffer *, GetParentConstantBuffer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectScalarVariable *, AsScalar)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectVectorVariable *, AsVector)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectMatrixVariable *, AsMatrix)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectStringVariable *, AsString)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectShaderResourceVariable *, AsShaderResource)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectRenderTargetViewVariable *, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectDepthStencilViewVariable *, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectConstantBuffer *, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectShaderVariable *, AsShader)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectBlendVariable *, AsBlend)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectDepthStencilVariable *, AsDepthStencil)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectRasterizerVariable *, AsRasterizer)(THIS) PURE; + STDMETHOD_(struct ID3D10EffectSamplerVariable *, AsSampler)(THIS) PURE; + STDMETHOD(SetRawValue)(THIS_ void *data, UINT offset, UINT count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *data, UINT offset, UINT count) PURE; + /* ID3D10EffectSamplerVariable methods */ + STDMETHOD(GetSampler)(THIS_ UINT index, ID3D10SamplerState **sampler) PURE; + STDMETHOD(GetBackingStore)(THIS_ UINT index, D3D10_SAMPLER_DESC *desc) PURE; +}; +#undef INTERFACE + +DEFINE_GUID(IID_ID3D10EffectTechnique, 0xdb122ce8, 0xd1c9, 0x4292, 0xb2, 0x37, 0x24, 0xed, 0x3d, 0xe8, 0xb1, 0x75); + +#define INTERFACE ID3D10EffectTechnique +DECLARE_INTERFACE(ID3D10EffectTechnique) +{ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_TECHNIQUE_DESC *desc) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectPass *, GetPassByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectPass *, GetPassByName)(THIS_ LPCSTR name) PURE; + STDMETHOD(ComputeStateBlockMask)(THIS_ D3D10_STATE_BLOCK_MASK *mask) PURE; +}; +#undef INTERFACE + +DEFINE_GUID(IID_ID3D10Effect, 0x51b0ca8b, 0xec0b, 0x4519, 0x87, 0x0d, 0x8e, 0xe1, 0xcb, 0x50, 0x17, 0xc7); + +#define INTERFACE ID3D10Effect +DECLARE_INTERFACE_(ID3D10Effect, IUnknown) +{ + /* IUnknown methods */ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID *object) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + /* ID3D10Effect methods */ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(BOOL, IsPool)(THIS) PURE; + STDMETHOD(GetDevice)(THIS_ ID3D10Device **device) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_DESC *desc) PURE; + STDMETHOD_(struct ID3D10EffectConstantBuffer *, GetConstantBufferByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectConstantBuffer *, GetConstantBufferByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetVariableByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetVariableByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetVariableBySemantic)(THIS_ LPCSTR semantic) PURE; + STDMETHOD_(struct ID3D10EffectTechnique *, GetTechniqueByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectTechnique *, GetTechniqueByName)(THIS_ LPCSTR name) PURE; + STDMETHOD(Optimize)(THIS) PURE; + STDMETHOD_(BOOL, IsOptimized)(THIS) PURE; +}; +#undef INTERFACE + +DEFINE_GUID(IID_ID3D10EffectPool, 0x9537ab04, 0x3250, 0x412e, 0x82, 0x13, 0xfc, 0xd2, 0xf8, 0x67, 0x79, 0x33); + +#define INTERFACE ID3D10EffectPool +DECLARE_INTERFACE_(ID3D10EffectPool, IUnknown) +{ + /* IUnknown methods */ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID *object) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + /* ID3D10EffectPool methods */ + STDMETHOD_(struct ID3D10Effect *, AsEffect)(THIS) PURE; +}; +#undef INTERFACE + +DEFINE_GUID(IID_ID3D10EffectPass, 0x5cfbeb89, 0x1a06, 0x46e0, 0xb2, 0x82, 0xe3, 0xf9, 0xbf, 0xa3, 0x6a, 0x54); + +#define INTERFACE ID3D10EffectPass +DECLARE_INTERFACE(ID3D10EffectPass) +{ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_PASS_DESC *desc) PURE; + STDMETHOD(GetVertexShaderDesc)(THIS_ D3D10_PASS_SHADER_DESC *desc) PURE; + STDMETHOD(GetGeometryShaderDesc)(THIS_ D3D10_PASS_SHADER_DESC *desc) PURE; + STDMETHOD(GetPixelShaderDesc)(THIS_ D3D10_PASS_SHADER_DESC *desc) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10EffectVariable *, GetAnnotationByName)(THIS_ LPCSTR name) PURE; + STDMETHOD(Apply)(THIS_ UINT flags) PURE; + STDMETHOD(ComputeStateBlockMask)(THIS_ D3D10_STATE_BLOCK_MASK *mask) PURE; +}; +#undef INTERFACE + +DEFINE_GUID(IID_ID3D10StateBlock, 0x0803425a, 0x57f5, 0x4dd6, 0x94, 0x65, 0xa8, 0x75, 0x70, 0x83, 0x4a, 0x08); + +#define INTERFACE ID3D10StateBlock +DECLARE_INTERFACE_(ID3D10StateBlock, IUnknown) +{ + /* IUnknown methods */ + STDMETHOD(QueryInterface)(THIS_ REFIID iid, void **object) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + /* ID3D10StateBlock methods */ + STDMETHOD(Capture)(THIS) PURE; + STDMETHOD(Apply)(THIS) PURE; + STDMETHOD(ReleaseAllDeviceObjects)(THIS) PURE; + STDMETHOD(GetDevice)(THIS_ ID3D10Device **device) PURE; +}; +#undef INTERFACE + +#ifdef __cplusplus +extern "C" { +#endif + +HRESULT WINAPI D3D10CompileEffectFromMemory(void *data, SIZE_T data_size, const char *filename, + const D3D10_SHADER_MACRO *defines, ID3D10Include *include, UINT hlsl_flags, UINT fx_flags, + ID3D10Blob **effect, ID3D10Blob **errors); +HRESULT WINAPI D3D10CreateEffectFromMemory(void *data, SIZE_T data_size, UINT flags, + ID3D10Device *device, ID3D10EffectPool *effect_pool, ID3D10Effect **effect); +HRESULT WINAPI D3D10CreateStateBlock(ID3D10Device *device, + D3D10_STATE_BLOCK_MASK *mask, ID3D10StateBlock **stateblock); + +HRESULT WINAPI D3D10StateBlockMaskDifference(D3D10_STATE_BLOCK_MASK *mask_x, + D3D10_STATE_BLOCK_MASK *mask_y, D3D10_STATE_BLOCK_MASK *result); +HRESULT WINAPI D3D10StateBlockMaskDisableAll(D3D10_STATE_BLOCK_MASK *mask); +HRESULT WINAPI D3D10StateBlockMaskDisableCapture(D3D10_STATE_BLOCK_MASK *mask, + D3D10_DEVICE_STATE_TYPES state_type, UINT start_idx, UINT count); +HRESULT WINAPI D3D10StateBlockMaskEnableAll(D3D10_STATE_BLOCK_MASK *mask); +HRESULT WINAPI D3D10StateBlockMaskEnableCapture(D3D10_STATE_BLOCK_MASK *mask, + D3D10_DEVICE_STATE_TYPES state_type, UINT start_idx, UINT count); +BOOL WINAPI D3D10StateBlockMaskGetSetting(D3D10_STATE_BLOCK_MASK *mask, + D3D10_DEVICE_STATE_TYPES state_type, UINT idx); +HRESULT WINAPI D3D10StateBlockMaskIntersect(D3D10_STATE_BLOCK_MASK *mask_x, + D3D10_STATE_BLOCK_MASK *mask_y, D3D10_STATE_BLOCK_MASK *result); +HRESULT WINAPI D3D10StateBlockMaskUnion(D3D10_STATE_BLOCK_MASK *mask_x, + D3D10_STATE_BLOCK_MASK *mask_y, D3D10_STATE_BLOCK_MASK *result); + +#ifdef __cplusplus +} +#endif + +#endif /* __WINE_D3D10EFFECT_H */ diff --git a/reactos/include/psdk/d3d10misc.h b/reactos/include/psdk/d3d10misc.h new file mode 100644 index 00000000000..9f7f8e97c8b --- /dev/null +++ b/reactos/include/psdk/d3d10misc.h @@ -0,0 +1,48 @@ +/* + * Copyright 2008 Henri Verbeet for CodeWeavers + * + * 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 + */ + +#ifndef __D3D10MISC_H__ +#define __D3D10MISC_H__ + +#include "d3d10.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum D3D10_DRIVER_TYPE { + D3D10_DRIVER_TYPE_HARDWARE = 0, + D3D10_DRIVER_TYPE_REFERENCE = 1, + D3D10_DRIVER_TYPE_NULL = 2, + D3D10_DRIVER_TYPE_SOFTWARE = 3, +} D3D10_DRIVER_TYPE; + +HRESULT WINAPI D3D10CreateDevice(IDXGIAdapter *adapter, D3D10_DRIVER_TYPE driver_type, + HMODULE swrast, UINT flags, UINT sdk_version, ID3D10Device **device); + +HRESULT WINAPI D3D10CreateDeviceAndSwapChain(IDXGIAdapter *adapter, D3D10_DRIVER_TYPE driver_type, + HMODULE swrast, UINT flags, UINT sdk_version, DXGI_SWAP_CHAIN_DESC *swapchain_desc, + IDXGISwapChain **swapchain, ID3D10Device **device); + +HRESULT WINAPI D3D10CreateBlob(SIZE_T data_size, ID3D10Blob **blob); + +#ifdef __cplusplus +} +#endif + +#endif /* __D3D10MISC_H__ */ diff --git a/reactos/include/psdk/d3d10shader.h b/reactos/include/psdk/d3d10shader.h new file mode 100644 index 00000000000..06b4c3ea2e8 --- /dev/null +++ b/reactos/include/psdk/d3d10shader.h @@ -0,0 +1,233 @@ +/* + * Copyright 2009 Henri Verbeet for CodeWeavers + * + * 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 + * + */ + +#ifndef __WINE_D3D10SHADER_H +#define __WINE_D3D10SHADER_H + +#include "d3d10.h" + +#define D3D10_SHADER_DEBUG 0x0001 +#define D3D10_SHADER_SKIP_VALIDATION 0x0002 +#define D3D10_SHADER_SKIP_OPTIMIZATION 0x0004 +#define D3D10_SHADER_PACK_MATRIX_ROW_MAJOR 0x0008 +#define D3D10_SHADER_PACK_MATRIX_COLUMN_MAJOR 0x0010 +#define D3D10_SHADER_PARTIAL_PRECISION 0x0020 +#define D3D10_SHADER_FORCE_VS_SOFTWARE_NO_OPT 0x0040 +#define D3D10_SHADER_FORCE_PS_SOFTWARE_NO_OPT 0x0080 +#define D3D10_SHADER_NO_PRESHADER 0x0100 +#define D3D10_SHADER_AVOID_FLOW_CONTROL 0x0200 +#define D3D10_SHADER_PREFER_FLOW_CONTROL 0x0400 +#define D3D10_SHADER_ENABLE_STRICTNESS 0x0800 +#define D3D10_SHADER_ENABLE_BACKWARDS_COMPATIBILITY 0x1000 +#define D3D10_SHADER_IEEE_STRICTNESS 0x2000 +#define D3D10_SHADER_WARNINGS_ARE_ERRORS 0x40000 + +#define D3D10_SHADER_OPTIMIZATION_LEVEL0 0x4000 +#define D3D10_SHADER_OPTIMIZATION_LEVEL1 0x0000 +#define D3D10_SHADER_OPTIMIZATION_LEVEL2 0xC000 +#define D3D10_SHADER_OPTIMIZATION_LEVEL3 0x8000 + +/* These are defined as version-neutral in d3dcommon.h */ +typedef D3D_SHADER_MACRO D3D10_SHADER_MACRO; +typedef D3D_SHADER_MACRO *LPD3D10_SHADER_MACRO; + +typedef D3D_SHADER_VARIABLE_CLASS D3D10_SHADER_VARIABLE_CLASS; +typedef D3D_SHADER_VARIABLE_CLASS *LPD3D10_SHADER_VARIABLE_CLASS; + +typedef D3D_CBUFFER_TYPE D3D10_CBUFFER_TYPE; +typedef D3D_CBUFFER_TYPE *LPD3D10_CBUFFER_TYPE; + +typedef D3D_REGISTER_COMPONENT_TYPE D3D10_REGISTER_COMPONENT_TYPE; + +typedef D3D_RESOURCE_RETURN_TYPE D3D10_RESOURCE_RETURN_TYPE; + +typedef D3D_NAME D3D10_NAME; + +typedef D3D_SHADER_INPUT_TYPE D3D10_SHADER_INPUT_TYPE; +typedef D3D_SHADER_INPUT_TYPE *LPD3D10_SHADER_INPUT_TYPE; + +typedef D3D_SHADER_VARIABLE_TYPE D3D10_SHADER_VARIABLE_TYPE; +typedef D3D_SHADER_VARIABLE_TYPE *LPD3D10_SHADER_VARIABLE_TYPE; + +typedef D3D_INCLUDE_TYPE D3D10_INCLUDE_TYPE; +typedef ID3DInclude ID3D10Include; +typedef ID3DInclude *LPD3D10INCLUDE; +#define IID_ID3D10Include IID_ID3DInclude + +typedef struct _D3D10_SHADER_INPUT_BIND_DESC +{ + LPCSTR Name; + D3D10_SHADER_INPUT_TYPE Type; + UINT BindPoint; + UINT BindCount; + UINT uFlags; + D3D10_RESOURCE_RETURN_TYPE ReturnType; + D3D10_SRV_DIMENSION Dimension; + UINT NumSamples; +} D3D10_SHADER_INPUT_BIND_DESC; + +typedef struct _D3D10_SIGNATURE_PARAMETER_DESC +{ + LPCSTR SemanticName; + UINT SemanticIndex; + UINT Register; + D3D10_NAME SystemValueType; + D3D10_REGISTER_COMPONENT_TYPE ComponentType; + BYTE Mask; + BYTE ReadWriteMask; +} D3D10_SIGNATURE_PARAMETER_DESC; + +typedef struct _D3D10_SHADER_DESC +{ + UINT Version; + LPCSTR Creator; + UINT Flags; + UINT ConstantBuffers; + UINT BoundResources; + UINT InputParameters; + UINT OutputParameters; + UINT InstructionCount; + UINT TempRegisterCount; + UINT TempArrayCount; + UINT DefCount; + UINT DclCount; + UINT TextureNormalInstructions; + UINT TextureLoadInstructions; + UINT TextureCompInstructions; + UINT TextureBiasInstructions; + UINT TextureGradientInstructions; + UINT FloatInstructionCount; + UINT IntInstructionCount; + UINT UintInstructionCount; + UINT StaticFlowControlCount; + UINT DynamicFlowControlCount; + UINT MacroInstructionCount; + UINT ArrayInstructionCount; + UINT CutInstructionCount; + UINT EmitInstructionCount; + D3D10_PRIMITIVE_TOPOLOGY GSOutputTopology; + UINT GSMaxOutputVertexCount; +} D3D10_SHADER_DESC; + +typedef struct _D3D10_SHADER_BUFFER_DESC +{ + LPCSTR Name; + D3D10_CBUFFER_TYPE Type; + UINT Variables; + UINT Size; + UINT uFlags; +} D3D10_SHADER_BUFFER_DESC; + +typedef struct _D3D10_SHADER_VARIABLE_DESC +{ + LPCSTR Name; + UINT StartOffset; + UINT Size; + UINT uFlags; + LPVOID DefaultValue; +} D3D10_SHADER_VARIABLE_DESC; + +typedef struct _D3D10_SHADER_TYPE_DESC +{ + D3D10_SHADER_VARIABLE_CLASS Class; + D3D10_SHADER_VARIABLE_TYPE Type; + UINT Rows; + UINT Columns; + UINT Elements; + UINT Members; + UINT Offset; +} D3D10_SHADER_TYPE_DESC; + +DEFINE_GUID(IID_ID3D10ShaderReflectionType, 0xc530ad7d, 0x9b16, 0x4395, 0xa9, 0x79, 0xba, 0x2e, 0xcf, 0xf8, 0x3a, 0xdd); + +#define INTERFACE ID3D10ShaderReflectionType +DECLARE_INTERFACE(ID3D10ShaderReflectionType) +{ + STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_TYPE_DESC *desc) PURE; + STDMETHOD_(struct ID3D10ShaderReflectionType *, GetMemberTypeByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10ShaderReflectionType *, GetMemberTypeByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(LPCSTR, GetMemberTypeName)(THIS_ UINT index) PURE; +}; +#undef INTERFACE + +DEFINE_GUID(IID_ID3D10ShaderReflectionVariable, 0x1bf63c95, 0x2650, 0x405d, 0x99, 0xc1, 0x36, 0x36, 0xbd, 0x1d, 0xa0, 0xa1); + +#define INTERFACE ID3D10ShaderReflectionVariable +DECLARE_INTERFACE(ID3D10ShaderReflectionVariable) +{ + STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_VARIABLE_DESC *desc) PURE; + STDMETHOD_(struct ID3D10ShaderReflectionType *, GetType)(THIS) PURE; +}; +#undef INTERFACE + +DEFINE_GUID(IID_ID3D10ShaderReflectionConstantBuffer, 0x66c66a94, 0xdddd, 0x4b62, 0xa6, 0x6a, 0xf0, 0xda, 0x33, 0xc2, 0xb4, 0xd0); + +#define INTERFACE ID3D10ShaderReflectionConstantBuffer +DECLARE_INTERFACE(ID3D10ShaderReflectionConstantBuffer) +{ + STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_BUFFER_DESC *desc) PURE; + STDMETHOD_(struct ID3D10ShaderReflectionVariable *, GetVariableByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10ShaderReflectionVariable *, GetVariableByName)(THIS_ LPCSTR name) PURE; +}; +#undef INTERFACE + +DEFINE_GUID(IID_ID3D10ShaderReflection, 0xd40e20b6, 0xf8f7, 0x42ad, 0xab, 0x20, 0x4b, 0xaf, 0x8f, 0x15, 0xdf, 0xaa); + +#define INTERFACE ID3D10ShaderReflection +DECLARE_INTERFACE_(ID3D10ShaderReflection, IUnknown) +{ + /* IUnknown methods */ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID *object) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + /* ID3D10ShaderReflection methods */ + STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_DESC *desc) PURE; + STDMETHOD_(struct ID3D10ShaderReflectionConstantBuffer *, GetConstantBufferByIndex)(THIS_ UINT index) PURE; + STDMETHOD_(struct ID3D10ShaderReflectionConstantBuffer *, GetConstantBufferByName)(THIS_ LPCSTR name) PURE; + STDMETHOD(GetResourceBindingDesc)(THIS_ UINT index, D3D10_SHADER_INPUT_BIND_DESC *desc) PURE; + STDMETHOD(GetInputParameterDesc)(THIS_ UINT index, D3D10_SIGNATURE_PARAMETER_DESC *desc) PURE; + STDMETHOD(GetOutputParameterDesc)(THIS_ UINT index, D3D10_SIGNATURE_PARAMETER_DESC *desc) PURE; +}; +#undef INTERFACE + + +#ifdef __cplusplus +extern "C" { +#endif + +HRESULT WINAPI D3D10CompileShader(LPCSTR data, SIZE_T data_size, LPCSTR filename, + const D3D10_SHADER_MACRO *defines, ID3D10Include *include, LPCSTR entrypoint, + LPCSTR profile, UINT flags, ID3D10Blob **shader, ID3D10Blob **error_messages); +HRESULT WINAPI D3D10DisassembleShader(const void *data, SIZE_T data_size, + BOOL color_code, const char *comments, ID3D10Blob **disassembly); +LPCSTR WINAPI D3D10GetVertexShaderProfile(ID3D10Device *device); +LPCSTR WINAPI D3D10GetGeometryShaderProfile(ID3D10Device *device); +LPCSTR WINAPI D3D10GetPixelShaderProfile(ID3D10Device *device); + +HRESULT WINAPI D3D10ReflectShader(const void *data, SIZE_T data_size, ID3D10ShaderReflection **reflector); +HRESULT WINAPI D3D10GetInputSignatureBlob(const void *data, SIZE_T data_size, ID3D10Blob **blob); +HRESULT WINAPI D3D10GetOutputSignatureBlob(const void *data, SIZE_T data_size, ID3D10Blob **blob); +HRESULT WINAPI D3D10GetInputAndOutputSignatureBlob(const void *data, SIZE_T data_size, ID3D10Blob **blob); +HRESULT WINAPI D3D10GetShaderDebugInfo(const void *data, SIZE_T data_size, ID3D10Blob **blob); + +#ifdef __cplusplus +} +#endif + +#endif /* __WINE_D3D10SHADER_H */ diff --git a/reactos/include/psdk/d3dcommon.idl b/reactos/include/psdk/d3dcommon.idl new file mode 100644 index 00000000000..76f66f582b1 --- /dev/null +++ b/reactos/include/psdk/d3dcommon.idl @@ -0,0 +1,620 @@ +/* + * Copyright 2010 Matteo Bruni for CodeWeavers + * + * 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 + */ + +import "oaidl.idl"; +import "ocidl.idl"; + +typedef struct _D3D_SHADER_MACRO +{ + LPCSTR Name; + LPCSTR Definition; +} D3D_SHADER_MACRO; + +typedef struct _D3D_SHADER_MACRO* LPD3D_SHADER_MACRO; + +[ + object, + local, + uuid(8ba5fb08-5195-40e2-ac58-0d989c3a0102) +] +interface ID3D10Blob : IUnknown +{ + void *GetBufferPointer(); + SIZE_T GetBufferSize(); +} + +typedef ID3D10Blob* LPD3D10BLOB; +typedef ID3D10Blob ID3DBlob; +typedef ID3DBlob* LPD3DBLOB; +cpp_quote("#define IID_ID3DBlob IID_ID3D10Blob") + +typedef enum _D3D_INCLUDE_TYPE +{ + D3D_INCLUDE_LOCAL = 0, + D3D_INCLUDE_SYSTEM, + D3D10_INCLUDE_LOCAL = D3D_INCLUDE_LOCAL, + D3D10_INCLUDE_SYSTEM = D3D_INCLUDE_SYSTEM, + D3D_INCLUDE_FORCE_DWORD = 0x7fffffff +} D3D_INCLUDE_TYPE; + +[ + object, + local, +] +interface ID3DInclude +{ + HRESULT Open(D3D_INCLUDE_TYPE include_type, + const char *filename, + const void *parent_data, + const void **data, + UINT *bytes); + HRESULT Close(const void *data); +} + +typedef ID3DInclude* LPD3DINCLUDE; + +typedef enum D3D_DRIVER_TYPE +{ + D3D_DRIVER_TYPE_UNKNOWN, + D3D_DRIVER_TYPE_HARDWARE, + D3D_DRIVER_TYPE_REFERENCE, + D3D_DRIVER_TYPE_NULL, + D3D_DRIVER_TYPE_SOFTWARE, + D3D_DRIVER_TYPE_WARP, +} D3D_DRIVER_TYPE; + +typedef enum D3D_FEATURE_LEVEL +{ + D3D_FEATURE_LEVEL_9_1 = 0x9100, + D3D_FEATURE_LEVEL_9_2 = 0x9200, + D3D_FEATURE_LEVEL_9_3 = 0x9300, + D3D_FEATURE_LEVEL_10_0 = 0xa000, + D3D_FEATURE_LEVEL_10_1 = 0xa100, + D3D_FEATURE_LEVEL_11_0 = 0xb000, +} D3D_FEATURE_LEVEL; + +typedef enum _D3D_SHADER_VARIABLE_CLASS +{ + D3D_SVC_SCALAR, + D3D_SVC_VECTOR, + D3D_SVC_MATRIX_ROWS, + D3D_SVC_MATRIX_COLUMNS, + D3D_SVC_OBJECT, + D3D_SVC_STRUCT, + D3D_SVC_INTERFACE_CLASS, + D3D_SVC_INTERFACE_POINTER, + D3D10_SVC_SCALAR = 0, + D3D10_SVC_VECTOR, + D3D10_SVC_MATRIX_ROWS, + D3D10_SVC_MATRIX_COLUMNS, + D3D10_SVC_OBJECT, + D3D10_SVC_STRUCT, + D3D11_SVC_INTERFACE_CLASS, + D3D11_SVC_INTERFACE_POINTER, + D3D_SVC_FORCE_DWORD = 0x7fffffff, +} D3D_SHADER_VARIABLE_CLASS; + +typedef enum _D3D_SHADER_VARIABLE_TYPE +{ + D3D_SVT_VOID, + D3D_SVT_BOOL, + D3D_SVT_INT, + D3D_SVT_FLOAT, + D3D_SVT_STRING, + D3D_SVT_TEXTURE, + D3D_SVT_TEXTURE1D, + D3D_SVT_TEXTURE2D, + D3D_SVT_TEXTURE3D, + D3D_SVT_TEXTURECUBE, + D3D_SVT_SAMPLER, + D3D_SVT_SAMPLER1D, + D3D_SVT_SAMPLER2D, + D3D_SVT_SAMPLER3D, + D3D_SVT_SAMPLERCUBE, + D3D_SVT_PIXELSHADER, + D3D_SVT_VERTEXSHADER, + D3D_SVT_PIXELFRAGMENT, + D3D_SVT_VERTEXFRAGMENT, + D3D_SVT_UINT, + D3D_SVT_UINT8, + D3D_SVT_GEOMETRYSHADER, + D3D_SVT_RASTERIZER, + D3D_SVT_DEPTHSTENCIL, + D3D_SVT_BLEND, + D3D_SVT_BUFFER, + D3D_SVT_CBUFFER, + D3D_SVT_TBUFFER, + D3D_SVT_TEXTURE1DARRAY, + D3D_SVT_TEXTURE2DARRAY, + D3D_SVT_RENDERTARGETVIEW, + D3D_SVT_DEPTHSTENCILVIEW, + D3D_SVT_TEXTURE2DMS, + D3D_SVT_TEXTURE2DMSARRAY, + D3D_SVT_TEXTURECUBEARRAY, + D3D_SVT_HULLSHADER, + D3D_SVT_DOMAINSHADER, + D3D_SVT_INTERFACE_POINTER, + D3D_SVT_COMPUTESHADER, + D3D_SVT_DOUBLE, + D3D_SVT_RWTEXTURE1D, + D3D_SVT_RWTEXTURE1DARRAY, + D3D_SVT_RWTEXTURE2D, + D3D_SVT_RWTEXTURE2DARRAY, + D3D_SVT_RWTEXTURE3D, + D3D_SVT_RWBUFFER, + D3D_SVT_BYTEADDRESS_BUFFER, + D3D_SVT_RWBYTEADDRESS_BUFFER, + D3D_SVT_STRUCTURED_BUFFER, + D3D_SVT_RWSTRUCTURED_BUFFER, + D3D_SVT_APPEND_STRUCTURED_BUFFER, + D3D_SVT_CONSUME_STRUCTURED_BUFFER, + D3D10_SVT_VOID = 0, + D3D10_SVT_BOOL, + D3D10_SVT_INT, + D3D10_SVT_FLOAT, + D3D10_SVT_STRING, + D3D10_SVT_TEXTURE, + D3D10_SVT_TEXTURE1D, + D3D10_SVT_TEXTURE2D, + D3D10_SVT_TEXTURE3D, + D3D10_SVT_TEXTURECUBE, + D3D10_SVT_SAMPLER, + D3D10_SVT_SAMPLER1D, + D3D10_SVT_SAMPLER2D, + D3D10_SVT_SAMPLER3D, + D3D10_SVT_SAMPLERCUBE, + D3D10_SVT_PIXELSHADER, + D3D10_SVT_VERTEXSHADER, + D3D10_SVT_PIXELFRAGMENT, + D3D10_SVT_VERTEXFRAGMENT, + D3D10_SVT_UINT, + D3D10_SVT_UINT8, + D3D10_SVT_GEOMETRYSHADER, + D3D10_SVT_RASTERIZER, + D3D10_SVT_DEPTHSTENCIL, + D3D10_SVT_BLEND, + D3D10_SVT_BUFFER, + D3D10_SVT_CBUFFER, + D3D10_SVT_TBUFFER, + D3D10_SVT_TEXTURE1DARRAY, + D3D10_SVT_TEXTURE2DARRAY, + D3D10_SVT_RENDERTARGETVIEW, + D3D10_SVT_DEPTHSTENCILVIEW, + D3D10_SVT_TEXTURE2DMS, + D3D10_SVT_TEXTURE2DMSARRAY, + D3D10_SVT_TEXTURECUBEARRAY, + D3D11_SVT_HULLSHADER, + D3D11_SVT_DOMAINSHADER, + D3D11_SVT_INTERFACE_POINTER, + D3D11_SVT_COMPUTESHADER, + D3D11_SVT_DOUBLE, + D3D11_SVT_RWTEXTURE1D, + D3D11_SVT_RWTEXTURE1DARRAY, + D3D11_SVT_RWTEXTURE2D, + D3D11_SVT_RWTEXTURE2DARRAY, + D3D11_SVT_RWTEXTURE3D, + D3D11_SVT_RWBUFFER, + D3D11_SVT_BYTEADDRESS_BUFFER, + D3D11_SVT_RWBYTEADDRESS_BUFFER, + D3D11_SVT_STRUCTURED_BUFFER, + D3D11_SVT_RWSTRUCTURED_BUFFER, + D3D11_SVT_APPEND_STRUCTURED_BUFFER, + D3D11_SVT_CONSUME_STRUCTURED_BUFFER, + D3D_SVT_FORCE_DWORD = 0x7fffffff, +} D3D_SHADER_VARIABLE_TYPE; + +typedef enum D3D_PRIMITIVE +{ + D3D_PRIMITIVE_UNDEFINED, + D3D_PRIMITIVE_POINT, + D3D_PRIMITIVE_LINE, + D3D_PRIMITIVE_TRIANGLE, + D3D_PRIMITIVE_LINE_ADJ = 6, + D3D_PRIMITIVE_TRIANGLE_ADJ, + D3D_PRIMITIVE_1_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_2_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_3_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_4_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_5_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_6_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_7_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_8_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_9_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_10_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_11_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_12_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_13_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_14_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_15_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_16_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_17_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_18_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_19_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_20_CONTROL_POINT_PATCH = 28, + D3D_PRIMITIVE_21_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_22_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_23_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_24_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_25_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_26_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_27_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_28_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_29_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_30_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_31_CONTROL_POINT_PATCH, + D3D_PRIMITIVE_32_CONTROL_POINT_PATCH, + D3D10_PRIMITIVE_UNDEFINED = 0, + D3D10_PRIMITIVE_POINT, + D3D10_PRIMITIVE_LINE, + D3D10_PRIMITIVE_TRIANGLE, + D3D10_PRIMITIVE_LINE_ADJ = 6, + D3D10_PRIMITIVE_TRIANGLE_ADJ, + D3D11_PRIMITIVE_UNDEFINED = 0, + D3D11_PRIMITIVE_POINT, + D3D11_PRIMITIVE_LINE, + D3D11_PRIMITIVE_TRIANGLE, + D3D11_PRIMITIVE_LINE_ADJ = 6, + D3D11_PRIMITIVE_TRIANGLE_ADJ, + D3D11_PRIMITIVE_1_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_2_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_3_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_4_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_5_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_6_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_7_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_8_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_9_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_10_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_11_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_12_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_13_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_14_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_15_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_16_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_17_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_18_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_19_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_20_CONTROL_POINT_PATCH = 28, + D3D11_PRIMITIVE_21_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_22_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_23_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_24_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_25_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_26_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_27_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_28_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_29_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_30_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_31_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_32_CONTROL_POINT_PATCH, +} D3D_PRIMITIVE; + +typedef enum D3D_PRIMITIVE_TOPOLOGY +{ + D3D_PRIMITIVE_TOPOLOGY_UNDEFINED, + D3D_PRIMITIVE_TOPOLOGY_POINTLIST, + D3D_PRIMITIVE_TOPOLOGY_LINELIST, + D3D_PRIMITIVE_TOPOLOGY_LINESTRIP, + D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST, + D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, + D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = 10, + D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ, + D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ, + D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ, + D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST = 33, + D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST, + D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST, + D3D10_PRIMITIVE_TOPOLOGY_UNDEFINED = 0, + D3D10_PRIMITIVE_TOPOLOGY_POINTLIST, + D3D10_PRIMITIVE_TOPOLOGY_LINELIST, + D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP, + D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST, + D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, + D3D10_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = 10, + D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ, + D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ, + D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ, + D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED = 0, + D3D11_PRIMITIVE_TOPOLOGY_POINTLIST, + D3D11_PRIMITIVE_TOPOLOGY_LINELIST, + D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP, + D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST, + D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, + D3D11_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = 10, + D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ, + D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ, + D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ, + D3D11_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST = 33, + D3D11_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST, +} D3D_PRIMITIVE_TOPOLOGY; + +typedef enum D3D_TESSELLATOR_DOMAIN +{ + D3D_TESSELLATOR_DOMAIN_UNDEFINED, + D3D_TESSELLATOR_DOMAIN_ISOLINE, + D3D_TESSELLATOR_DOMAIN_TRI, + D3D_TESSELLATOR_DOMAIN_QUAD, + D3D11_TESSELLATOR_DOMAIN_UNDEFINED = 0, + D3D11_TESSELLATOR_DOMAIN_ISOLINE, + D3D11_TESSELLATOR_DOMAIN_TRI, + D3D11_TESSELLATOR_DOMAIN_QUAD, +} D3D_TESSELLATOR_DOMAIN; + +typedef enum D3D_TESSELLATOR_PARTITIONING +{ + D3D_TESSELLATOR_PARTITIONING_UNDEFINED, + D3D_TESSELLATOR_PARTITIONING_INTEGER, + D3D_TESSELLATOR_PARTITIONING_POW2, + D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD, + D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN, + D3D11_TESSELLATOR_PARTITIONING_UNDEFINED = 0, + D3D11_TESSELLATOR_PARTITIONING_INTEGER, + D3D11_TESSELLATOR_PARTITIONING_POW2, + D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD, + D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN, +} D3D_TESSELLATOR_PARTITIONING; + +typedef enum D3D_TESSELLATOR_OUTPUT_PRIMITIVE +{ + D3D_TESSELLATOR_OUTPUT_UNDEFINED, + D3D_TESSELLATOR_OUTPUT_POINT, + D3D_TESSELLATOR_OUTPUT_LINE, + D3D_TESSELLATOR_OUTPUT_TRIANGLE_CW, + D3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW, + D3D11_TESSELLATOR_OUTPUT_UNDEFINED = 0, + D3D11_TESSELLATOR_OUTPUT_POINT, + D3D11_TESSELLATOR_OUTPUT_LINE, + D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CW, + D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CCW, +} D3D_TESSELLATOR_OUTPUT_PRIMITIVE; + +typedef enum D3D_CBUFFER_TYPE +{ + D3D_CT_CBUFFER, + D3D_CT_TBUFFER, + D3D_CT_INTERFACE_POINTERS, + D3D_CT_RESOURCE_BIND_INFO, + D3D10_CT_CBUFFER = 0, + D3D10_CT_TBUFFER, + D3D11_CT_CBUFFER = 0, + D3D11_CT_TBUFFER, + D3D11_CT_INTERFACE_POINTERS, + D3D11_CT_RESOURCE_BIND_INFO, +} D3D_CBUFFER_TYPE; + +typedef enum D3D_SRV_DIMENSION +{ + D3D_SRV_DIMENSION_UNKNOWN, + D3D_SRV_DIMENSION_BUFFER, + D3D_SRV_DIMENSION_TEXTURE1D, + D3D_SRV_DIMENSION_TEXTURE1DARRAY, + D3D_SRV_DIMENSION_TEXTURE2D, + D3D_SRV_DIMENSION_TEXTURE2DARRAY, + D3D_SRV_DIMENSION_TEXTURE2DMS, + D3D_SRV_DIMENSION_TEXTURE2DMSARRAY, + D3D_SRV_DIMENSION_TEXTURE3D, + D3D_SRV_DIMENSION_TEXTURECUBE, + D3D_SRV_DIMENSION_TEXTURECUBEARRAY, + D3D_SRV_DIMENSION_BUFFEREX, + D3D10_SRV_DIMENSION_UNKNOWN = 0, + D3D10_SRV_DIMENSION_BUFFER, + D3D10_SRV_DIMENSION_TEXTURE1D, + D3D10_SRV_DIMENSION_TEXTURE1DARRAY, + D3D10_SRV_DIMENSION_TEXTURE2D, + D3D10_SRV_DIMENSION_TEXTURE2DARRAY, + D3D10_SRV_DIMENSION_TEXTURE2DMS, + D3D10_SRV_DIMENSION_TEXTURE2DMSARRAY, + D3D10_SRV_DIMENSION_TEXTURE3D, + D3D10_SRV_DIMENSION_TEXTURECUBE, + D3D10_1_SRV_DIMENSION_UNKNOWN = 0, + D3D10_1_SRV_DIMENSION_BUFFER, + D3D10_1_SRV_DIMENSION_TEXTURE1D, + D3D10_1_SRV_DIMENSION_TEXTURE1DARRAY, + D3D10_1_SRV_DIMENSION_TEXTURE2D, + D3D10_1_SRV_DIMENSION_TEXTURE2DARRAY, + D3D10_1_SRV_DIMENSION_TEXTURE2DMS, + D3D10_1_SRV_DIMENSION_TEXTURE2DMSARRAY, + D3D10_1_SRV_DIMENSION_TEXTURE3D, + D3D10_1_SRV_DIMENSION_TEXTURECUBE, + D3D10_1_SRV_DIMENSION_TEXTURECUBEARRAY, + D3D11_SRV_DIMENSION_UNKNOWN = 0, + D3D11_SRV_DIMENSION_BUFFER, + D3D11_SRV_DIMENSION_TEXTURE1D, + D3D11_SRV_DIMENSION_TEXTURE1DARRAY, + D3D11_SRV_DIMENSION_TEXTURE2D, + D3D11_SRV_DIMENSION_TEXTURE2DARRAY, + D3D11_SRV_DIMENSION_TEXTURE2DMS, + D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY, + D3D11_SRV_DIMENSION_TEXTURE3D, + D3D11_SRV_DIMENSION_TEXTURECUBE, + D3D11_SRV_DIMENSION_TEXTURECUBEARRAY, + D3D11_SRV_DIMENSION_BUFFEREX, +} D3D_SRV_DIMENSION; + +typedef enum D3D_REGISTER_COMPONENT_TYPE +{ + D3D_REGISTER_COMPONENT_UNKNOWN, + D3D_REGISTER_COMPONENT_UINT32, + D3D_REGISTER_COMPONENT_SINT32, + D3D_REGISTER_COMPONENT_FLOAT32, + D3D10_REGISTER_COMPONENT_UNKNOWN = 0, + D3D10_REGISTER_COMPONENT_UINT32, + D3D10_REGISTER_COMPONENT_SINT32, + D3D10_REGISTER_COMPONENT_FLOAT32, +} D3D_REGISTER_COMPONENT_TYPE; + +typedef enum D3D_RESOURCE_RETURN_TYPE +{ + D3D_RETURN_TYPE_UNORM = 1, + D3D_RETURN_TYPE_SNORM, + D3D_RETURN_TYPE_SINT, + D3D_RETURN_TYPE_UINT, + D3D_RETURN_TYPE_FLOAT, + D3D_RETURN_TYPE_MIXED, + D3D_RETURN_TYPE_DOUBLE, + D3D_RETURN_TYPE_CONTINUED, + D3D10_RETURN_TYPE_UNORM = 1, + D3D10_RETURN_TYPE_SNORM, + D3D10_RETURN_TYPE_SINT, + D3D10_RETURN_TYPE_UINT, + D3D10_RETURN_TYPE_FLOAT, + D3D10_RETURN_TYPE_MIXED, + D3D11_RETURN_TYPE_UNORM = 1, + D3D11_RETURN_TYPE_SNORM, + D3D11_RETURN_TYPE_SINT, + D3D11_RETURN_TYPE_UINT, + D3D11_RETURN_TYPE_FLOAT, + D3D11_RETURN_TYPE_MIXED, + D3D11_RETURN_TYPE_DOUBLE, + D3D11_RETURN_TYPE_CONTINUED, +} D3D_RESOURCE_RETURN_TYPE; + +typedef enum D3D_NAME +{ + D3D_NAME_UNDEFINED, + D3D_NAME_POSITION, + D3D_NAME_CLIP_DISTANCE, + D3D_NAME_CULL_DISTANCE, + D3D_NAME_RENDER_TARGET_ARRAY_INDEX, + D3D_NAME_VIEWPORT_ARRAY_INDEX, + D3D_NAME_VERTEX_ID, + D3D_NAME_PRIMITIVE_ID, + D3D_NAME_INSTANCE_ID, + D3D_NAME_IS_FRONT_FACE, + D3D_NAME_SAMPLE_INDEX, + D3D_NAME_FINAL_QUAD_EDGE_TESSFACTOR, + D3D_NAME_FINAL_QUAD_INSIDE_TESSFACTOR, + D3D_NAME_FINAL_TRI_EDGE_TESSFACTOR, + D3D_NAME_FINAL_TRI_INSIDE_TESSFACTOR, + D3D_NAME_FINAL_LINE_DETAIL_TESSFACTOR, + D3D_NAME_FINAL_LINE_DENSITY_TESSFACTOR, + D3D_NAME_TARGET = 64, + D3D_NAME_DEPTH, + D3D_NAME_COVERAGE, + D3D_NAME_DEPTH_GREATER_EQUAL, + D3D_NAME_DEPTH_LESS_EQUAL, + D3D10_NAME_UNDEFINED = 0, + D3D10_NAME_POSITION, + D3D10_NAME_CLIP_DISTANCE, + D3D10_NAME_CULL_DISTANCE, + D3D10_NAME_RENDER_TARGET_ARRAY_INDEX, + D3D10_NAME_VIEWPORT_ARRAY_INDEX, + D3D10_NAME_VERTEX_ID, + D3D10_NAME_PRIMITIVE_ID, + D3D10_NAME_INSTANCE_ID, + D3D10_NAME_IS_FRONT_FACE, + D3D10_NAME_SAMPLE_INDEX, + D3D11_NAME_FINAL_QUAD_EDGE_TESSFACTOR, + D3D11_NAME_FINAL_QUAD_INSIDE_TESSFACTOR, + D3D11_NAME_FINAL_TRI_EDGE_TESSFACTOR, + D3D11_NAME_FINAL_TRI_INSIDE_TESSFACTOR, + D3D11_NAME_FINAL_LINE_DETAIL_TESSFACTOR, + D3D11_NAME_FINAL_LINE_DENSITY_TESSFACTOR, + D3D10_NAME_TARGET = 64, + D3D10_NAME_DEPTH, + D3D10_NAME_COVERAGE, + D3D11_NAME_DEPTH_GREATER_EQUAL, + D3D11_NAME_DEPTH_LESS_EQUAL, +} D3D_NAME; + +typedef enum _D3D_SHADER_INPUT_TYPE +{ + D3D_SIT_CBUFFER, + D3D_SIT_TBUFFER, + D3D_SIT_TEXTURE, + D3D_SIT_SAMPLER, + D3D_SIT_UAV_RWTYPED, + D3D_SIT_STRUCTURED, + D3D_SIT_UAV_RWSTRUCTURED, + D3D_SIT_BYTEADDRESS, + D3D_SIT_UAV_RWBYTEADDRESS, + D3D_SIT_UAV_APPEND_STRUCTURED, + D3D_SIT_UAV_CONSUME_STRUCTURED, + D3D_SIT_UAV_RWSTRUCTURED_WITH_COUNTER, + D3D10_SIT_CBUFFER = 0, + D3D10_SIT_TBUFFER, + D3D10_SIT_TEXTURE, + D3D10_SIT_SAMPLER, + D3D11_SIT_UAV_RWTYPED, + D3D11_SIT_STRUCTURED, + D3D11_SIT_UAV_RWSTRUCTURED, + D3D11_SIT_BYTEADDRESS, + D3D11_SIT_UAV_RWBYTEADDRESS, + D3D11_SIT_UAV_APPEND_STRUCTURED, + D3D11_SIT_UAV_CONSUME_STRUCTURED, + D3D11_SIT_UAV_RWSTRUCTURED_WITH_COUNTER, +} D3D_SHADER_INPUT_TYPE; diff --git a/reactos/include/psdk/ipifcons.h b/reactos/include/psdk/ipifcons.h index 9b560eb8810..30a304e2b4f 100644 --- a/reactos/include/psdk/ipifcons.h +++ b/reactos/include/psdk/ipifcons.h @@ -1,35 +1,251 @@ -#ifndef _IPIFCONS_H -#define _IPIFCONS_H +/* WINE ipifcons.h + * Copyright (C) 2003 Juan Lang + * + * 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 + */ +#ifndef WINE_IPIFCONS_H__ +#define WINE_IPIFCONS_H__ -#define IF_ADMIN_STATUS_UP 1 -#define IF_ADMIN_STATUS_DOWN 2 -#define IF_ADMIN_STATUS_TESTING 3 -#define IF_OPER_STATUS_NON_OPERATIONAL 0 -#define IF_OPER_STATUS_UNREACHABLE 1 -#define IF_OPER_STATUS_DISCONNECTED 2 -#define IF_OPER_STATUS_CONNECTING 3 -#define IF_OPER_STATUS_CONNECTED 4 -#define IF_OPER_STATUS_OPERATIONAL 5 +#define IF_TYPE_OTHER 1 +#define IF_TYPE_REGULAR_1822 2 +#define IF_TYPE_HDH_1822 3 +#define IF_TYPE_DDN_X25 4 +#define IF_TYPE_RFC877_X25 5 +#define IF_TYPE_ETHERNET_CSMACD 6 +#define IF_TYPE_IS088023_CSMACD 7 +#define IF_TYPE_ISO88024_TOKENBUS 8 +#define IF_TYPE_ISO88025_TOKENRING 9 +#define IF_TYPE_ISO88026_MAN 10 +#define IF_TYPE_STARLAN 11 +#define IF_TYPE_PROTEON_10MBIT 12 +#define IF_TYPE_PROTEON_80MBIT 13 +#define IF_TYPE_HYPERCHANNEL 14 +#define IF_TYPE_FDDI 15 +#define IF_TYPE_LAP_B 16 +#define IF_TYPE_SDLC 17 +#define IF_TYPE_DS1 18 +#define IF_TYPE_E1 19 +#define IF_TYPE_BASIC_ISDN 20 +#define IF_TYPE_PRIMARY_ISDN 21 +#define IF_TYPE_PROP_POINT2POINT_SERIAL 22 +#define IF_TYPE_PPP 23 +#define IF_TYPE_SOFTWARE_LOOPBACK 24 +#define IF_TYPE_EON 25 +#define IF_TYPE_ETHERNET_3MBIT 26 +#define IF_TYPE_NSIP 27 +#define IF_TYPE_SLIP 28 +#define IF_TYPE_ULTRA 29 +#define IF_TYPE_DS3 30 +#define IF_TYPE_SIP 31 +#define IF_TYPE_FRAMERELAY 32 +#define IF_TYPE_RS232 33 +#define IF_TYPE_PARA 34 +#define IF_TYPE_ARCNET 35 +#define IF_TYPE_ARCNET_PLUS 36 +#define IF_TYPE_ATM 37 +#define IF_TYPE_MIO_X25 38 +#define IF_TYPE_SONET 39 +#define IF_TYPE_X25_PLE 40 +#define IF_TYPE_ISO88022_LLC 41 +#define IF_TYPE_LOCALTALK 42 +#define IF_TYPE_SMDS_DXI 43 +#define IF_TYPE_FRAMERELAY_SERVICE 44 +#define IF_TYPE_V35 45 +#define IF_TYPE_HSSI 46 +#define IF_TYPE_HIPPI 47 +#define IF_TYPE_MODEM 48 +#define IF_TYPE_AAL5 49 +#define IF_TYPE_SONET_PATH 50 +#define IF_TYPE_SONET_VT 51 +#define IF_TYPE_SMDS_ICIP 52 +#define IF_TYPE_PROP_VIRTUAL 53 +#define IF_TYPE_PROP_MULTIPLEXOR 54 +#define IF_TYPE_IEEE80212 55 +#define IF_TYPE_FIBRECHANNEL 56 +#define IF_TYPE_HIPPIINTERFACE 57 +#define IF_TYPE_FRAMERELAY_INTERCONNECT 58 +#define IF_TYPE_AFLANE_8023 59 +#define IF_TYPE_AFLANE_8025 60 +#define IF_TYPE_CCTEMUL 61 +#define IF_TYPE_FASTETHER 62 +#define IF_TYPE_ISDN 63 +#define IF_TYPE_V11 64 +#define IF_TYPE_V36 65 +#define IF_TYPE_G703_64K 66 +#define IF_TYPE_G703_2MB 67 +#define IF_TYPE_QLLC 68 +#define IF_TYPE_FASTETHER_FX 69 +#define IF_TYPE_CHANNEL 70 +#define IF_TYPE_IEEE80211 71 +#define IF_TYPE_IBM370PARCHAN 72 +#define IF_TYPE_ESCON 73 +#define IF_TYPE_DLSW 74 +#define IF_TYPE_ISDN_S 75 +#define IF_TYPE_ISDN_U 76 +#define IF_TYPE_LAP_D 77 +#define IF_TYPE_IPSWITCH 78 +#define IF_TYPE_RSRB 79 +#define IF_TYPE_ATM_LOGICAL 80 +#define IF_TYPE_DS0 81 +#define IF_TYPE_DS0_BUNDLE 82 +#define IF_TYPE_BSC 83 +#define IF_TYPE_ASYNC 84 +#define IF_TYPE_CNR 85 +#define IF_TYPE_ISO88025R_DTR 86 +#define IF_TYPE_EPLRS 87 +#define IF_TYPE_ARAP 88 +#define IF_TYPE_PROP_CNLS 89 +#define IF_TYPE_HOSTPAD 90 +#define IF_TYPE_TERMPAD 91 +#define IF_TYPE_FRAMERELAY_MPI 92 +#define IF_TYPE_X213 93 +#define IF_TYPE_ADSL 94 +#define IF_TYPE_RADSL 95 +#define IF_TYPE_SDSL 96 +#define IF_TYPE_VDSL 97 +#define IF_TYPE_ISO88025_CRFPRINT 98 +#define IF_TYPE_MYRINET 99 +#define IF_TYPE_VOICE_EM 100 +#define IF_TYPE_VOICE_FXO 101 +#define IF_TYPE_VOICE_FXS 102 +#define IF_TYPE_VOICE_ENCAP 103 +#define IF_TYPE_VOICE_OVERIP 104 +#define IF_TYPE_ATM_DXI 105 +#define IF_TYPE_ATM_FUNI 106 +#define IF_TYPE_ATM_IMA 107 +#define IF_TYPE_PPPMULTILINKBUNDLE 108 +#define IF_TYPE_IPOVER_CDLC 109 +#define IF_TYPE_IPOVER_CLAW 110 +#define IF_TYPE_STACKTOSTACK 111 +#define IF_TYPE_VIRTUALIPADDRESS 112 +#define IF_TYPE_MPC 113 +#define IF_TYPE_IPOVER_ATM 114 +#define IF_TYPE_ISO88025_FIBER 115 +#define IF_TYPE_TDLC 116 +#define IF_TYPE_GIGABITETHERNET 117 +#define IF_TYPE_HDLC 118 +#define IF_TYPE_LAP_F 119 +#define IF_TYPE_V37 120 +#define IF_TYPE_X25_MLP 121 +#define IF_TYPE_X25_HUNTGROUP 122 +#define IF_TYPE_TRANSPHDLC 123 +#define IF_TYPE_INTERLEAVE 124 +#define IF_TYPE_FAST 125 +#define IF_TYPE_IP 126 +#define IF_TYPE_DOCSCABLE_MACLAYER 127 +#define IF_TYPE_DOCSCABLE_DOWNSTREAM 128 +#define IF_TYPE_DOCSCABLE_UPSTREAM 129 +#define IF_TYPE_A12MPPSWITCH 130 +#define IF_TYPE_TUNNEL 131 +#define IF_TYPE_COFFEE 132 +#define IF_TYPE_CES 133 +#define IF_TYPE_ATM_SUBINTERFACE 134 +#define IF_TYPE_L2_VLAN 135 +#define IF_TYPE_L3_IPVLAN 136 +#define IF_TYPE_L3_IPXVLAN 137 +#define IF_TYPE_DIGITALPOWERLINE 138 +#define IF_TYPE_MEDIAMAILOVERIP 139 +#define IF_TYPE_DTM 140 +#define IF_TYPE_DCN 141 +#define IF_TYPE_IPFORWARD 142 +#define IF_TYPE_MSDSL 143 +#define IF_TYPE_IEEE1394 144 +#define IF_TYPE_IF_GSN 145 +#define IF_TYPE_DVBRCC_MACLAYER 146 +#define IF_TYPE_DVBRCC_DOWNSTREAM 147 +#define IF_TYPE_DVBRCC_UPSTREAM 148 +#define IF_TYPE_ATM_VIRTUAL 149 +#define IF_TYPE_MPLS_TUNNEL 150 +#define IF_TYPE_SRP 151 +#define IF_TYPE_VOICEOVERATM 152 +#define IF_TYPE_VOICEOVERFRAMERELAY 153 +#define IF_TYPE_IDSL 154 +#define IF_TYPE_COMPOSITELINK 155 +#define IF_TYPE_SS7_SIGLINK 156 +#define IF_TYPE_PROP_WIRELESS_P2P 157 +#define IF_TYPE_FR_FORWARD 158 +#define IF_TYPE_RFC1483 159 +#define IF_TYPE_USB 160 +#define IF_TYPE_IEEE8023AD_LAG 161 +#define IF_TYPE_BGP_POLICY_ACCOUNTING 162 +#define IF_TYPE_FRF16_MFR_BUNDLE 163 +#define IF_TYPE_H323_GATEKEEPER 164 +#define IF_TYPE_H323_PROXY 165 +#define IF_TYPE_MPLS 166 +#define IF_TYPE_MF_SIGLINK 167 +#define IF_TYPE_HDSL2 168 +#define IF_TYPE_SHDSL 169 +#define IF_TYPE_DS1_FDL 170 +#define IF_TYPE_POS 171 +#define IF_TYPE_DVB_ASI_IN 172 +#define IF_TYPE_DVB_ASI_OUT 173 +#define IF_TYPE_PLC 175 +#define IF_TYPE_NFAS 175 +#define IF_TYPE_TR008 176 +#define IF_TYPE_GR303_RDT 177 +#define IF_TYPE_GR303_IDT 178 +#define IF_TYPE_ISUP 179 +#define IF_TYPE_PROP_DOCS_WIRELESS_MACLAYER 180 +#define IF_TYPE_PROP_DOCS_WIRELESS_DOWNSTREAM 181 +#define IF_TYPE_PROP_DOCS_WIRELESS_UPSTREAM 182 +#define IF_TYPE_HIPERLAN2 183 +#define IF_TYPE_PROP_BWA_P2MP 184 +#define IF_TYPE_SONET_OVERHEAD_CHANNEL 185 +#define IF_TYPE_DIGITAL_WRAPPER_OVERHEAD_CHANNEL 186 +#define IF_TYPE_AAL2 187 +#define IF_TYPE_RADIO_MAC 188 +#define IF_TYPE_ATM_RADIO 189 +#define IF_TYPE_IMT 190 +#define IF_TYPE_MVL 191 +#define IF_TYPE_REACH_DSL 192 +#define IF_TYPE_FR_DLCI_ENDPT 193 +#define IF_TYPE_ATM_VCI_ENDPT 194 +#define IF_TYPE_OPTICAL_CHANNEL 195 +#define IF_TYPE_OPTICAL_TRANSPORT 196 +#define IF_TYPE_IEEE80216_WANN 237 +#define IF_TYPE_WWANPP 243 +#define IF_TYPE_WWANPP2 244 +#define MAX_IF_TYPE 244 -#define MIB_IF_ADMIN_STATUS_UP 1 -#define MIB_IF_ADMIN_STATUS_DOWN 2 -#define MIB_IF_ADMIN_STATUS_TESTING 3 -#define MIB_IF_OPER_STATUS_NON_OPERATIONAL 0 -#define MIB_IF_OPER_STATUS_UNREACHABLE 1 -#define MIB_IF_OPER_STATUS_DISCONNECTED 2 -#define MIB_IF_OPER_STATUS_CONNECTING 3 -#define MIB_IF_OPER_STATUS_CONNECTED 4 -#define MIB_IF_OPER_STATUS_OPERATIONAL 5 -#define MIB_IF_TYPE_OTHER 1 -#define MIB_IF_TYPE_ETHERNET 6 -#define MIB_IF_TYPE_TOKENRING 9 -#define MIB_IF_TYPE_FDDI 15 -#define MIB_IF_TYPE_PPP 23 -#define MIB_IF_TYPE_LOOPBACK 24 -#define MIB_IF_TYPE_SLIP 28 +#define MIB_IF_TYPE_OTHER 1 +#define MIB_IF_TYPE_ETHERNET 6 +#define MIB_IF_TYPE_TOKENRING 9 +#define MIB_IF_TYPE_FDDI 15 +#define MIB_IF_TYPE_PPP 23 +#define MIB_IF_TYPE_LOOPBACK 24 +#define MIB_IF_TYPE_SLIP 28 -#define IF_TYPE_OTHER 1 -#define IF_TYPE_ETHERNET_CSMACD 6 -#define IF_TYPE_IEEE80211 71 +#define MIB_IF_ADMIN_STATUS_UP 1 +#define MIB_IF_ADMIN_STATUS_DOWN 2 +#define MIB_IF_ADMIN_STATUS_TESTING 3 -#endif /* _IPIFCONS_H */ +typedef enum _INTERNAL_IF_OPER_STATUS +{ + IF_OPER_STATUS_NON_OPERATIONAL = 0, + IF_OPER_STATUS_UNREACHABLE = 1, + IF_OPER_STATUS_DISCONNECTED = 2, + IF_OPER_STATUS_CONNECTING = 3, + IF_OPER_STATUS_CONNECTED = 4, + IF_OPER_STATUS_OPERATIONAL = 5, +} INTERNAL_IF_OPER_STATUS; + +#define MIB_IF_OPER_STATUS_NON_OPERATIONAL IF_OPER_STATUS_NON_OPERATIONAL +#define MIB_IF_OPER_STATUS_UNREACHABLE IF_OPER_STATUS_UNREACHABLE +#define MIB_IF_OPER_STATUS_DISCONNECTED IF_OPER_STATUS_DISCONNECTED +#define MIB_IF_OPER_STATUS_CONNECTING IF_OPER_STATUS_CONNECTING +#define MIB_IF_OPER_STATUS_CONNECTED IF_OPER_STATUS_CONNECTED +#define MIB_IF_OPER_STATUS_OPERATIONAL IF_OPER_STATUS_OPERATIONAL + +#endif /* WINE_IPIFCONS_H__ */ diff --git a/reactos/include/psdk/iptypes.h b/reactos/include/psdk/iptypes.h index 94d81263ad7..987e1c1a9dd 100644 --- a/reactos/include/psdk/iptypes.h +++ b/reactos/include/psdk/iptypes.h @@ -169,8 +169,8 @@ typedef struct _IP_ADAPTER_ADDRESSES { struct { ULONG Length; DWORD IfIndex; - }; - }; + } DUMMYSTRUCTNAME; + } DUMMYUNIONNAME; struct _IP_ADAPTER_ADDRESSES *Next; PCHAR AdapterName; PIP_ADAPTER_UNICAST_ADDRESS FirstUnicastAddress; diff --git a/reactos/include/psdk/wbemcli.idl b/reactos/include/psdk/wbemcli.idl index db6a5ac28c8..af5e5bc2609 100644 --- a/reactos/include/psdk/wbemcli.idl +++ b/reactos/include/psdk/wbemcli.idl @@ -19,6 +19,7 @@ cpp_quote("DEFINE_GUID(CLSID_WbemLocator, 0x4590f811,0x1d3A,0x11d0,0x89,0x1f,0x00,0xaa,0x00,0x4b,0x2e,0x24);") cpp_quote("DEFINE_GUID(CLSID_WbemStatusCode, 0xeb87e1bd,0x3233,0x11d2,0xae,0xc9,0x00,0xc0,0x4f,0xb6,0x88,0x20);") +import "oaidl.idl"; import "objidl.idl"; interface IWbemContext; @@ -28,6 +29,7 @@ interface IWbemCallResult; interface IWbemObjectSink; interface IWbemClassObject; interface IEnumWbemClassObject; +interface IWbemQualifierSet; typedef [v1_enum] enum tag_WBEMSTATUS { @@ -174,6 +176,80 @@ typedef [v1_enum] enum tag_WBEMSTATUS WBEM_E_PROVIDER_DISABLED = 0x8004108a } WBEMSTATUS; +typedef [v1_enum] enum tag_WBEM_TIMEOUT_TYPE +{ + WBEM_NO_WAIT = 0, + WBEM_INFINITE = 0xffffffff +} WBEM_TIMEOUT_TYPE; + +typedef [v1_enum] enum tag_WBEM_CONDITION_FLAG_TYPE +{ + WBEM_FLAG_ALWAYS = 0, + WBEM_FLAG_ONLY_IF_TRUE = 0x1, + WBEM_FLAG_ONLY_IF_FALSE = 0x2, + WBEM_FLAG_ONLY_IF_IDENTICAL = 0x3, + WBEM_MASK_PRIMARY_CONDITION = 0x3, + WBEM_FLAG_KEYS_ONLY = 0x4, + WBEM_FLAG_REFS_ONLY = 0x8, + WBEM_FLAG_LOCAL_ONLY = 0x10, + WBEM_FLAG_PROPAGATED_ONLY = 0x20, + WBEM_FLAG_SYSTEM_ONLY = 0x30, + WBEM_FLAG_NONSYSTEM_ONLY = 0x40, + WBEM_MASK_CONDITION_ORIGIN = 0x70, + WBEM_FLAG_CLASS_OVERRIDES_ONLY = 0x100, + WBEM_FLAG_CLASS_LOCAL_AND_OVERRIDES = 0x200, + WBEM_MASK_CLASS_CONDITION = 0x300 +} WBEM_CONDITION_FLAG_TYPE; + +typedef [v1_enum] enum tag_WBEM_FLAVOR_TYPE +{ + WBEM_FLAVOR_DONT_PROPAGATE = 0, + WBEM_FLAVOR_FLAG_PROPAGATE_TO_INSTANCE = 0x1, + WBEM_FLAVOR_FLAG_PROPAGATE_TO_DERIVED_CLASS = 0x2, + WBEM_FLAVOR_MASK_PROPAGATION = 0xf, + WBEM_FLAVOR_OVERRIDABLE = 0, + WBEM_FLAVOR_NOT_OVERRIDABLE = 0x10, + WBEM_FLAVOR_MASK_PERMISSIONS = 0x10, + WBEM_FLAVOR_ORIGIN_LOCAL = 0, + WBEM_FLAVOR_ORIGIN_PROPAGATED = 0x20, + WBEM_FLAVOR_ORIGIN_SYSTEM = 0x40, + WBEM_FLAVOR_MASK_ORIGIN = 0x60, + WBEM_FLAVOR_NOT_AMENDED = 0, + WBEM_FLAVOR_AMENDED = 0x80, + WBEM_FLAVOR_MASK_AMENDED = 0x80 +} WBEM_FLAVOR_TYPE; + +typedef [v1_enum] enum tag_WBEM_GENUS_TYPE +{ + WBEM_GENUS_CLASS = 1, + WBEM_GENUS_INSTANCE = 2 +} WBEM_GENUS_TYPE; + +typedef [v1_enum] enum tag_CIMTYPE_ENUMERATION +{ + CIM_ILLEGAL = 0xfff, + CIM_EMPTY = 0, + CIM_SINT16 = 2, + CIM_SINT32 = 3, + CIM_REAL32 = 4, + CIM_REAL64 = 5, + CIM_STRING = 8, + CIM_BOOLEAN = 11, + CIM_OBJECT = 13, + CIM_SINT8 = 16, + CIM_UINT8 = 17, + CIM_UINT16 = 18, + CIM_UINT32 = 19, + CIM_SINT64 = 20, + CIM_UINT64 = 21, + CIM_DATETIME = 101, + CIM_REFERENCE = 102, + CIM_CHAR16 = 103, + CIM_FLAG_ARRAY = 0x2000 +} CIMTYPE_ENUMERATION; + +typedef long CIMTYPE; + [ object, restricted, @@ -214,6 +290,24 @@ interface IWbemStatusCodeText : IUnknown [out] BSTR *MessageText); }; +typedef [v1_enum] enum tag_WBEM_GENERIC_FLAG_TYPE +{ + WBEM_FLAG_RETURN_WBEM_COMPLETE = 0, + WBEM_FLAG_BIDIRECTIONAL = 0, + WBEM_FLAG_RETURN_ERROR_OBJECT = 0, + WBEM_FLAG_DONT_SEND_STATUS = 0, + WBEM_FLAG_SEND_ONLY_SELECTED = 0, + WBEM_FLAG_RETURN_IMMEDIATELY = 0x10, + WBEM_FLAG_FORWARD_ONLY = 0x20, + WBEM_FLAG_NO_ERROR_OBJECT = 0x40, + WBEM_FLAG_SEND_STATUS = 0x80, + WBEM_FLAG_ENSURE_LOCATABLE = 0x100, + WBEM_FLAG_DIRECT_READ = 0x200, + WBEM_MASK_RESERVED_FLAGS = 0x1f000, + WBEM_FLAG_USE_AMENDED_QUALIFIERS = 0x20000, + WBEM_FLAG_STRONG_VALIDATION = 0x100000 +} WBEM_GENERIC_FLAG_TYPE; + [ object, restricted, @@ -393,3 +487,151 @@ interface IEnumWbemClassObject : IUnknown [in] long lTimeout, [in] ULONG nCount); }; + +[ + object, + restricted, + local, + uuid(dc12a681-737f-11cf-884d-00aa004b2e24) +] +interface IWbemClassObject : IUnknown +{ + HRESULT GetQualifierSet( + [out] IWbemQualifierSet **ppQualSet); + + HRESULT Get( + [in,string] LPCWSTR wszName, + [in] long lFlags, + [out] VARIANT *pVal, + [out] CIMTYPE *pType, + [out] long *plFlavor); + + HRESULT Put( + [in,string] LPCWSTR wszName, + [in] long lFlags, + [in] VARIANT *pVal, + [in] CIMTYPE Type); + + HRESULT Delete( + [in,string] LPCWSTR wszName); + + HRESULT GetNames( + [in,string] LPCWSTR wszQualifierName, + [in] long lFlags, + [in] VARIANT *pQualifierVal, + [out] SAFEARRAY **pNames); + + HRESULT BeginEnumeration( + [in] long lEnumFlags); + + HRESULT Next( + [in] long lFlags, + [out] BSTR *strName, + [out] VARIANT *pVal, + [out] CIMTYPE *pType, + [out] long *plFlavor); + + HRESULT EndEnumeration(); + + HRESULT GetPropertyQualifierSet( + [in,string] LPCWSTR wszProperty, + [out] IWbemQualifierSet **ppQualSet); + + HRESULT Clone( + [out] IWbemClassObject **ppCopy); + + HRESULT GetObjectText( + [in] long lFlags, + [out] BSTR *pstrObjectText); + + HRESULT SpawnDerivedClass( + [in] long lFlags, + [out] IWbemClassObject **ppNewClass); + + HRESULT SpawnInstance( + [in] long lFlags, + [out] IWbemClassObject **ppNewInstance); + + HRESULT CompareTo( + [in] long lFlags, + [in] IWbemClassObject *pCompareTo); + + HRESULT GetPropertyOrigin( + [in,string] LPCWSTR wszName, + [out] BSTR *pstrClassName); + + HRESULT InheritsFrom( + [in] LPCWSTR strAncestor); + + HRESULT GetMethod( + [in,string] LPCWSTR wszName, + [in] long lFlags, + [out] IWbemClassObject **ppInSignature, + [out] IWbemClassObject **ppOutSignature); + + HRESULT PutMethod( + [in,string] LPCWSTR wszName, + [in] long lFlags, + [in] IWbemClassObject *pInSignature, + [in] IWbemClassObject *pOutSignature); + + HRESULT DeleteMethod( + [in,string] LPCWSTR wszName); + + HRESULT BeginMethodEnumeration( + [in] long lEnumFlags); + + HRESULT NextMethod( + [in] long lFlags, + [out] BSTR *pstrName, + [out] IWbemClassObject **ppInSignature, + [out] IWbemClassObject **ppOutSignature); + + HRESULT EndMethodEnumeration(); + + HRESULT GetMethodQualifierSet( + [in,string] LPCWSTR wszMethod, + [out] IWbemQualifierSet **ppQualSet); + + HRESULT GetMethodOrigin( + [in,string] LPCWSTR wszMethodName, + [out] BSTR *pstrClassName); +} + +[ + object, + restricted, + local, + uuid(dc12a680-737f-11cf-884d-00aa004b2e24) +] +interface IWbemQualifierSet : IUnknown +{ + HRESULT Get( + [in,string] LPCWSTR wszName, + [in] long lFlags, + [out] VARIANT *pVal, + [out] long *plFlavor); + + HRESULT Put( + [in,string] LPCWSTR wszName, + [in] VARIANT *pVal, + [in] long lFlavor); + + HRESULT Delete( + [in,string] LPCWSTR wszName); + + HRESULT GetNames( + [in] long lFlags, + [out] SAFEARRAY **pNames); + + HRESULT BeginEnumeration( + [in] long lFlags); + + HRESULT Next( + [in] long lFlags, + [out] BSTR *pstrName, + [out] VARIANT *pVal, + [out] long *plFlavor); + + HRESULT EndEnumeration(); +}; diff --git a/reactos/include/psdk/wbemprov.idl b/reactos/include/psdk/wbemprov.idl new file mode 100644 index 00000000000..bb9f1b16f46 --- /dev/null +++ b/reactos/include/psdk/wbemprov.idl @@ -0,0 +1,28 @@ +/* + * Copyright 2012 Hans Leidekker for CodeWeavers + * + * 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 + */ + +[ + uuid(092df710-7010-11d1-ad90-00c04fd8fdff) +] +library WbemProviders_v1 +{ + [ + uuid(cb8555cc-9128-11d1-ad9b-00c04fd8fdff) + ] + coclass WbemAdministrativeLocator { interface IWbemLocator; } +} diff --git a/reactos/include/psdk/winternl.h b/reactos/include/psdk/winternl.h index dd1a3903264..d181ce1b736 100644 --- a/reactos/include/psdk/winternl.h +++ b/reactos/include/psdk/winternl.h @@ -1084,19 +1084,17 @@ typedef struct _RTL_RWLOCK { typedef struct _SYSTEM_BASIC_INFORMATION { #ifdef __WINESRC__ - DWORD dwUnknown1; - ULONG uKeMaximumIncrement; - ULONG uPageSize; - ULONG uMmNumberOfPhysicalPages; - ULONG uMmLowestPhysicalPage; - ULONG uMmHighestPhysicalPage; - ULONG uAllocationGranularity; - PVOID pLowestUserAddress; - PVOID pMmHighestUserAddress; - ULONG uKeActiveProcessors; - BYTE bKeNumberProcessors; - BYTE bUnknown2; - WORD wUnknown3; + DWORD unknown; + ULONG KeMaximumIncrement; + ULONG PageSize; + ULONG MmNumberOfPhysicalPages; + ULONG MmLowestPhysicalPage; + ULONG MmHighestPhysicalPage; + ULONG_PTR AllocationGranularity; + PVOID LowestUserAddress; + PVOID HighestUserAddress; + ULONG_PTR ActiveProcessorsAffinityMask; + BYTE NumberOfProcessors; #else BYTE Reserved1[24]; PVOID Reserved2[4]; diff --git a/reactos/media/doc/README.WINE b/reactos/media/doc/README.WINE index bb221015655..b115bba207d 100644 --- a/reactos/media/doc/README.WINE +++ b/reactos/media/doc/README.WINE @@ -187,6 +187,7 @@ reactos/dll/win32/usp10 # Synced to Wine-1.5.26 reactos/dll/win32/uxtheme # Forked reactos/dll/win32/vbscript # Synced to Wine-1.5.26 reactos/dll/win32/version # Autosync +reactos/dll/win32/wbemprox # Synced to Wine-1.5.26 reactos/dll/win32/wer # Autosync reactos/dll/win32/windowscodecs # Synced to Wine-1.5.26 reactos/dll/win32/winemp3.acm # Synced to Wine-1.5.19 diff --git a/reactos/media/inf/syssetup.inf b/reactos/media/inf/syssetup.inf index 0c5a04aeef8..8f7c8c52a52 100644 --- a/reactos/media/inf/syssetup.inf +++ b/reactos/media/inf/syssetup.inf @@ -98,6 +98,7 @@ AddReg=Classes 11,,wininet.dll,2 11,,wintrust.dll,1 11,,wuapi.dll,1 +11,wbem,wbemprox.dll,1 [TypeLibraries] stdole2.tlb