From 3f45fd516ad9202a711422eff610e8dc418c2258 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Mon, 31 Aug 2015 19:34:37 +0000 Subject: [PATCH] [VSSAPI] Import from Wine Staging 1.7.47. Thanks to Thomas Faber for his help. [PSDK] Import vss.idl and vswriter.h from Wine Staging 1.7.47. CORE-9924 CORE-9965 svn path=/trunk/; revision=68883 --- reactos/dll/win32/CMakeLists.txt | 1 + reactos/dll/win32/vssapi/CMakeLists.txt | 19 ++++ reactos/dll/win32/vssapi/main.c | 120 ++++++++++++++++++++++++ reactos/dll/win32/vssapi/msvc.s | 23 +++++ reactos/dll/win32/vssapi/vssapi.spec | 84 +++++++++++++++++ reactos/include/psdk/CMakeLists.txt | 1 + reactos/include/psdk/vss.idl | 31 ++++++ reactos/include/psdk/vswriter.h | 47 ++++++++++ reactos/media/doc/README.WINE | 1 + 9 files changed, 327 insertions(+) create mode 100644 reactos/dll/win32/vssapi/CMakeLists.txt create mode 100644 reactos/dll/win32/vssapi/main.c create mode 100644 reactos/dll/win32/vssapi/msvc.s create mode 100644 reactos/dll/win32/vssapi/vssapi.spec create mode 100644 reactos/include/psdk/vss.idl create mode 100644 reactos/include/psdk/vswriter.h diff --git a/reactos/dll/win32/CMakeLists.txt b/reactos/dll/win32/CMakeLists.txt index 4dfc59354ef..31545518526 100644 --- a/reactos/dll/win32/CMakeLists.txt +++ b/reactos/dll/win32/CMakeLists.txt @@ -218,6 +218,7 @@ add_subdirectory(usp10) add_subdirectory(uxtheme) add_subdirectory(vbscript) add_subdirectory(version) +add_subdirectory(vssapi) add_subdirectory(wbemdisp) add_subdirectory(wbemprox) if(ARCH STREQUAL "i386") diff --git a/reactos/dll/win32/vssapi/CMakeLists.txt b/reactos/dll/win32/vssapi/CMakeLists.txt new file mode 100644 index 00000000000..a9865695931 --- /dev/null +++ b/reactos/dll/win32/vssapi/CMakeLists.txt @@ -0,0 +1,19 @@ + +add_definitions(-D__WINESRC__) +include_directories(BEFORE ${REACTOS_SOURCE_DIR}/include/reactos/wine) +spec2def(vssapi.dll vssapi.spec) + +list(APPEND SOURCE + main.c + ${CMAKE_CURRENT_BINARY_DIR}/vssapi_stubs.c + ${CMAKE_CURRENT_BINARY_DIR}/vssapi.def) + +if(MSVC) + add_asm_files(vssapi_asm msvc.s) +endif() + +add_library(vssapi SHARED ${SOURCE} ${vssapi_asm}) +set_module_type(vssapi win32dll) +target_link_libraries(vssapi wine) +add_importlibs(vssapi msvcrt kernel32 ntdll) +add_cd_file(TARGET vssapi DESTINATION reactos/system32 FOR all) diff --git a/reactos/dll/win32/vssapi/main.c b/reactos/dll/win32/vssapi/main.c new file mode 100644 index 00000000000..427447c2a15 --- /dev/null +++ b/reactos/dll/win32/vssapi/main.c @@ -0,0 +1,120 @@ +/* + * Copyright 2014 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 "vss.h" +#include "vswriter.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL( vssapi ); + +#ifdef __i386__ /* thiscall functions are i386-specific */ + +#define THISCALL(func) __thiscall_ ## func +#define THISCALL_NAME(func) __ASM_NAME("__thiscall_" #func) +#undef __thiscall +#define __thiscall __stdcall +#ifdef _MSC_VER +#define DEFINE_THISCALL_WRAPPER(func,args) \ + void __declspec(naked) __thiscall_ ##func(void) \ + { \ + __asm { pop eax } \ + __asm { push ecx } \ + __asm { push eax } \ + __asm { jmp func } \ + } +#else +#define DEFINE_THISCALL_WRAPPER(func,args) \ + extern void THISCALL(func)(void); \ + __ASM_GLOBAL_FUNC(__thiscall_ ## func, \ + "popl %eax\n\t" \ + "pushl %ecx\n\t" \ + "pushl %eax\n\t" \ + "jmp " __ASM_NAME(#func) __ASM_STDCALL(args) ) +#endif +#else /* __i386__ */ + +#define THISCALL(func) func +#define THISCALL_NAME(func) __ASM_NAME(#func) +#define __thiscall __cdecl +#define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */ + +#endif /* __i386__ */ + +struct CVssWriter +{ + void **vtable; +}; + +/****************************************************************** + * ??0CVssWriter@@QAE@XZ (VSSAPI.@) + */ +struct CVssWriter * __thiscall VSSAPI_CVssWriter_default_ctor( struct CVssWriter *writer ) +{ + FIXME( "%p\n", writer ); + writer->vtable = NULL; + return writer; +} +DEFINE_THISCALL_WRAPPER( VSSAPI_CVssWriter_default_ctor, 4 ) + +/****************************************************************** + * ??1CVssWriter@@UAE@XZ (VSSAPI.@) + */ +void __thiscall VSSAPI_CVssWriter_dtor( struct CVssWriter *writer ) +{ + FIXME( "%p\n", writer ); +} +DEFINE_THISCALL_WRAPPER( VSSAPI_CVssWriter_dtor, 4 ) + +/****************************************************************** + * ?Initialize@CVssWriter@@QAGJU_GUID@@PBGW4VSS_USAGE_TYPE@@W4VSS_SOURCE_TYPE@@W4_VSS_APPLICATION_LEVEL@@KW4VSS_ALTERNATE_WRITER_STATE@@_N@Z + */ +HRESULT __thiscall VSSAPI_CVssWriter_Initialize( struct CVssWriter *writer, VSS_ID id, + LPCWSTR name, VSS_USAGE_TYPE usage_type, VSS_SOURCE_TYPE source_type, + VSS_APPLICATION_LEVEL level, DWORD timeout, VSS_ALTERNATE_WRITER_STATE alt_writer_state, + BOOL throttle, LPCWSTR instance ) +{ + FIXME( "%p, %s, %s, %u, %u, %u, %u, %u, %d, %s\n", writer, debugstr_guid(&id), + debugstr_w(name), usage_type, source_type, level, timeout, alt_writer_state, + throttle, debugstr_w(instance) ); + return S_OK; +} +DEFINE_THISCALL_WRAPPER( VSSAPI_CVssWriter_Initialize, 52 ) + +/****************************************************************** + * ?Subscribe@CVssWriter@@QAGJK@Z + */ +HRESULT __thiscall VSSAPI_CVssWriter_Subscribe( struct CVssWriter *writer, DWORD flags ) +{ + FIXME( "%p, %x\n", writer, flags ); + return S_OK; +} +DEFINE_THISCALL_WRAPPER( VSSAPI_CVssWriter_Subscribe, 8 ) + +/****************************************************************** + * ?Unsubscribe@CVssWriter@@QAGJXZ + */ +HRESULT __thiscall VSSAPI_CVssWriter_Unsubscribe( struct CVssWriter *writer ) +{ + FIXME( "%p\n", writer ); + return S_OK; +} +DEFINE_THISCALL_WRAPPER( VSSAPI_CVssWriter_Unsubscribe, 4 ) diff --git a/reactos/dll/win32/vssapi/msvc.s b/reactos/dll/win32/vssapi/msvc.s new file mode 100644 index 00000000000..15121c10e8a --- /dev/null +++ b/reactos/dll/win32/vssapi/msvc.s @@ -0,0 +1,23 @@ + +#include + +.code +.align 4 + +MACRO(DEFINE_THISCALL_WRAPPER, cxxname, stdcallname) +EXTERN &stdcallname:PROC +PUBLIC &cxxname +&cxxname: + pop eax + push ecx + push eax + jmp &stdcallname +ENDM + +DEFINE_THISCALL_WRAPPER ??0CVssWriter@@QAE@XZ, _VSSAPI_CVssWriter_default_ctor@4 +DEFINE_THISCALL_WRAPPER ??1CVssWriter@@UAE@XZ, _VSSAPI_CVssWriter_dtor@4 +DEFINE_THISCALL_WRAPPER ?Initialize@CVssWriter@@QAGJU_GUID@@PBGW4VSS_USAGE_TYPE@@W4VSS_SOURCE_TYPE@@W4_VSS_APPLICATION_LEVEL@@KW4VSS_ALTERNATE_WRITER_STATE@@_N@Z, _VSSAPI_CVssWriter_Initialize@52 +DEFINE_THISCALL_WRAPPER ?Subscribe@CVssWriter@@QAGJK@Z, _VSSAPI_CVssWriter_Subscribe@8 +DEFINE_THISCALL_WRAPPER ?Unsubscribe@CVssWriter@@QAGJXZ, _VSSAPI_CVssWriter_Unsubscribe@4 + +END diff --git a/reactos/dll/win32/vssapi/vssapi.spec b/reactos/dll/win32/vssapi/vssapi.spec new file mode 100644 index 00000000000..84f9003ddc5 --- /dev/null +++ b/reactos/dll/win32/vssapi/vssapi.spec @@ -0,0 +1,84 @@ +@ stub IsVolumeSnapshotted +@ stub VssFreeSnapshotProperties +@ stub ShouldBlockRevert +@ stub ??0CVssJetWriter@@QAE@XZ +@ cdecl -arch=i386 ??0CVssWriter@@QAE@XZ(ptr) __thiscall_VSSAPI_CVssWriter_default_ctor +@ stub ??1CVssJetWriter@@UAE@XZ +@ cdecl -arch=i386 ??1CVssWriter@@UAE@XZ(ptr) __thiscall_VSSAPI_CVssWriter_dtor +@ stub ?AreComponentsSelected@CVssJetWriter@@IBG_NXZ +@ stub ?AreComponentsSelected@CVssWriter@@IBG_NXZ +@ stub ?CreateVssBackupComponents@@YGJPAPAVIVssBackupComponents@@@Z +@ stub ?CreateVssExamineWriterMetadata@@YGJPAGPAPAVIVssExamineWriterMetadata@@@Z +@ stub ?CreateVssSnapshotSetDescription@@YGJU_GUID@@JPAPAVIVssSnapshotSetDescription@@@Z +@ stub ?GetBackupType@CVssJetWriter@@IBG?AW4_VSS_BACKUP_TYPE@@XZ +@ stub ?GetBackupType@CVssWriter@@IBG?AW4_VSS_BACKUP_TYPE@@XZ +@ stub ?GetContext@CVssJetWriter@@IBGJXZ +@ stub ?GetContext@CVssWriter@@IBGJXZ +@ stub ?GetCurrentLevel@CVssJetWriter@@IBG?AW4_VSS_APPLICATION_LEVEL@@XZ +@ stub ?GetCurrentLevel@CVssWriter@@IBG?AW4_VSS_APPLICATION_LEVEL@@XZ +@ stub ?GetCurrentSnapshotSetId@CVssJetWriter@@IBG?AU_GUID@@XZ +@ stub ?GetCurrentSnapshotSetId@CVssWriter@@IBG?AU_GUID@@XZ +@ stub ?GetCurrentVolumeArray@CVssJetWriter@@IBGPAPBGXZ +@ stub ?GetCurrentVolumeArray@CVssWriter@@IBGPAPBGXZ +@ stub ?GetCurrentVolumeCount@CVssJetWriter@@IBGIXZ +@ stub ?GetCurrentVolumeCount@CVssWriter@@IBGIXZ +@ stub ?GetRestoreType@CVssJetWriter@@IBG?AW4_VSS_RESTORE_TYPE@@XZ +@ stub ?GetRestoreType@CVssWriter@@IBG?AW4_VSS_RESTORE_TYPE@@XZ +@ stub ?GetSnapshotDeviceName@CVssJetWriter@@IBGJPBGPAPBG@Z +@ stub ?GetSnapshotDeviceName@CVssWriter@@IBGJPBGPAPBG@Z +@ stub ?Initialize@CVssJetWriter@@QAGJU_GUID@@PBG_N211K@Z +@ cdecl -arch=i386 ?Initialize@CVssWriter@@QAGJU_GUID@@PBGW4VSS_USAGE_TYPE@@W4VSS_SOURCE_TYPE@@W4_VSS_APPLICATION_LEVEL@@KW4VSS_ALTERNATE_WRITER_STATE@@_N@Z(ptr ptr wstr long long long long long long wstr) __thiscall_VSSAPI_CVssWriter_Initialize +@ stub ?InstallAlternateWriter@CVssWriter@@QAGJU_GUID@@0@Z +@ stub ?IsBootableSystemStateBackedUp@CVssJetWriter@@IBG_NXZ +@ stub ?IsBootableSystemStateBackedUp@CVssWriter@@IBG_NXZ +@ stub ?IsPartialFileSupportEnabled@CVssJetWriter@@IBG_NXZ +@ stub ?IsPartialFileSupportEnabled@CVssWriter@@IBG_NXZ +@ stub ?IsPathAffected@CVssJetWriter@@IBG_NPBG@Z +@ stub ?IsPathAffected@CVssWriter@@IBG_NPBG@Z +@ stub ?LoadVssSnapshotSetDescription@@YGJPBGPAPAVIVssSnapshotSetDescription@@U_GUID@@@Z +@ stub ?OnAbortBegin@CVssJetWriter@@UAGXXZ +@ stub ?OnAbortEnd@CVssJetWriter@@UAGXXZ +@ stub ?OnBackOffIOOnVolume@CVssWriter@@UAG_NPAGU_GUID@@1@Z +@ stub ?OnBackupComplete@CVssWriter@@UAG_NPAVIVssWriterComponents@@@Z +@ stub ?OnBackupCompleteBegin@CVssJetWriter@@UAG_NPAVIVssWriterComponents@@@Z +@ stub ?OnBackupCompleteEnd@CVssJetWriter@@UAG_NPAVIVssWriterComponents@@_N@Z +@ stub ?OnBackupShutdown@CVssWriter@@UAG_NU_GUID@@@Z +@ stub ?OnContinueIOOnVolume@CVssWriter@@UAG_NPAGU_GUID@@1@Z +@ stub ?OnFreezeBegin@CVssJetWriter@@UAG_NXZ +@ stub ?OnFreezeEnd@CVssJetWriter@@UAG_N_N@Z +@ stub ?OnIdentify@CVssJetWriter@@UAG_NPAVIVssCreateWriterMetadata@@@Z +@ stub ?OnIdentify@CVssWriter@@UAG_NPAVIVssCreateWriterMetadata@@@Z +@ stub ?OnPostRestore@CVssWriter@@UAG_NPAVIVssWriterComponents@@@Z +@ stub ?OnPostRestoreBegin@CVssJetWriter@@UAG_NPAVIVssWriterComponents@@@Z +@ stub ?OnPostRestoreEnd@CVssJetWriter@@UAG_NPAVIVssWriterComponents@@_N@Z +@ stub ?OnPostSnapshot@CVssJetWriter@@UAG_NPAVIVssWriterComponents@@@Z +@ stub ?OnPostSnapshot@CVssWriter@@UAG_NPAVIVssWriterComponents@@@Z +@ stub ?OnPreRestore@CVssWriter@@UAG_NPAVIVssWriterComponents@@@Z +@ stub ?OnPreRestoreBegin@CVssJetWriter@@UAG_NPAVIVssWriterComponents@@@Z +@ stub ?OnPreRestoreEnd@CVssJetWriter@@UAG_NPAVIVssWriterComponents@@_N@Z +@ stub ?OnPrepareBackup@CVssWriter@@UAG_NPAVIVssWriterComponents@@@Z +@ stub ?OnPrepareBackupBegin@CVssJetWriter@@UAG_NPAVIVssWriterComponents@@@Z +@ stub ?OnPrepareBackupEnd@CVssJetWriter@@UAG_NPAVIVssWriterComponents@@_N@Z +@ stub ?OnPrepareSnapshotBegin@CVssJetWriter@@UAG_NXZ +@ stub ?OnPrepareSnapshotEnd@CVssJetWriter@@UAG_N_N@Z +@ stub ?OnThawBegin@CVssJetWriter@@UAG_NXZ +@ stub ?OnThawEnd@CVssJetWriter@@UAG_N_N@Z +@ stub ?OnVSSApplicationStartup@CVssWriter@@UAG_NXZ +@ stub ?OnVSSShutdown@CVssWriter@@UAG_NXZ +@ stub ?SetWriterFailure@CVssJetWriter@@IAGJJ@Z +@ stub ?SetWriterFailure@CVssWriter@@IAGJJ@Z +@ cdecl -arch=i386 ?Subscribe@CVssWriter@@QAGJK@Z(ptr long) __thiscall_VSSAPI_CVssWriter_Subscribe +@ stub ?Uninitialize@CVssJetWriter@@QAGXXZ +@ cdecl -arch=i386 ?Unsubscribe@CVssWriter@@QAGJXZ(ptr) __thiscall_VSSAPI_CVssWriter_Unsubscribe +@ stub CreateVssBackupComponentsInternal +@ stub CreateVssExamineWriterMetadataInternal +@ stub CreateVssExpressWriterInternal +@ stub CreateWriter +@ stub CreateWriterEx +@ stub -private DllCanUnloadNow +@ stub -private DllGetClassObject +@ stub GetProviderMgmtInterface +@ stub GetProviderMgmtInterfaceInternal +@ stub IsVolumeSnapshottedInternal +@ stub ShouldBlockRevertInternal +@ stub VssFreeSnapshotPropertiesInternal diff --git a/reactos/include/psdk/CMakeLists.txt b/reactos/include/psdk/CMakeLists.txt index 5de7dc5523c..a6ffd097890 100644 --- a/reactos/include/psdk/CMakeLists.txt +++ b/reactos/include/psdk/CMakeLists.txt @@ -116,6 +116,7 @@ list(APPEND SOURCE urlmon.idl vmr9.idl # vmrender.idl + vss.idl wbemcli.idl wbemdisp.idl wbemprov.idl diff --git a/reactos/include/psdk/vss.idl b/reactos/include/psdk/vss.idl new file mode 100644 index 00000000000..62335ea8408 --- /dev/null +++ b/reactos/include/psdk/vss.idl @@ -0,0 +1,31 @@ +/* + * Copyright 2014 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 + */ + +import "oaidl.idl"; + +typedef GUID VSS_ID; + +typedef enum _VSS_APPLICATION_LEVEL +{ + VSS_APP_AUTO = -1, + VSS_APP_UNKNOWN = 0, + VSS_APP_SYSTEM = 1, + VSS_APP_BACK_END = 2, + VSS_APP_FRONT_END = 3, + VSS_APP_SYSTEM_RM = 4 +} VSS_APPLICATION_LEVEL; diff --git a/reactos/include/psdk/vswriter.h b/reactos/include/psdk/vswriter.h new file mode 100644 index 00000000000..043b871cb60 --- /dev/null +++ b/reactos/include/psdk/vswriter.h @@ -0,0 +1,47 @@ +/* + * Copyright 2014 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 + */ + +#ifndef __WINE_VSWRITER_H +#define __WINE_VSWRITER_H + +typedef enum +{ + VSS_UT_UNDEFINED, + VSS_UT_BOOTABLESYSTEMSTATE, + VSS_UT_SYSTEMSERVICE, + VSS_UT_USERDATA, + VSS_UT_OTHER +} VSS_USAGE_TYPE; + +typedef enum +{ + VSS_ST_UNDEFINED, + VSS_ST_TRANSACTEDDB, + VSS_ST_NONTRANSACTEDDB, + VSS_ST_OTHER +} VSS_SOURCE_TYPE; + +typedef enum +{ + VSS_AWS_UNDEFINED, + VSS_AWS_NO_ALTERNATE_WRITER, + VSS_AWS_ALTERNATE_WRITER_EXISTS, + VSS_AWS_THIS_IS_ALTERNATE_WRITER +} VSS_ALTERNATE_WRITER_STATE; + +#endif /* ___WINE_VSWRITER_H */ diff --git a/reactos/media/doc/README.WINE b/reactos/media/doc/README.WINE index a73a91e01f4..c52d632a73e 100644 --- a/reactos/media/doc/README.WINE +++ b/reactos/media/doc/README.WINE @@ -199,6 +199,7 @@ reactos/dll/win32/usp10 # Synced to WineStaging-1.7.47 reactos/dll/win32/uxtheme # Forked reactos/dll/win32/vbscript # Synced to WineStaging-1.7.47 reactos/dll/win32/version # Synced to WineStaging-1.7.47 +reactos/dll/win32/vssapi # Synced to WineStaging-1.7.47 reactos/dll/win32/wbemdisp # Synced to WineStaging-1.7.47 reactos/dll/win32/wbemprox # Synced to WineStaging-1.7.47 reactos/dll/win32/windowscodecs # Synced to WineStaging-1.7.47