diff options
Diffstat (limited to 'Src/Elevator')
27 files changed, 3019 insertions, 0 deletions
diff --git a/Src/Elevator/Elevator.cpp b/Src/Elevator/Elevator.cpp new file mode 100644 index 00000000..24e3ee92 --- /dev/null +++ b/Src/Elevator/Elevator.cpp @@ -0,0 +1,308 @@ +// Elevator.cpp : Implementation of WinMain + +#include "stdafx.h" +#include "resource1.h" +#include "FileTypeRegistrar.h" +#include "ElevatorFactory.h" +#include <sddl.h> +#include <strsafe.h> + +HRESULT RegisterServer(HINSTANCE hInstance); +HRESULT UnregisterServer(HINSTANCE hInstance); + +DWORD g_allLocks = 0; +int APIENTRY WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) +{ + if (lpCmdLine == NULL || !*lpCmdLine) + { + MSGBOXPARAMSW msgbx = {sizeof(MSGBOXPARAMS),0}; + msgbx.lpszText = L"Winamp Elevator\nCopyright © 2008-2014 Winamp SA"; + msgbx.lpszCaption = L"About..."; + msgbx.lpszIcon = MAKEINTRESOURCEW(IDI_ICON1); + msgbx.hInstance = GetModuleHandle(0); + msgbx.dwStyle = MB_USERICON; + MessageBoxIndirectW(&msgbx); + return 0; + } + + if ( lpCmdLine != NULL && ( _strcmpi( lpCmdLine, "/RegServer" ) == 0 + || _strcmpi( lpCmdLine, "-RegServer" ) == 0 )) { + RegisterServer(hInstance); + return 0; + } + + if ( lpCmdLine != NULL && ( _strcmpi( lpCmdLine, "/UnregServer" ) == 0 + || _strcmpi( lpCmdLine, "-UnregServer" ) == 0 )) { + UnregisterServer(hInstance); + return 0; + } + CoInitialize(NULL); + + if(lpCmdLine && (strstr(lpCmdLine, "/Embedding") || strstr(lpCmdLine, "-Embedding"))) + { + ElevatorFactory cf; + DWORD regID = 0; + CoRegisterClassObject(CLSID_WFileTypeRegistrar,(IClassFactory*)&cf, CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, ®ID); + MSG ms; + while(GetMessage(&ms, 0, 0, 0)) + { + TranslateMessage(&ms); + DispatchMessage(&ms); + } + + CoRevokeClassObject(regID); + } + + CoUninitialize(); + return 0; +} + +extern FileTypeRegistrar registrar; + +void Lock() +{ + ++g_allLocks; +} + +void UnLock() +{ + --g_allLocks; + if(g_allLocks == 0 )//&& registrar.refCount == 0/* benski> a hack, for now */) + { + PostQuitMessage(0); + } +} + +static BOOL GetAccessPermissionsForLUAServer(SECURITY_DESCRIPTOR **ppSD) +{ +// Local call permissions to IU, SY + LPWSTR lpszSDDL = L"O:BAG:BAD:(A;;0x3;;;IU)(A;;0x3;;;SY)"; + SECURITY_DESCRIPTOR *pSD; + *ppSD = NULL; + + if (ConvertStringSecurityDescriptorToSecurityDescriptorW(lpszSDDL, SDDL_REVISION_1, (PSECURITY_DESCRIPTOR *)&pSD, NULL)) + { + *ppSD = pSD; + return TRUE; + } + + return FALSE; +} + +// hKey is the HKCR\AppID\{GUID} key +static BOOL SetAccessPermissions(HKEY hkey, PSECURITY_DESCRIPTOR pSD) +{ + BOOL bResult = FALSE; + DWORD dwLen = GetSecurityDescriptorLength(pSD); + LONG lResult; + lResult = RegSetValueExA(hkey, + "AccessPermission", + 0, + REG_BINARY, + (BYTE*)pSD, + dwLen); + if (lResult != ERROR_SUCCESS) goto done; + bResult = TRUE; +done: + return bResult; +} + +static BOOL GetLaunchActPermissionsWithIL (SECURITY_DESCRIPTOR **ppSD) +{ + // Allow World Local Launch/Activation permissions. Label the SD for LOW IL Execute UP + LPWSTR lpszSDDL = L"O:BAG:BAD:(A;;0xb;;;WD)S:(ML;;NX;;;LW)"; + SECURITY_DESCRIPTOR *pSD; + if (ConvertStringSecurityDescriptorToSecurityDescriptorW(lpszSDDL, SDDL_REVISION_1, (PSECURITY_DESCRIPTOR *)&pSD, NULL)) + { + *ppSD = pSD; + return TRUE; + } + return FALSE; +} + +static BOOL SetLaunchActPermissions(HKEY hkey, PSECURITY_DESCRIPTOR pSD) +{ + BOOL bResult = FALSE; + DWORD dwLen = GetSecurityDescriptorLength(pSD); + LONG lResult; + lResult = RegSetValueExA(hkey, + "LaunchPermission", + 0, + REG_BINARY, + (BYTE*)pSD, + dwLen); + if (lResult != ERROR_SUCCESS) goto done; + bResult = TRUE; +done: + return bResult; +}; + +static HRESULT UnregisterComponent(const CLSID &clsid, LPCWSTR pszVersionIndProgId, LPCWSTR pszProgId); +static HRESULT RegisterComponent(HMODULE hModule, const CLSID &clsid, LPCWSTR pszFriendlyName, LPCWSTR pszVersionIndProgId, LPCWSTR pszProgId); + +static const WCHAR szComponentFriendlyName[] = L"Winamp Elevator"; +static const WCHAR szVersionIndependentProgId[] = L"Elevator.WFileTypeRegistrar2"; +static const WCHAR szProgId[] = L"Elevator.WFileTypeRegistrar2.1"; + +HRESULT RegisterServer(HINSTANCE hInstance) +{ + HRESULT hr(S_OK); + hr = RegisterComponent(hInstance, CLSID_WFileTypeRegistrar, szComponentFriendlyName, szVersionIndependentProgId, szProgId); + return hr; +} + +HRESULT UnregisterServer(HINSTANCE hInstance) +{ + HRESULT hr(S_OK); + hr = UnregisterComponent(CLSID_WFileTypeRegistrar, szVersionIndependentProgId, szProgId); + return hr; +} + +static BOOL WriteRegKey(HKEY hKeyParent, LPCWSTR pszKey, LPCWSTR pszValue, HKEY *phKey = NULL) +{ + HKEY hKey; + LONG result; + result = RegCreateKeyExW(hKeyParent, pszKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL); + if (ERROR_SUCCESS != result || !hKey) return FALSE; + if (pszValue) + { + result = RegSetValueExW(hKey, NULL, 0, REG_SZ, (BYTE*)pszValue, (DWORD)(sizeof(wchar_t)*(1 + lstrlenW(pszValue)))); + } + if (!phKey) RegCloseKey(hKey); + else *phKey = hKey; + + return (ERROR_SUCCESS == result); +} + +static BOOL WriteRegValue(HKEY hKeyParent, LPCWSTR pszKey, LPCWSTR pszEntry, LPCWSTR pszValue) +{ + HKEY hKey; + LONG result; + result = RegOpenKeyExW(hKeyParent, pszKey, 0, KEY_SET_VALUE, &hKey); + if (ERROR_SUCCESS != result || !hKey) return FALSE; + if (pszValue) + { + result = RegSetValueEx(hKey, pszEntry, 0, REG_SZ, (BYTE*)pszValue, (DWORD)(sizeof(wchar_t)*(1 + lstrlenW(pszValue)))); + } + RegCloseKey(hKey); + return (ERROR_SUCCESS == result); +} + +static BOOL WriteRegValue(HKEY hKeyParent, LPCWSTR pszKey, LPCWSTR pszEntry, DWORD pszValue) +{ + HKEY hKey; + LONG result; + result = RegOpenKeyExW(hKeyParent, pszKey, 0, KEY_SET_VALUE, &hKey); + if (ERROR_SUCCESS != result || !hKey) return FALSE; + if (pszValue) + { + result = RegSetValueEx(hKey, pszEntry, 0, REG_DWORD, (BYTE*)&pszValue, sizeof(DWORD)); + } + RegCloseKey(hKey); + return (ERROR_SUCCESS == result); +} + +static LONG DeleteRegKey(HKEY hKeyParent, LPCWSTR pszKey) +{ + HKEY hKey; + LONG result; + FILETIME time = {0}; + WCHAR szBuffer[512] = {0}; + DWORD dwSize = sizeof(szBuffer)/sizeof(WCHAR); + + result = RegOpenKeyExW(hKeyParent, pszKey, 0, KEY_SET_VALUE | KEY_ENUMERATE_SUB_KEYS , &hKey); + if (ERROR_SUCCESS != result) return result; + while (ERROR_SUCCESS == RegEnumKeyExW(hKey, 0, szBuffer, &dwSize, NULL, NULL, NULL, &time)) + { + if (ERROR_SUCCESS != (result = DeleteRegKey(hKey, szBuffer))) + { + RegCloseKey(hKey); + return result; + } + dwSize = sizeof(szBuffer)/sizeof(WCHAR); + } + + RegCloseKey(hKey); + return RegDeleteKeyW(hKeyParent, pszKey); +} + +HRESULT RegisterComponent(HMODULE hModule, const CLSID &clsid, LPCWSTR pszFriendlyName, LPCWSTR pszVersionIndProgId, LPCWSTR pszProgId) +{ + SECURITY_DESCRIPTOR *sd; + HKEY hKey, hKey2, hKey3; + BOOL br; + WCHAR szBuffer[MAX_PATH] = {0}, szCLSID[64] = {0}; + + if (!StringFromGUID2(clsid, szCLSID, sizeof(szCLSID)/sizeof(WCHAR))) return E_OUTOFMEMORY; + StringCchPrintfW(szBuffer, sizeof(szBuffer)/sizeof(WCHAR), L"SOFTWARE\\Classes\\CLSID\\%s", szCLSID); + + if (!WriteRegKey(HKEY_LOCAL_MACHINE, szBuffer, pszFriendlyName, &hKey)) return S_FALSE; + + if (!GetModuleFileNameW(hModule, szBuffer, sizeof(szBuffer)/sizeof(WCHAR))) return S_FALSE; + + RegCreateKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Classes\\AppID\\{3B29AB5C-52CB-4a36-9314-E3FEE0BA7468}", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey3, NULL); + if (GetAccessPermissionsForLUAServer(&sd)) + SetAccessPermissions(hKey3, sd); + if (GetLaunchActPermissionsWithIL(&sd)) + SetLaunchActPermissions(hKey3, sd); + WriteRegValue(hKey3, NULL, NULL, szBuffer); + RegCloseKey(hKey3); + + RegCreateKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Classes\\AppID\\elevator.exe", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey3, NULL); + WriteRegValue(hKey3, NULL, L"AppID", L"{3B29AB5C-52CB-4a36-9314-E3FEE0BA7468}"); + RegCloseKey(hKey3); + + wchar_t localizedString[MAX_PATH+15] = {0}; + StringCbPrintf(localizedString, sizeof(localizedString), L"@%s,-%u", szBuffer, IDS_WINAMP); + + br = (WriteRegKey(hKey, L"LocalServer32" , szBuffer, &hKey2) && + WriteRegValue(hKey2, NULL, L"ThreadingModel", L"Both") && + WriteRegKey(hKey, L"ProgID", pszProgId) && + WriteRegKey(hKey, L"VersionIndependentProgID", pszVersionIndProgId) + && WriteRegValue(hKey, NULL, L"LocalizedString", localizedString) + && WriteRegValue(hKey, NULL, L"AppId", L"{3B29AB5C-52CB-4a36-9314-E3FEE0BA7468}") + && WriteRegKey(hKey, L"Elevation", 0) + //&& WriteRegValue(hKey, L"Elevation", L"IconReference", + && WriteRegValue(hKey, L"Elevation", L"Enabled", 1) + ); + RegCloseKey(hKey); + if (hKey2) RegCloseKey(hKey2); + if (!br) return S_FALSE; + + if (!WriteRegKey(HKEY_CLASSES_ROOT, pszVersionIndProgId, pszFriendlyName, &hKey)) return S_FALSE; + br = (WriteRegKey(hKey, L"CLSID", szCLSID) && + WriteRegKey(hKey, L"CurVer", pszProgId)); + RegCloseKey(hKey); + if (!br) return S_FALSE; + + if (!WriteRegKey(HKEY_CLASSES_ROOT, pszProgId, pszFriendlyName, &hKey)) return S_FALSE; + br = WriteRegKey(hKey, L"CLSID", szCLSID); + + RegCloseKey(hKey); + + if (!br) return S_FALSE; + + return S_OK; +} + +static HRESULT UnregisterComponent(const CLSID &clsid, LPCWSTR pszVersionIndProgId, LPCWSTR pszProgId) +{ + LONG result; + WCHAR szBuffer[MAX_PATH] = {0}, szCLSID[64] = {0}; + if (!StringFromGUID2(clsid, szCLSID, sizeof(szCLSID)/sizeof(WCHAR))) return E_OUTOFMEMORY; + StringCchPrintfW(szBuffer, sizeof(szBuffer)/sizeof(WCHAR), L"CLSID\\%s", szCLSID); + + result = DeleteRegKey(HKEY_CLASSES_ROOT, szBuffer); + if (ERROR_SUCCESS != result && ERROR_FILE_NOT_FOUND != result) return S_FALSE; + + result = DeleteRegKey(HKEY_CLASSES_ROOT, pszVersionIndProgId); + if (ERROR_SUCCESS != result && ERROR_FILE_NOT_FOUND != result) return S_FALSE; + + result = DeleteRegKey(HKEY_CLASSES_ROOT, pszProgId); + if (ERROR_SUCCESS != result && ERROR_FILE_NOT_FOUND != result) return S_FALSE; + + return S_OK; +}
\ No newline at end of file diff --git a/Src/Elevator/Elevator.h b/Src/Elevator/Elevator.h new file mode 100644 index 00000000..479291b7 --- /dev/null +++ b/Src/Elevator/Elevator.h @@ -0,0 +1,97 @@ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 6.00.0361 */ +/* at Mon Mar 03 17:12:34 2008 + */ +/* Compiler settings for .\Elevator.idl: + Oicf, W1, Zp8, env=Win32 (32b run) + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +//@@MIDL_FILE_HEADING( ) + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +/* verify that the <rpcndr.h> version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 475 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of <rpcndr.h> +#endif // __RPCNDR_H_VERSION__ + + +#ifndef __Elevator_h__ +#define __Elevator_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __WFileTypeRegistrar_FWD_DEFINED__ +#define __WFileTypeRegistrar_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class WFileTypeRegistrar WFileTypeRegistrar; +#else +typedef struct WFileTypeRegistrar WFileTypeRegistrar; +#endif /* __cplusplus */ + +#endif /* __WFileTypeRegistrar_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" +#include "IFileTypeRegistrar.h" + +#ifdef __cplusplus +extern "C"{ +#endif + +void * __RPC_USER MIDL_user_allocate(size_t); +void __RPC_USER MIDL_user_free( void * ); + + +#ifndef __ElevatorLib_LIBRARY_DEFINED__ +#define __ElevatorLib_LIBRARY_DEFINED__ + +/* library ElevatorLib */ +/* [helpstring][version][uuid] */ + + +EXTERN_C const IID LIBID_ElevatorLib; + +EXTERN_C const CLSID CLSID_WFileTypeRegistrar; + +#ifdef __cplusplus + +class DECLSPEC_UUID("3B29AB5C-52CB-4a36-9314-E3FEE0BA7468") +WFileTypeRegistrar; +#endif +#endif /* __ElevatorLib_LIBRARY_DEFINED__ */ + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/Src/Elevator/Elevator.idl b/Src/Elevator/Elevator.idl new file mode 100644 index 00000000..c75d2964 --- /dev/null +++ b/Src/Elevator/Elevator.idl @@ -0,0 +1,27 @@ +// Elevator.idl : IDL source for Elevator +// + +// This file will be processed by the MIDL tool to +// produce the type library (Elevator.tlb) and marshalling code. + +import "oaidl.idl"; +import "ocidl.idl"; +import "IFileTypeRegistrar.idl"; +[ + uuid(B3600382-8669-402B-81B2-3D18B0E2318B), + version(1.0), + helpstring("Elevator 1.0 Type Library") +] +library ElevatorLib +{ + importlib("stdole2.tlb"); + [ + uuid(3B29AB5C-52CB-4a36-9314-E3FEE0BA7468), + appobject + ] + coclass WFileTypeRegistrar + { + [default] interface IFileTypeRegistrar; + }; +}; + diff --git a/Src/Elevator/Elevator.rc b/Src/Elevator/Elevator.rc new file mode 100644 index 00000000..c9b2033a --- /dev/null +++ b/Src/Elevator/Elevator.rc @@ -0,0 +1,83 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource1.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource1.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "#include ""version.rc2""\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_ICON1 ICON "..\\Winamp\\resource\\WinampIcon.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDS_WINAMP "Winamp" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/Src/Elevator/Elevator.rgs b/Src/Elevator/Elevator.rgs new file mode 100644 index 00000000..27ecb8f0 --- /dev/null +++ b/Src/Elevator/Elevator.rgs @@ -0,0 +1,11 @@ +HKCR +{ + NoRemove AppID + { + '%APPID%' = s 'Elevator' + 'Elevator.EXE' + { + val AppID = s '%APPID%' + } + } +} diff --git a/Src/Elevator/Elevator.sln b/Src/Elevator/Elevator.sln new file mode 100644 index 00000000..2dea7fc1 --- /dev/null +++ b/Src/Elevator/Elevator.sln @@ -0,0 +1,43 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29424.173 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "elevator", "elevator.vcxproj", "{977153BF-8420-4C8D-AA25-592FAEDB6CBA}" + ProjectSection(ProjectDependencies) = postProject + {A929EC04-302E-4B4F-B2A3-65AF63BB088F} = {A929EC04-302E-4B4F-B2A3-65AF63BB088F} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ElevatorPS", "ElevatorPS.vcxproj", "{A929EC04-302E-4B4F-B2A3-65AF63BB088F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {977153BF-8420-4C8D-AA25-592FAEDB6CBA}.Debug|Win32.ActiveCfg = Debug|Win32 + {977153BF-8420-4C8D-AA25-592FAEDB6CBA}.Debug|Win32.Build.0 = Debug|Win32 + {977153BF-8420-4C8D-AA25-592FAEDB6CBA}.Debug|x64.ActiveCfg = Debug|x64 + {977153BF-8420-4C8D-AA25-592FAEDB6CBA}.Debug|x64.Build.0 = Debug|x64 + {977153BF-8420-4C8D-AA25-592FAEDB6CBA}.Release|Win32.ActiveCfg = Release|Win32 + {977153BF-8420-4C8D-AA25-592FAEDB6CBA}.Release|Win32.Build.0 = Release|Win32 + {977153BF-8420-4C8D-AA25-592FAEDB6CBA}.Release|x64.ActiveCfg = Release|x64 + {977153BF-8420-4C8D-AA25-592FAEDB6CBA}.Release|x64.Build.0 = Release|x64 + {A929EC04-302E-4B4F-B2A3-65AF63BB088F}.Debug|Win32.ActiveCfg = Debug|Win32 + {A929EC04-302E-4B4F-B2A3-65AF63BB088F}.Debug|Win32.Build.0 = Debug|Win32 + {A929EC04-302E-4B4F-B2A3-65AF63BB088F}.Debug|x64.ActiveCfg = Debug|x64 + {A929EC04-302E-4B4F-B2A3-65AF63BB088F}.Debug|x64.Build.0 = Debug|x64 + {A929EC04-302E-4B4F-B2A3-65AF63BB088F}.Release|Win32.ActiveCfg = Release|Win32 + {A929EC04-302E-4B4F-B2A3-65AF63BB088F}.Release|Win32.Build.0 = Release|Win32 + {A929EC04-302E-4B4F-B2A3-65AF63BB088F}.Release|x64.ActiveCfg = Release|x64 + {A929EC04-302E-4B4F-B2A3-65AF63BB088F}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C138FA71-FE1F-4840-B678-526B21CE935D} + EndGlobalSection +EndGlobal diff --git a/Src/Elevator/Elevator.vcxproj b/Src/Elevator/Elevator.vcxproj new file mode 100644 index 00000000..12e039cd --- /dev/null +++ b/Src/Elevator/Elevator.vcxproj @@ -0,0 +1,256 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{977153BF-8420-4C8D-AA25-592FAEDB6CBA}</ProjectGuid> + <RootNamespace>elevator</RootNamespace> + <WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v142</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v142</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v142</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v142</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <LinkIncremental>false</LinkIncremental> + <OutDir>$(PlatformShortName)_$(Configuration)\</OutDir> + <IntDir>$(PlatformShortName)_$(Configuration)\</IntDir> + <IncludePath>$(IncludePath)</IncludePath> + <LibraryPath>$(LibraryPath)</LibraryPath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <LinkIncremental>false</LinkIncremental> + <OutDir>$(PlatformShortName)_$(Configuration)\</OutDir> + <IntDir>$(PlatformShortName)_$(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <LinkIncremental>false</LinkIncremental> + <OutDir>$(PlatformShortName)_$(Configuration)\</OutDir> + <IntDir>$(PlatformShortName)_$(Configuration)\</IntDir> + <IncludePath>$(IncludePath)</IncludePath> + <LibraryPath>$(LibraryPath)</LibraryPath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <LinkIncremental>false</LinkIncremental> + <OutDir>$(PlatformShortName)_$(Configuration)\</OutDir> + <IntDir>$(PlatformShortName)_$(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Label="Vcpkg"> + <VcpkgEnableManifest>false</VcpkgEnableManifest> + </PropertyGroup> + <PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <VcpkgInstalledDir> + </VcpkgInstalledDir> + <VcpkgUseStatic>false</VcpkgUseStatic> + <VcpkgConfiguration>Debug</VcpkgConfiguration> + <VcpkgTriplet>x86-windows-static-md</VcpkgTriplet> + </PropertyGroup> + <PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <VcpkgInstalledDir> + </VcpkgInstalledDir> + <VcpkgUseStatic>false</VcpkgUseStatic> + <VcpkgTriplet>x86-windows-static-md</VcpkgTriplet> + </PropertyGroup> + <PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <VcpkgInstalledDir> + </VcpkgInstalledDir> + <VcpkgUseStatic>false</VcpkgUseStatic> + <VcpkgTriplet>x86-windows-static-md</VcpkgTriplet> + <VcpkgConfiguration>Debug</VcpkgConfiguration> + </PropertyGroup> + <PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <VcpkgInstalledDir> + </VcpkgInstalledDir> + <VcpkgUseStatic>false</VcpkgUseStatic> + <VcpkgTriplet>x86-windows-static-md</VcpkgTriplet> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>_WINDOWS;ELEVATOR_SCOPE;_WIN32_WINNT=0x601;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>false</MinimalRebuild> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName> + </ClCompile> + <Link> + <AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile> + <SubSystem>Windows</SubSystem> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <TargetMachine>MachineX86</TargetMachine> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Link> + <PostBuildEvent> + <Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\ +xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\ </Command> + <Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\'</Message> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>_WINDOWS;ELEVATOR_SCOPE;_WIN32_WINNT=0x601;_CRT_SECURE_NO_WARNINGS;WIN64;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>false</MinimalRebuild> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName> + </ClCompile> + <Link> + <AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile> + <SubSystem>Windows</SubSystem> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Link> + <PostBuildEvent> + <Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\ +xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\ </Command> + <Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\'</Message> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>MinSpace</Optimization> + <FavorSizeOrSpeed>Size</FavorSizeOrSpeed> + <PreprocessorDefinitions>_WINDOWS;ELEVATOR_SCOPE;_WIN32_WINNT=0x601;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <BufferSecurityCheck>false</BufferSecurityCheck> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>None</DebugInformationFormat> + <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName> + </ClCompile> + <Link> + <AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> + <GenerateDebugInformation>false</GenerateDebugInformation> + <ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <TargetMachine>MachineX86</TargetMachine> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Link> + <PostBuildEvent> + <Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\ </Command> + <Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\'</Message> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <Optimization>MinSpace</Optimization> + <FavorSizeOrSpeed>Size</FavorSizeOrSpeed> + <PreprocessorDefinitions>_WINDOWS;ELEVATOR_SCOPE;_WIN32_WINNT=0x601;_CRT_SECURE_NO_WARNINGS;WIN64;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <BufferSecurityCheck>false</BufferSecurityCheck> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>None</DebugInformationFormat> + <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName> + </ClCompile> + <Link> + <AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> + <GenerateDebugInformation>false</GenerateDebugInformation> + <ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Link> + <PostBuildEvent> + <Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\ </Command> + <Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\'</Message> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\nu\cast64.h" /> + <ClInclude Include="ElevatorFactory.h" /> + <ClInclude Include="FileTypeRegistrar.h" /> + <ClInclude Include="IFileTypeRegistrar.h" /> + <ClInclude Include="resource1.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="Elevator.cpp" /> + <ClCompile Include="ElevatorFactory.cpp" /> + <ClCompile Include="FileTypeRegistrar.cpp" /> + <ClCompile Include="IFileTypeRegistrar_i.c" /> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="Elevator.rc" /> + </ItemGroup> + <ItemGroup> + <Image Include="..\Winamp\resource\WinampIcon.ico" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/Src/Elevator/Elevator.vcxproj.filters b/Src/Elevator/Elevator.vcxproj.filters new file mode 100644 index 00000000..88194b9a --- /dev/null +++ b/Src/Elevator/Elevator.vcxproj.filters @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <ClCompile Include="Elevator.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="ElevatorFactory.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="FileTypeRegistrar.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="IFileTypeRegistrar_i.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\nu\cast64.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="ElevatorFactory.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="FileTypeRegistrar.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="IFileTypeRegistrar.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="resource1.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <Filter Include="Header Files"> + <UniqueIdentifier>{d1bbfe54-bf77-462f-ab4d-5b0c77038722}</UniqueIdentifier> + </Filter> + <Filter Include="Ressource Files"> + <UniqueIdentifier>{d2587f63-5fd0-4d1e-8a9f-a01a45d6ce57}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files"> + <UniqueIdentifier>{805e4d5a-f2b7-4bd5-8fbf-309729b39f71}</UniqueIdentifier> + </Filter> + <Filter Include="Image Files"> + <UniqueIdentifier>{1be5afbd-e012-4300-b532-455ee3085e1f}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="Elevator.rc"> + <Filter>Ressource Files</Filter> + </ResourceCompile> + </ItemGroup> + <ItemGroup> + <Image Include="..\Winamp\resource\WinampIcon.ico"> + <Filter>Image Files</Filter> + </Image> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/Src/Elevator/ElevatorFactory.cpp b/Src/Elevator/ElevatorFactory.cpp new file mode 100644 index 00000000..8fca8d6b --- /dev/null +++ b/Src/Elevator/ElevatorFactory.cpp @@ -0,0 +1,67 @@ +#include "ElevatorFactory.h" +#include "FileTypeRegistrar.h" + +FileTypeRegistrar registrar; + +void Lock(); +void UnLock(); + +ElevatorFactory::ElevatorFactory() +{ +} + +ElevatorFactory::~ElevatorFactory() +{ +} + +ULONG ElevatorFactory::AddRef() +{ + return 10; +} + +ULONG ElevatorFactory::Release() +{ + return 10; +} + +HRESULT ElevatorFactory::QueryInterface(REFIID riid, void ** ppAny) +{ + // IID_IUnknown is the REFIID of standard interface IUnknown + if(riid == IID_IUnknown) + { + *ppAny = (IUnknown *)this; + } + else if(riid == IID_IClassFactory) + { + *ppAny = (IClassFactory *)this; + } + else + { + *ppAny = NULL; + return E_NOINTERFACE; + } + + ((IUnknown *)(*ppAny))->AddRef(); + + return S_OK; +} + +HRESULT ElevatorFactory::LockServer(BOOL fLock) +{ + if (fLock) + Lock(); + else + UnLock(); + return S_OK; +} + +HRESULT ElevatorFactory::CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, void **ppAny) +{ + if(pUnkOuter != NULL) + { + return CLASS_E_NOAGGREGATION; + } + + FileTypeRegistrar *pRegistrar = ®istrar; + return pRegistrar->QueryInterface(riid, ppAny); +}
\ No newline at end of file diff --git a/Src/Elevator/ElevatorFactory.h b/Src/Elevator/ElevatorFactory.h new file mode 100644 index 00000000..b4339ad0 --- /dev/null +++ b/Src/Elevator/ElevatorFactory.h @@ -0,0 +1,20 @@ +#ifndef NULLSOFT_ELEVATORFACTORY_H +#define NULLSOFT_ELEVATORFACTORY_H + +#include <unknwn.h> + +class ElevatorFactory : public IClassFactory +{ +public: + ElevatorFactory(); + virtual ~ElevatorFactory(); + HRESULT __stdcall QueryInterface(REFIID riid, void ** ppAny); + ULONG __stdcall AddRef(); + ULONG __stdcall Release(); + + HRESULT __stdcall CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, void ** ppAny); + HRESULT __stdcall LockServer(BOOL fLock); +}; + + +#endif
\ No newline at end of file diff --git a/Src/Elevator/ElevatorPS.rc b/Src/Elevator/ElevatorPS.rc new file mode 100644 index 00000000..56da1df4 --- /dev/null +++ b/Src/Elevator/ElevatorPS.rc @@ -0,0 +1,62 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource2.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource2.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "#include ""versionPS.rc2\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "versionPS.rc2" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/Src/Elevator/ElevatorPS.vcxproj b/Src/Elevator/ElevatorPS.vcxproj new file mode 100644 index 00000000..54c6e2e0 --- /dev/null +++ b/Src/Elevator/ElevatorPS.vcxproj @@ -0,0 +1,297 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{A929EC04-302E-4B4F-B2A3-65AF63BB088F}</ProjectGuid> + <RootNamespace>ElevatorPS</RootNamespace> + <Keyword>AtlPSProj</Keyword> + <WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <PlatformToolset>v142</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <PlatformToolset>v142</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <PlatformToolset>v142</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <PlatformToolset>v142</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <LinkIncremental>false</LinkIncremental> + <OutDir>$(PlatformShortName)_$(Configuration)PS\</OutDir> + <IntDir>$(PlatformShortName)_$(Configuration)PS\</IntDir> + <IncludePath>$(IncludePath)</IncludePath> + <LibraryPath>$(LibraryPath)</LibraryPath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <LinkIncremental>false</LinkIncremental> + <OutDir>$(PlatformShortName)_$(Configuration)PS\</OutDir> + <IntDir>$(PlatformShortName)_$(Configuration)PS\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <LinkIncremental>false</LinkIncremental> + <OutDir>$(PlatformShortName)_$(Configuration)PS\</OutDir> + <IntDir>$(PlatformShortName)_$(Configuration)PS\</IntDir> + <IncludePath>$(IncludePath)</IncludePath> + <LibraryPath>$(LibraryPath)</LibraryPath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <LinkIncremental>false</LinkIncremental> + <OutDir>$(PlatformShortName)_$(Configuration)PS\</OutDir> + <IntDir>$(PlatformShortName)_$(Configuration)PS\</IntDir> + </PropertyGroup> + <PropertyGroup Label="Vcpkg"> + <VcpkgEnableManifest>false</VcpkgEnableManifest> + </PropertyGroup> + <PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <VcpkgInstalledDir> + </VcpkgInstalledDir> + <VcpkgUseStatic>false</VcpkgUseStatic> + <VcpkgConfiguration>Debug</VcpkgConfiguration> + <VcpkgTriplet>x86-windows-static-md</VcpkgTriplet> + </PropertyGroup> + <PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <VcpkgInstalledDir> + </VcpkgInstalledDir> + <VcpkgUseStatic>false</VcpkgUseStatic> + <VcpkgTriplet>x86-windows-static-md</VcpkgTriplet> + </PropertyGroup> + <PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <VcpkgInstalledDir> + </VcpkgInstalledDir> + <VcpkgUseStatic>false</VcpkgUseStatic> + <VcpkgTriplet>x86-windows-static-md</VcpkgTriplet> + <VcpkgConfiguration>Debug</VcpkgConfiguration> + </PropertyGroup> + <PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <VcpkgInstalledDir> + </VcpkgInstalledDir> + <VcpkgUseStatic>false</VcpkgUseStatic> + <VcpkgTriplet>x86-windows-static-md</VcpkgTriplet> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <PreBuildEvent> + <Message>Checking for required files</Message> + <Command>if exist dlldata.c goto :END + echo Error: MIDL will not generate DLLDATA.C unless you have at least 1 interface in the main project. + Exit 1 + :END + </Command> + </PreBuildEvent> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_WIN32_WINNT=0x601;REGISTER_PROXY_DLL;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>false</MinimalRebuild> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName> + </ClCompile> + <Link> + <AdditionalDependencies>kernel32.lib;rpcns4.lib;rpcrt4.lib;oleaut32.lib;uuid.lib;%(AdditionalDependencies)</AdditionalDependencies> + <GenerateDebugInformation>true</GenerateDebugInformation> + <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> + <ModuleDefinitionFile>ElevatorPS.def</ModuleDefinitionFile> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + <TargetMachine>MachineX86</TargetMachine> + <ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Link> + <PostBuildEvent> + <Message>If you need to perform registration as service, use command line with following text 'regsvr32 elevatorps.dll'.</Message> + <Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Shared\'</Message> + <Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Shared\ +xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Shared\</Command> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <PreBuildEvent> + <Message>Checking for required files</Message> + <Command>if exist dlldata.c goto :END + echo Error: MIDL will not generate DLLDATA.C unless you have at least 1 interface in the main project. + Exit 1 + :END + </Command> + </PreBuildEvent> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN64;_WIN32_WINNT=0x601;REGISTER_PROXY_DLL;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>false</MinimalRebuild> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName> + </ClCompile> + <Link> + <AdditionalDependencies>kernel32.lib;rpcns4.lib;rpcrt4.lib;oleaut32.lib;uuid.lib;%(AdditionalDependencies)</AdditionalDependencies> + <GenerateDebugInformation>true</GenerateDebugInformation> + <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> + <ModuleDefinitionFile>ElevatorPS.def</ModuleDefinitionFile> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + <ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Link> + <PostBuildEvent> + <Message>If you need to perform registration as service, use command line with following text 'regsvr32 elevatorps.dll'.</Message> + <Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Shared\'</Message> + <Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Shared\ +xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Shared\</Command> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <PreBuildEvent> + <Message>Checking for required files</Message> + <Command>if exist dlldata.c goto :END + echo Error: MIDL will not generate DLLDATA.C unless you have at least 1 interface in the main project. + Exit 1 + :END + </Command> + </PreBuildEvent> + <ClCompile> + <Optimization>MinSpace</Optimization> + <FavorSizeOrSpeed>Size</FavorSizeOrSpeed> + <PreprocessorDefinitions>WIN32;_WIN32_WINNT=0x601;REGISTER_PROXY_DLL;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <BufferSecurityCheck>false</BufferSecurityCheck> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>None</DebugInformationFormat> + <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName> + </ClCompile> + <Link> + <AdditionalDependencies>kernel32.lib;rpcns4.lib;rpcrt4.lib;oleaut32.lib;uuid.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> + <ModuleDefinitionFile>ElevatorPS.def</ModuleDefinitionFile> + <GenerateDebugInformation>false</GenerateDebugInformation> + <ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Link> + <PostBuildEvent> + <Message>If you need to perform registration as service, use command line with following text 'regsvr32 elevatorps.dll'.</Message> + <Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Shared\'</Message> + <Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Shared\</Command> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <PreBuildEvent> + <Message>Checking for required files</Message> + <Command>if exist dlldata.c goto :END + echo Error: MIDL will not generate DLLDATA.C unless you have at least 1 interface in the main project. + Exit 1 + :END + </Command> + </PreBuildEvent> + <ClCompile> + <Optimization>MinSpace</Optimization> + <FavorSizeOrSpeed>Size</FavorSizeOrSpeed> + <PreprocessorDefinitions>WIN64;_WIN32_WINNT=0x601;REGISTER_PROXY_DLL;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <BufferSecurityCheck>false</BufferSecurityCheck> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>None</DebugInformationFormat> + <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName> + </ClCompile> + <Link> + <AdditionalDependencies>kernel32.lib;rpcns4.lib;rpcrt4.lib;oleaut32.lib;uuid.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> + <ModuleDefinitionFile>ElevatorPS.def</ModuleDefinitionFile> + <GenerateDebugInformation>false</GenerateDebugInformation> + <ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Link> + <PostBuildEvent> + <Message>If you need to perform registration as service, use command line with following text 'regsvr32 elevatorps.dll'.</Message> + <Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Shared\'</Message> + <Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Shared\</Command> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="dlldata.c" /> + <ClCompile Include="IFileTypeRegistrar_i.c" /> + <ClCompile Include="IFileTypeRegistrar_p.c" /> + </ItemGroup> + <ItemGroup> + <None Include="Elevatorps.def" /> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="ElevatorPS.rc" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="resource2.h" /> + </ItemGroup> + <ItemGroup> + <Midl Include="IFileTypeRegistrar.idl"> + <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(Filename)_32.h</HeaderFileName> + <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(Filename)_64.h</HeaderFileName> + <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(Filename)_32.h</HeaderFileName> + <HeaderFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(Filename)_64.h</HeaderFileName> + </Midl> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/Src/Elevator/ElevatorPS.vcxproj.filters b/Src/Elevator/ElevatorPS.vcxproj.filters new file mode 100644 index 00000000..80cb7167 --- /dev/null +++ b/Src/Elevator/ElevatorPS.vcxproj.filters @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <ClCompile Include="dlldata.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="IFileTypeRegistrar_i.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="IFileTypeRegistrar_p.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <Filter Include="Header Files"> + <UniqueIdentifier>{b624e788-f0a1-4ec2-a810-7ef90f3e61b1}</UniqueIdentifier> + </Filter> + <Filter Include="Ressource Files"> + <UniqueIdentifier>{973886f8-b821-4c9c-b2e2-0020f5845f6a}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files"> + <UniqueIdentifier>{0ca1688e-10eb-4ef7-bbf2-467e30285356}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="ElevatorPS.rc"> + <Filter>Ressource Files</Filter> + </ResourceCompile> + </ItemGroup> + <ItemGroup> + <Midl Include="IFileTypeRegistrar.idl"> + <Filter>Ressource Files</Filter> + </Midl> + </ItemGroup> + <ItemGroup> + <None Include="Elevatorps.def"> + <Filter>Ressource Files</Filter> + </None> + </ItemGroup> + <ItemGroup> + <ClInclude Include="resource2.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/Src/Elevator/Elevator_i.c b/Src/Elevator/Elevator_i.c new file mode 100644 index 00000000..a4e3991e --- /dev/null +++ b/Src/Elevator/Elevator_i.c @@ -0,0 +1,87 @@ + + +/* this ALWAYS GENERATED file contains the IIDs and CLSIDs */ + +/* link this file in with the server and any clients */ + + + /* File created by MIDL compiler version 6.00.0361 */ +/* at Mon Mar 03 17:12:34 2008 + */ +/* Compiler settings for .\Elevator.idl: + Oicf, W1, Zp8, env=Win32 (32b run) + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +//@@MIDL_FILE_HEADING( ) + +#if !defined(_M_IA64) && !defined(_M_AMD64) + + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +#ifdef __cplusplus +extern "C"{ +#endif + + +#include <rpc.h> +#include <rpcndr.h> + +#ifdef _MIDL_USE_GUIDDEF_ + +#ifndef INITGUID +#define INITGUID +#include <guiddef.h> +#undef INITGUID +#else +#include <guiddef.h> +#endif + +#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ + DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) + +#else // !_MIDL_USE_GUIDDEF_ + +#ifndef __IID_DEFINED__ +#define __IID_DEFINED__ + +typedef struct _IID +{ + unsigned long x; + unsigned short s1; + unsigned short s2; + unsigned char c[8]; +} IID; + +#endif // __IID_DEFINED__ + +#ifndef CLSID_DEFINED +#define CLSID_DEFINED +typedef IID CLSID; +#endif // CLSID_DEFINED + +#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ + const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} + +#endif !_MIDL_USE_GUIDDEF_ + +MIDL_DEFINE_GUID(IID, LIBID_ElevatorLib,0xB3600382,0x8669,0x402B,0x81,0xB2,0x3D,0x18,0xB0,0xE2,0x31,0x8B); + + +MIDL_DEFINE_GUID(CLSID, CLSID_WFileTypeRegistrar,0x3B29AB5C,0x52CB,0x4a36,0x93,0x14,0xE3,0xFE,0xE0,0xBA,0x74,0x68); + +#undef MIDL_DEFINE_GUID + +#ifdef __cplusplus +} +#endif + + + +#endif /* !defined(_M_IA64) && !defined(_M_AMD64)*/ + diff --git a/Src/Elevator/Elevatorps.def b/Src/Elevator/Elevatorps.def new file mode 100644 index 00000000..2b8ae4b8 --- /dev/null +++ b/Src/Elevator/Elevatorps.def @@ -0,0 +1,9 @@ + +LIBRARY "ElevatorPS" + +EXPORTS + DllGetClassObject PRIVATE + DllCanUnloadNow PRIVATE + GetProxyDllInfo PRIVATE + DllRegisterServer PRIVATE + DllUnregisterServer PRIVATE diff --git a/Src/Elevator/FileTypeRegistrar.cpp b/Src/Elevator/FileTypeRegistrar.cpp new file mode 100644 index 00000000..e56da01b --- /dev/null +++ b/Src/Elevator/FileTypeRegistrar.cpp @@ -0,0 +1,966 @@ +#include "FileTypeRegistrar.h" +#include <windows.h> +#include <shlwapi.h> +#include <shellapi.h> +#include <shobjidl.h> +#define _STD_USING +//#include "../nu/cast64.h" +#include <strsafe.h> +#ifdef ELEVATOR_SCOPE +void Lock(); +void UnLock(); +#endif + +#if defined(_SYSINFOAPI_H_) && defined(NOT_BUILD_WINDOWS_DEPRECATE) && (_WIN32_WINNT >= 0x0501) +#include <VersionHelpers.h> +#endif + +FileTypeRegistrar::FileTypeRegistrar() +{ + refCount = 0; +} + +HRESULT FileTypeRegistrar::QueryInterface(REFIID riid, LPVOID FAR *ppvObj) +{ + if (!ppvObj) + return E_POINTER; + else if (IsEqualIID(riid, IID_IUnknown)) + *ppvObj = static_cast<IUnknown *>(this); + else if (IsEqualIID(riid, __uuidof(IFileTypeRegistrar))) + *ppvObj = static_cast<IFileTypeRegistrar *>(this); + else + { + *ppvObj = NULL; + return E_NOINTERFACE; + } + + AddRef(); + return S_OK; +} + +ULONG FileTypeRegistrar::AddRef(void) +{ +#ifdef ELEVATOR_SCOPE + Lock(); +#endif + return ++refCount; +} + +ULONG FileTypeRegistrar::Release(void) +{ + ULONG retCount=--refCount; +#ifdef ELEVATOR_SCOPE + UnLock(); +#endif + return retCount; +} + +static LONG SetValue(HKEY hkey, const wchar_t *data) +{ + return RegSetValueExW(hkey, NULL,0,REG_SZ,(const BYTE *)data, (DWORD)(sizeof(wchar_t)*(wcslen(data)+1))); +} + +static LONG SetValue(HKEY hkey, const wchar_t *value, const wchar_t *data) +{ + return RegSetValueExW(hkey, value,0,REG_SZ,(const BYTE *)data, (DWORD)(sizeof(wchar_t)*(wcslen(data)+1))); +} + +HRESULT FileTypeRegistrar::RegisterMIMEType(const wchar_t *mimeType, const wchar_t *programName, const wchar_t *extension, int netscapeOnly) +{ + HKEY mp3Key = NULL; + + if (!netscapeOnly) + { + wchar_t s[MAX_PATH] = {0}; + if (RegCreateKeyW(HKEY_CLASSES_ROOT, extension, &mp3Key) == ERROR_SUCCESS) + { + SetValue(mp3Key, L"Content Type", mimeType); + RegCloseKey(mp3Key); + } + StringCchPrintfW(s, MAX_PATH, L"MIME\\Database\\Content Type\\%s", mimeType); + if (RegCreateKeyW(HKEY_CLASSES_ROOT, s, &mp3Key) == ERROR_SUCCESS) + { + RegDeleteValueW(mp3Key, L"CLSID"); + SetValue(mp3Key, L"Extension", extension); + RegCloseKey(mp3Key); + } + } + if (RegOpenKeyW(HKEY_CURRENT_USER, L"Software\\Netscape\\Netscape Navigator\\Viewers", &mp3Key) == ERROR_SUCCESS) + { + SetValue(mp3Key, mimeType, programName); + for (int x = 0; x < 999; x ++) + { + wchar_t st[100] = {0}; + DWORD vt; + DWORD s = 128; + wchar_t b[128] = {0}; + StringCchPrintfW(st, 100, L"TYPE%d", x); + if (RegQueryValueExW(mp3Key, st, 0, &vt, (LPBYTE)b, &s) == ERROR_SUCCESS) + { + if (!wcscmp(b, mimeType)) break; + } + else + { + SetValue(mp3Key, st, mimeType); + break; + } + } + RegCloseKey(mp3Key); + } + return S_OK; +} + +HRESULT FileTypeRegistrar::RegisterCDPlayer(const wchar_t *programName) +{ + wchar_t buf2[MAX_PATH] = {0}; + HKEY mp3Key = NULL; + StringCchPrintfW(buf2, MAX_PATH, L"\"%s\" %%1", programName); + if (RegOpenKeyW(HKEY_CLASSES_ROOT, L"AudioCD\\shell\\play\\command", &mp3Key) == ERROR_SUCCESS) + { + wchar_t b[MAX_PATH] = {0}; + DWORD s = sizeof(b)/sizeof(*b); + if (RegQueryValueEx(mp3Key, NULL, 0, NULL, (LPBYTE)b, &s) == ERROR_SUCCESS) + { + if (_wcsicmp(b, buf2)) + { + wchar_t buf3[MAX_PATH] = {0}; + DWORD st = sizeof(buf3)/sizeof(*buf3); + if (RegQueryValueExW(mp3Key, L"Winamp_Back", 0, NULL, (LPBYTE)buf3, &st) != ERROR_SUCCESS || + _wcsicmp(buf3, b)) + { + SetValue(mp3Key, L"Winamp_Back", b); + } + SetValue(mp3Key, buf2); + } + } + else SetValue(mp3Key, buf2); + + RegCloseKey(mp3Key); + } + return S_OK; +} + +HRESULT FileTypeRegistrar::UnregisterCDPlayer(const wchar_t *programName) +{ + wchar_t buf2[MAX_PATH] = {0}; + HKEY mp3Key = NULL; + StringCchPrintfW(buf2, MAX_PATH, L"\"%s\" %%1", programName); + if (RegOpenKeyW(HKEY_CLASSES_ROOT, L"AudioCD\\shell\\play\\command", &mp3Key) == ERROR_SUCCESS) + { + wchar_t b[MAX_PATH] = {0}; + DWORD s = sizeof(b)/sizeof(*b); + if (RegQueryValueEx(mp3Key, NULL, 0, NULL, (LPBYTE)b, &s) == ERROR_SUCCESS) + { + if (!wcscmp(b, buf2)) + { + s = sizeof(b); + if (RegQueryValueExW(mp3Key, L"Winamp_Back", 0, NULL, (LPBYTE)b, &s) == ERROR_SUCCESS) + { + if (!_wcsicmp(b, buf2)) b[0] = 0; + if (SetValue(mp3Key, b) == ERROR_SUCCESS) + RegDeleteValueW(mp3Key, L"Winamp_Back"); + } + else + { + buf2[0] = 0; + SetValue(mp3Key, buf2); + } + } + } + + RegCloseKey(mp3Key); + } + return S_OK; +} + +static LONG myRegDeleteKeyEx(HKEY thiskey, LPCWSTR lpSubKey) +{ + HKEY key = NULL; + int retval = RegOpenKeyW(thiskey, lpSubKey, &key); + if (retval == ERROR_SUCCESS) + { + wchar_t buffer[1024] = {0}; + while (RegEnumKeyW(key, 0, buffer, 1024) == ERROR_SUCCESS) + if ((retval = myRegDeleteKeyEx(key, buffer)) != ERROR_SUCCESS) break; + RegCloseKey(key); + retval = RegDeleteKeyW(thiskey, lpSubKey); + } + return retval; +} + +HRESULT FileTypeRegistrar::RegisterType(const wchar_t *extension, const wchar_t *which_str, const wchar_t *prog_name) +{ + HKEY mp3Key = NULL; + LONG regResult = RegCreateKeyW(HKEY_CLASSES_ROOT, extension, &mp3Key); + + if (regResult == ERROR_SUCCESS) + { + wchar_t b[128] = {0}; + DWORD s = sizeof(b)/sizeof(*b); + if (RegQueryValueEx(mp3Key, NULL, 0, NULL, (LPBYTE)b, &s) == ERROR_SUCCESS) + { + if (wcsncmp(b, which_str, wcslen(b))) + { + SetValue(mp3Key, L"Winamp_Back", b); + SetValue(mp3Key, which_str); + } + } + else SetValue(mp3Key, which_str); + + if (mp3Key) RegCloseKey(mp3Key); + } + + +#if defined(_SYSINFOAPI_H_) && defined(NOT_BUILD_WINDOWS_DEPRECATE) && (_WIN32_WINNT >= 0x0501) + if (IsWindowsVersionOrGreater(6, 0, 0)) // Vista +#else + OSVERSIONINFO version = {0}; + version.dwOSVersionInfoSize = sizeof(version); + if (!GetVersionEx(&version)) ZeroMemory(&version, sizeof(OSVERSIONINFO)); + if (version.dwMajorVersion >= 6) // Vista +#endif + { + TCHAR szKey[256] = {0}; + StringCbPrintfW(szKey, sizeof(szKey), L"Software\\Clients\\Media\\%s\\Capabilities\\FileAssociations", prog_name); + if (ERROR_SUCCESS == RegCreateKeyW(HKEY_LOCAL_MACHINE, szKey, &mp3Key)) + { + SetValue(mp3Key, extension, which_str); + + // TODO: cache IApplicationAssociationRegistration + IApplicationAssociationRegistration* pAAR = NULL; + HRESULT hr = CoCreateInstance(CLSID_ApplicationAssociationRegistration, + NULL, CLSCTX_INPROC, + __uuidof(IApplicationAssociationRegistration), + (void**)&pAAR); + if (SUCCEEDED(hr) && pAAR) + { + pAAR->SetAppAsDefault(prog_name, extension, AT_FILEEXTENSION); + pAAR->Release(); + } + + RegCloseKey(mp3Key); + } + } + return S_OK; +} + +HRESULT FileTypeRegistrar::UnregisterType(const wchar_t *extension, const wchar_t *which_str, const wchar_t *prog_name, int is_playlist) +{ + HKEY mp3Key = NULL; + + LONG regResult = RegOpenKeyW(HKEY_CLASSES_ROOT, extension, &mp3Key); + + if (regResult == ERROR_SUCCESS) + { + wchar_t b[128] = {0}; + DWORD s = sizeof(b)/sizeof(*b); + if (RegQueryValueEx(mp3Key, NULL, 0, NULL, (LPBYTE)b, &s) == ERROR_SUCCESS) + { + size_t len = min(wcslen(b), wcslen(which_str)); + if (!wcsncmp(b, which_str, len)) + { + s = sizeof(b)/sizeof(*b); + if (RegQueryValueExW(mp3Key, L"Winamp_Back", 0, NULL, (LPBYTE)b, &s) == ERROR_SUCCESS) + { + if (SetValue(mp3Key, b) == ERROR_SUCCESS) + RegDeleteValueW(mp3Key, L"Winamp_Back"); + } + else + { + RegDeleteValue(mp3Key, NULL); + RegCloseKey(mp3Key); + mp3Key = NULL; + myRegDeleteKeyEx(HKEY_CLASSES_ROOT, extension); + } + } + } + + if (mp3Key) RegCloseKey(mp3Key); + + if(!is_playlist) + { + myRegDeleteKeyEx(HKEY_CLASSES_ROOT, which_str); + } + } + // TODO: benski> it'd be nice to have a function to remove any capabilities for which we no longer have a plugin for ... +#if defined(_SYSINFOAPI_H_) && defined(NOT_BUILD_WINDOWS_DEPRECATE) && (_WIN32_WINNT >= 0x0501) + if (IsWindowsVersionOrGreater(6, 0, 0)) // Vista +#else + OSVERSIONINFO version = { 0 }; + version.dwOSVersionInfoSize = sizeof(version); + if (!GetVersionEx(&version)) ZeroMemory(&version, sizeof(OSVERSIONINFO)); + if (version.dwMajorVersion >= 6) // Vista +#endif + { + TCHAR szKey[256] = {0}; + StringCbPrintfW(szKey, sizeof(szKey), L"Software\\Clients\\Media\\%s\\Capabilities\\FileAssociations", prog_name); + if (ERROR_SUCCESS == RegCreateKey(HKEY_LOCAL_MACHINE, szKey, &mp3Key)) + { + RegDeleteValue(mp3Key, extension); + RegCloseKey(mp3Key); + } + } + return S_OK; +} + +HRESULT FileTypeRegistrar::AddDirectoryContext(const wchar_t *commandLine, const wchar_t *which_str, const wchar_t *description) +{ + HKEY mp3Key = NULL; + wchar_t regStr[256] = {0}; + StringCbPrintfW(regStr, sizeof(regStr), L"SOFTWARE\\Classes\\Directory\\shell\\%s", which_str); + if (RegCreateKeyW(HKEY_LOCAL_MACHINE, regStr,&mp3Key) == ERROR_SUCCESS) + { + SetValue(mp3Key, description); + RegCloseKey(mp3Key); + } + + StringCbPrintfW(regStr, sizeof(regStr), L"SOFTWARE\\Classes\\Directory\\shell\\%s\\command", which_str); + if (RegCreateKeyW(HKEY_LOCAL_MACHINE,regStr,&mp3Key) == ERROR_SUCCESS) + { + SetValue(mp3Key, commandLine); + RegCloseKey(mp3Key); + } + return S_OK; +} + +HRESULT FileTypeRegistrar::RemoveDirectoryContext(const wchar_t *which_str) +{ + wchar_t regStr[256] = {0}; + StringCbPrintfW(regStr, sizeof(regStr), L"SOFTWARE\\Classes\\Directory\\shell\\%s", which_str); + myRegDeleteKeyEx(HKEY_LOCAL_MACHINE, regStr); + return S_OK; +} + +HRESULT FileTypeRegistrar::AddAgent(const wchar_t *agentFilename) +{ + HKEY key = NULL; + STARTUPINFOW si = {sizeof(si), }; + PROCESS_INFORMATION pi = {0, }; + + if (RegCreateKeyW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", &key) == ERROR_SUCCESS) + { + SetValue(key, L"WinampAgent", agentFilename); + RegCloseKey(key); + } + CreateProcessW(NULL, (LPWSTR)agentFilename, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + return S_OK; +} + +HRESULT FileTypeRegistrar::RemoveAgent() +{ + HKEY key = NULL; + + // caller will have done this also, but we'll do it again at elevated level just in case that's where winamp agent is running + HWND hwnd = FindWindow(L"WinampAgentMain", NULL); + if (hwnd) + { + SendMessageW(hwnd, WM_CLOSE, 0, 0); + } + + if (RegOpenKey(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", &key) == ERROR_SUCCESS) + { + RegDeleteValue(key, L"WinampAgent"); + RegCloseKey(key); + } + return S_OK; +} + +static LONG RegMedia_CreateKey(LPCWSTR lpSubKey, HKEY *phkResult, LPCWSTR prog_name) +{ + WCHAR szKey[256] = {0}; + HRESULT hr = (lpSubKey && *lpSubKey) ? + StringCbPrintfW(szKey, sizeof(szKey), L"Software\\Clients\\Media\\%s\\%s", prog_name, lpSubKey) : + StringCbPrintfW(szKey, sizeof(szKey), L"Software\\Clients\\Media\\%s", prog_name); + if (S_OK != hr) return ERROR_NOT_ENOUGH_MEMORY; + return RegCreateKeyW(HKEY_LOCAL_MACHINE, szKey, phkResult); +} + +HRESULT FileTypeRegistrar::RegisterMediaPlayer(DWORD accessEnabled, const wchar_t *programName, const wchar_t *prog_name, int iconNumber) +{ + HKEY mp3Key = NULL; + wchar_t str[MAX_PATH+128] = {0}; + + if (RegMedia_CreateKey(NULL, &mp3Key, prog_name) == ERROR_SUCCESS) + { + SetValue(mp3Key, prog_name); + RegCloseKey(mp3Key); + } + + if (RegMedia_CreateKey(L"DefaultIcon",&mp3Key, prog_name) == ERROR_SUCCESS) + { + StringCchPrintfW(str,MAX_PATH+128,L"%s,%d",programName,iconNumber); + SetValue(mp3Key, str); + RegCloseKey(mp3Key); + } + if (RegMedia_CreateKey(L"InstallInfo",&mp3Key, prog_name) == ERROR_SUCCESS) + { + RegSetValueExW(mp3Key, L"IconsVisible", 0, REG_DWORD, (BYTE *)&accessEnabled, sizeof(accessEnabled)); + StringCchPrintfW(str,MAX_PATH+128, L"\"%s\" /REG=AVCDL", programName); + SetValue(mp3Key,L"ReinstallCommand", str); + SetValue(mp3Key,L"ShowIconsCommand", str); + StringCchPrintfW(str,MAX_PATH+128,L"\"%s\" /UNREG",programName); + SetValue(mp3Key,L"HideIconsCommand", str); + RegCloseKey(mp3Key); + } + if (RegMedia_CreateKey(L"shell",&mp3Key, prog_name) == ERROR_SUCCESS) + RegCloseKey(mp3Key); + + if (RegMedia_CreateKey(L"shell\\open",&mp3Key, prog_name) == ERROR_SUCCESS) + RegCloseKey(mp3Key); + + if (RegMedia_CreateKey(L"shell\\open\\command",&mp3Key, prog_name) == ERROR_SUCCESS) + { + SetValue(mp3Key, programName); + RegCloseKey(mp3Key); + } + +#if defined(_SYSINFOAPI_H_) && defined(NOT_BUILD_WINDOWS_DEPRECATE) && (_WIN32_WINNT >= 0x0501) + if (IsWindowsVersionOrGreater(6, 0, 0)) // Vista +#else + OSVERSIONINFO version = { 0 }; + version.dwOSVersionInfoSize = sizeof(version); + if (!GetVersionEx(&version)) ZeroMemory(&version, sizeof(OSVERSIONINFO)); + if (version.dwMajorVersion >= 6) // Vista +#endif + { + if (ERROR_SUCCESS == RegMedia_CreateKey(L"Capabilities",&mp3Key, prog_name)) + { + SetValue(mp3Key,L"ApplicationDescription", L"Winamp. The Ultimate Media Player."); + SetValue(mp3Key,L"ApplicationName", prog_name); + RegCloseKey(mp3Key); + } + if (ERROR_SUCCESS == RegCreateKeyW(HKEY_LOCAL_MACHINE, L"Software\\RegisteredApplications", &mp3Key)) + { + TCHAR szValue[256] = {0}; + StringCbPrintfW(szValue, sizeof(szValue), L"Software\\Clients\\Media\\%s\\Capabilities", prog_name); + SetValue(mp3Key, prog_name, szValue); + RegCloseKey(mp3Key); + } + + if (ERROR_SUCCESS == RegMedia_CreateKey(L"Capabilities\\FileAssociations",&mp3Key, prog_name)) + { + RegCloseKey(mp3Key); + } + + if (ERROR_SUCCESS == RegMedia_CreateKey(L"Capabilities\\MimeAssociations",&mp3Key, prog_name)) + { + RegCloseKey(mp3Key); + } + } + return S_OK; +} + +HRESULT FileTypeRegistrar::RegisterMediaPlayerProtocol(LPCWSTR protocol, LPCWSTR prog_name) +{ + HKEY mp3Key = NULL; +#if defined(_SYSINFOAPI_H_) && defined(NOT_BUILD_WINDOWS_DEPRECATE) && (_WIN32_WINNT >= 0x0501) + if (IsWindowsVersionOrGreater(6, 0, 0)) // Vista +#else + OSVERSIONINFO version = { 0 }; + version.dwOSVersionInfoSize = sizeof(version); + if (!GetVersionEx(&version)) ZeroMemory(&version, sizeof(OSVERSIONINFO)); + if (version.dwMajorVersion >= 6) // Vista +#endif + { + if (ERROR_SUCCESS == RegMedia_CreateKey(L"Capabilities\\URLAssociations",&mp3Key, prog_name)) + { + wchar_t szBuffer[64] = {0}; + + StringCbCopyW(szBuffer, sizeof(szBuffer), protocol); + CharUpperW(szBuffer); + SetValue(mp3Key, protocol, szBuffer); + + RegCloseKey(mp3Key); + } + } + return S_OK; +} + +HRESULT FileTypeRegistrar::UnregisterMediaPlayerProtocol(LPCWSTR protocol, LPCWSTR prog_name) +{ + HKEY mp3Key = NULL; +#if defined(_SYSINFOAPI_H_) && defined(NOT_BUILD_WINDOWS_DEPRECATE) && (_WIN32_WINNT >= 0x0501) + if (IsWindowsVersionOrGreater(6, 0, 0)) // Vista +#else + OSVERSIONINFO version = { 0 }; + version.dwOSVersionInfoSize = sizeof(version); + if (!GetVersionEx(&version)) ZeroMemory(&version, sizeof(OSVERSIONINFO)); + if (version.dwMajorVersion >= 6) // Vista +#endif + { + if (ERROR_SUCCESS == RegMedia_CreateKey(L"Capabilities\\URLAssociations",&mp3Key, prog_name)) + { + RegDeleteValue(mp3Key, protocol); + + RegCloseKey(mp3Key); + } + } + return S_OK; +} + +static LONG RegCreateKey4(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpSubKey2, PHKEY phkResult) +{ + wchar_t temp[1024] = {0}; + StringCchPrintfW(temp, 1024, L"%s%s", lpSubKey, lpSubKey2); + return RegCreateKeyW(hKey,temp,phkResult); +} + +static LONG RegCreateKey5(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpSubKey2, LPCWSTR lpSubKey3, PHKEY phkResult) +{ + wchar_t temp[1024] = {0}; + StringCchPrintfW(temp, 1024, L"%s%s%s", lpSubKey, lpSubKey2, lpSubKey3); + return RegCreateKeyW(hKey,temp,phkResult); +} + +static LONG RegCreateKey6(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpSubKey2, LPCWSTR lpSubKey3, LPCWSTR lpSubKey4, PHKEY phkResult) +{ + wchar_t temp[1024] = {0}; + StringCchPrintfW(temp, 1024, L"%s%s%s%s", lpSubKey, lpSubKey2, lpSubKey3,lpSubKey4); + return RegCreateKeyW(hKey,temp,phkResult); +} + +HRESULT FileTypeRegistrar::SetupShell(const wchar_t *commandLine, const wchar_t *winamp_file, const wchar_t *description, const wchar_t *commandName, const wchar_t *dragAndDropGUID) +{ + HKEY mp3Key = NULL; + + if (RegCreateKey5(HKEY_CLASSES_ROOT,winamp_file, L"\\shell\\", commandName,&mp3Key) == ERROR_SUCCESS) + { + SetValue(mp3Key, description); + RegCloseKey(mp3Key); + } + + if (RegCreateKey6(HKEY_CLASSES_ROOT,winamp_file, L"\\shell\\", commandName, L"\\command",&mp3Key) == ERROR_SUCCESS) + { + SetValue(mp3Key, commandLine); + RegCloseKey(mp3Key); + } + + /* Drag and Drop stuff */ + if (dragAndDropGUID && *dragAndDropGUID) + { + if (RegCreateKey6(HKEY_CLASSES_ROOT,winamp_file, L"\\shell\\", commandName, L"\\DropTarget",&mp3Key) == ERROR_SUCCESS) + { + SetValue(mp3Key, L"Clsid", dragAndDropGUID); + RegCloseKey(mp3Key); + } + } + + return S_OK; +} + +HRESULT FileTypeRegistrar::RemoveShell(const wchar_t *winamp_file, const wchar_t *commandName) +{ + wchar_t temp[1024] = {0}; + StringCchPrintfW(temp, 1024, L"%s\\shell\\%s", winamp_file, commandName); + myRegDeleteKeyEx(HKEY_CLASSES_ROOT, temp); + return S_OK; +} + +HRESULT FileTypeRegistrar::SetupFileType(const wchar_t *programName, const wchar_t *winamp_file, const wchar_t *name, int iconNumber, const wchar_t *defaultShellCommand, const wchar_t *iconPath) +{ + HKEY mp3Key = NULL; + wchar_t str[MAX_PATH+32] = {0}; + + if (RegCreateKeyW(HKEY_CLASSES_ROOT,winamp_file,&mp3Key) == ERROR_SUCCESS) + { + StringCchCopyW(str,MAX_PATH+32,name); + SetValue(mp3Key, str); + RegCloseKey(mp3Key); + } + + if (RegCreateKey4(HKEY_CLASSES_ROOT,winamp_file, L"\\DefaultIcon",&mp3Key) == ERROR_SUCCESS) + { + StringCchPrintfW(str,MAX_PATH+32,(iconPath[0]?L"%s":L"%s,%d"),(iconPath[0]?iconPath:programName),iconNumber); + SetValue(mp3Key, str); + RegCloseKey(mp3Key); + } + + if (RegCreateKey4(HKEY_CLASSES_ROOT,winamp_file, L"\\shell",&mp3Key) == ERROR_SUCCESS) + { + SetValue(mp3Key, defaultShellCommand); + RegCloseKey(mp3Key); + } + + return S_OK; +} + +HRESULT FileTypeRegistrar::SetupDefaultFileType(const wchar_t *winamp_file, const wchar_t *defaultShellCommand){ + + HKEY mp3Key = NULL; + + if (RegCreateKey4(HKEY_CLASSES_ROOT,winamp_file, L"\\shell",&mp3Key) == ERROR_SUCCESS) + { + SetValue(mp3Key, defaultShellCommand); + RegCloseKey(mp3Key); + } + + return S_OK; +} + +HRESULT FileTypeRegistrar::RegisterTypeShell(const wchar_t *programName, const wchar_t *which_file, const wchar_t *description, int iconNumber, const wchar_t *commandName) +{ + HKEY mp3Key = NULL; + + if (RegCreateKeyW(HKEY_CLASSES_ROOT,which_file,&mp3Key) == ERROR_SUCCESS) + { + SetValue(mp3Key, description); + char str[4]; + str[0]=0; + str[1]=0; + str[2]=1; + str[3]=0; + RegSetValueExW(mp3Key, L"EditFlags",0,REG_BINARY,(BYTE *)str,4); + RegCloseKey(mp3Key); + } + + if (RegCreateKey4(HKEY_CLASSES_ROOT, which_file, L"\\DefaultIcon",&mp3Key) == ERROR_SUCCESS) + { + wchar_t str[MAX_PATH+32] = {0}; + StringCchPrintfW(str,MAX_PATH+32,L"%s,%d",programName,iconNumber); + SetValue(mp3Key, str); + RegCloseKey(mp3Key); + } + + if (RegCreateKey4(HKEY_CLASSES_ROOT,which_file, L"\\shell",&mp3Key) == ERROR_SUCCESS) + { + SetValue(mp3Key, commandName); + RegCloseKey(mp3Key); + } + return S_OK; +} + +HRESULT FileTypeRegistrar::RegisterGUID(const wchar_t *programName, const wchar_t *guidString) +{ + HKEY mp3Key = NULL; + + if (RegCreateKey4(HKEY_CLASSES_ROOT,L"CLSID\\", guidString, &mp3Key) == ERROR_SUCCESS) + { + RegCloseKey(mp3Key); + } + + if (RegCreateKey5(HKEY_CLASSES_ROOT,L"CLSID\\", guidString, L"\\LocalServer32",&mp3Key) == ERROR_SUCCESS) + { + wchar_t str[MAX_PATH+32] = {0}; + StringCchPrintfW(str,MAX_PATH+32, L"\"%s\"",programName); + SetValue(mp3Key, str); + RegCloseKey(mp3Key); + } + return S_OK; +} + +HRESULT FileTypeRegistrar::RegisterDVDPlayer(const wchar_t *programName, int iconNumber, + const wchar_t *which_file /*Winamp.DVD*/, const wchar_t *commandName /* Winamp */, + const wchar_t *provider /* Nullsoft Winamp */, const wchar_t *description /* Play in Winamp */) +{ + // TODO: stop hardcoding stuff as soon as we start using this + wchar_t winampPath[MAX_PATH+128] = {0}; + wchar_t winampIcon[MAX_PATH] = {0}; + HKEY mp3Key = NULL; + + // create icon path and exe-with-param path + StringCbPrintfW(winampIcon,sizeof(winampIcon), L"\"%s\", %d", programName, iconNumber); + StringCbPrintfW(winampPath,sizeof(winampPath), L"\"%s\" %1", programName); + + // uncomment if we ever want to overwrite the default icon... not set because we don't have a good dvd icon in winamp.exe + /* + if (RegOpenKey(HKEY_CLASSES_ROOT,"DVD\\DefaultIcon",&mp3Key) == ERROR_SUCCESS) + { + RegSetValueExW(mp3Key,NULL,0,REG_SZ,winampIcon,iconSize); + } + */ + if (RegCreateKeyW(HKEY_CLASSES_ROOT,L"DVD\\shell",&mp3Key) == ERROR_SUCCESS) + { + // set winamp to be the default player + SetValue(mp3Key, commandName); + RegCloseKey(mp3Key); + } + + if (RegCreateKey4(HKEY_CLASSES_ROOT,L"DVD\\shell\\", commandName, &mp3Key) == ERROR_SUCCESS) + { + // text to appear in right-click shell menu in explorer + SetValue(mp3Key, description); + RegCloseKey(mp3Key); + } + + if (RegCreateKey5(HKEY_CLASSES_ROOT,L"DVD\\shell\\", commandName, L"\\command",&mp3Key) == ERROR_SUCCESS) + { + // set the executable path + SetValue(mp3Key, winampPath); + RegCloseKey(mp3Key); + } + + if (RegCreateKeyW(HKEY_LOCAL_MACHINE,L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\AutoplayHandlers\\EventHandlers\\PlayDVDMovieOnArrival",&mp3Key) == ERROR_SUCCESS) + { + // register winamp for dvd autoplay + RegSetValueExW(mp3Key,which_file,0,REG_SZ,0,0); + RegCloseKey(mp3Key); + } + + if (RegCreateKey4(HKEY_LOCAL_MACHINE,L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\AutoplayHandlers\\Handlers\\", which_file, &mp3Key) == ERROR_SUCCESS) + { + // autoplay details + SetValue(mp3Key,L"Action", description); + SetValue(mp3Key,L"DefaultIcon", winampIcon); + SetValue(mp3Key,L"InvokeProgID", L"DVD"); + SetValue(mp3Key,L"InvokeVerb", commandName); + SetValue(mp3Key,L"Provider", provider); + RegCloseKey(mp3Key); + } + return S_OK; +} + +HRESULT FileTypeRegistrar::InstallItem(LPCWSTR sourceFile, LPCWSTR destinationFolder, LPCWSTR destinationFilename) +{ + SHFILEOPSTRUCT op = {0}; + + op.hwnd = 0; + op.wFunc = FO_COPY; + + wchar_t srcFile[MAX_PATH+1] = {0}; + wchar_t *end; + StringCchCopyExW(srcFile, MAX_PATH, sourceFile, &end, 0, 0); + if (end) + end[1]=0; // double null terminate + op.pFrom = srcFile; + + wchar_t destFile[MAX_PATH+1] = {0}; + PathCombineW(destFile, destinationFolder, destinationFilename); + destFile[wcslen(destFile)+1]=0; // double null terminate + op.pTo = destFile; + + op.fFlags=FOF_NOCONFIRMATION|FOF_NOCONFIRMMKDIR|FOF_SIMPLEPROGRESS|FOF_NOERRORUI|FOF_SILENT; + op.lpszProgressTitle = L""; + int val = SHFileOperation(&op); + + // send back the error message so we can show on the UI + if (val != 0 && val != 0x71/*DE_SAMEFILE*/) + { + StringCchPrintfW((LPWSTR)destinationFilename,MAX_PATH,L"0x%x",val); + } + + return ((val == 0 || val == 0x71/*DE_SAMEFILE*/) ? S_OK : E_FAIL); +} + +HRESULT FileTypeRegistrar::DeleteItem(LPCWSTR file) +{ + SHFILEOPSTRUCT op = {0}; + op.wFunc = FO_DELETE; + + wchar_t srcFile[MAX_PATH+1] = {0}; + wchar_t *end; + StringCchCopyExW(srcFile, MAX_PATH, file, &end, 0, 0); + if (end) end[1]=0; // double null terminate + op.pFrom = srcFile; + op.fFlags = FOF_NOCONFIRMATION|FOF_NOCONFIRMMKDIR|FOF_SIMPLEPROGRESS|FOF_NORECURSION|FOF_NOERRORUI|FOF_SILENT|FOF_ALLOWUNDO; + op.lpszProgressTitle = L""; + int val = SHFileOperation(&op); + return val == 0?S_OK:E_FAIL; +} + +HRESULT FileTypeRegistrar::RenameItem(LPCWSTR oldFile, LPCWSTR newFile, BOOL force) +{ + SHFILEOPSTRUCT op = {0}; + op.wFunc = force?FO_MOVE:FO_RENAME; + + wchar_t srcFile[MAX_PATH+1] = {0}; + wchar_t *end; + StringCchCopyExW(srcFile, MAX_PATH, oldFile, &end, 0, 0); + if (end) end[1]=0; // double null terminate + op.pFrom = srcFile; + + wchar_t destFile[MAX_PATH+1] = {0}; + end=0; + StringCchCopyExW(destFile, MAX_PATH, newFile, &end, 0, 0); + if (end) end[1]=0; // double null terminate + op.pTo = destFile; + + op.fFlags=FOF_NOCONFIRMATION|FOF_NOCONFIRMMKDIR|FOF_SIMPLEPROGRESS|FOF_NOERRORUI|FOF_SILENT; + op.lpszProgressTitle = L""; + int val = SHFileOperation(&op); + + return val == 0?S_OK:E_FAIL; + + /* + if (!MoveFile(oldFile, newFile)) + { + // if move failed + + if (!force) // if they don't want to force the move + return E_FAIL; + + if (CopyFile(oldFile, newFile, FALSE) && DeleteFile(oldFile)) // copy then delete + return E_FAIL; + } + return S_OK; + */ +} + +HRESULT FileTypeRegistrar::CleanupDirectory(LPCWSTR directory) +{ + wchar_t dirmask[MAX_PATH] = {0}; + WIN32_FIND_DATAW d = {0}; + PathCombineW(dirmask, directory, L"*.*"); + HANDLE h = FindFirstFileW(dirmask, &d); + if (h != INVALID_HANDLE_VALUE) + { + do + { + wchar_t v[MAX_PATH] = {0}; + PathCombineW(v, directory, d.cFileName); + if (d.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + { + if (wcscmp(d.cFileName,L".") && wcscmp(d.cFileName,L"..")) + CleanupDirectory(v); + } + else + { + if(!DeleteFileW(v)) + { + // this handles some rogue cases where files in the wlz's aren't unloadable + MoveFileExW(v, NULL, MOVEFILE_DELAY_UNTIL_REBOOT); + MoveFileExW(directory, NULL, MOVEFILE_DELAY_UNTIL_REBOOT); + } + } + } + while (FindNextFileW(h, &d)); + FindClose(h); + } + RemoveDirectoryW(directory); + return S_OK; +} + +HRESULT FileTypeRegistrar::MoveDirectoryContents(LPCWSTR oldDirectory, LPCWSTR newDirectory) +{ + wchar_t fromDirectory[MAX_PATH+1] = {0}; // need to zero it all so it will be double-null terminated + SHFILEOPSTRUCT sf = {0}; + + StringCchPrintfW(fromDirectory,MAX_PATH,L"%s\\*",oldDirectory); + + sf.wFunc = FO_MOVE; + sf.pFrom = fromDirectory; + sf.pTo = newDirectory; + sf.fFlags = FOF_NOCONFIRMATION|FOF_NOCONFIRMMKDIR|FOF_NOERRORUI|FOF_NORECURSION; + + if(SHFileOperation(&sf)){ + return E_FAIL; + } + return S_OK; +} + +HRESULT FileTypeRegistrar::WriteProKey(LPCWSTR name, LPCWSTR key) +{ + HKEY hkey = NULL; + + if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Nullsoft\\Winamp", 0, 0, 0, KEY_READ | KEY_WRITE, NULL, &hkey, NULL) == ERROR_SUCCESS) + { + if (*name) + SetValue(hkey, L"regname", name); + else + RegDeleteValueW(hkey, L"regname"); + + if (*key) + { + wchar_t buf[33] = {0}; + StringCchCopyW(buf + 1, 32, key); + buf[0] = '~'; + for (int x = 1;buf[x]; x ++) + { + wchar_t c = towupper(buf[x]); + //char c = buf[x]; // benski> goes with above commented line that i'd like to uncomment + if (c >= 'A' && c <= 'Z') + { + int w = c - 'A'; + w += x; + w %= 26; + buf[x] = 'A' + w; + } + else if (c >= '0' && c <= '9') + { + int w = c - '0'; + w += x * 27; + w %= 10; + buf[x] = 'a' + w; + } + else if (c == '-') buf[x] = '/'; + } + SetValue(hkey, L"regkey", buf); + } + else + { + RegDeleteValueW(hkey, L"regkey"); + } + RegCloseKey(hkey); + return S_OK; + } + + return E_FAIL; +} + +HRESULT FileTypeRegistrar::WriteClientUIDKey(LPCWSTR path, LPCWSTR uid_str) +{ + HKEY hkey = NULL; + + if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Nullsoft\\Winamp", 0, 0, 0, KEY_READ | KEY_WRITE, NULL, &hkey, NULL) == ERROR_SUCCESS) + { + SetValue(hkey, path, uid_str); + RegCloseKey(hkey); + return S_OK; + } + + return E_FAIL; +} + +HRESULT FileTypeRegistrar::RegisterProtocol(LPCWSTR protocol, LPCWSTR command, LPCWSTR icon) +{ + return S_OK; + + HKEY mp3Key = NULL; + + if (RegCreateKeyW(HKEY_CLASSES_ROOT, protocol, &mp3Key) == ERROR_SUCCESS) + { + wchar_t regStr[256] = {0}; + SetValue(mp3Key, L"URL:Winamp Command Handler"); + SetValue(mp3Key, L"URL Protocol", L""); + RegCloseKey(mp3Key); + + StringCbPrintfW(regStr, sizeof(regStr), L"%s\\DefaultIcon", protocol); + if (RegCreateKeyW(HKEY_CLASSES_ROOT,regStr,&mp3Key) == ERROR_SUCCESS) + { + SetValue(mp3Key, icon); + RegCloseKey(mp3Key); + } + + StringCbPrintfW(regStr, sizeof(regStr), L"%s\\shell\\open\\command", protocol); + if (RegCreateKeyW(HKEY_CLASSES_ROOT,regStr,&mp3Key) == ERROR_SUCCESS) + { + SetValue(mp3Key, command); + RegCloseKey(mp3Key); + } + } + + return S_OK; +} + +HRESULT FileTypeRegistrar::RegisterCapability(const wchar_t *programName, const wchar_t *winamp_file, const wchar_t *extension) +{ +#if defined(_SYSINFOAPI_H_) && defined(NOT_BUILD_WINDOWS_DEPRECATE) && (_WIN32_WINNT >= 0x0501) + if (IsWindowsVersionOrGreater(6, 0, 0)) // Vista +#else + OSVERSIONINFO version = { 0 }; + version.dwOSVersionInfoSize = sizeof(version); + if (!GetVersionEx(&version)) ZeroMemory(&version, sizeof(OSVERSIONINFO)); + if (version.dwMajorVersion >= 6) // Vista +#endif + { + HKEY hkey_file_associations = NULL; + if (ERROR_SUCCESS == RegMedia_CreateKey(L"Capabilities\\FileAssociations", &hkey_file_associations, programName)) + { + RegDeleteValueW(hkey_file_associations, extension); // to make sure that they are all in case that we need + SetValue(hkey_file_associations, extension, winamp_file); + RegCloseKey(hkey_file_associations); + } + } + return S_OK; +}
\ No newline at end of file diff --git a/Src/Elevator/FileTypeRegistrar.h b/Src/Elevator/FileTypeRegistrar.h new file mode 100644 index 00000000..573438bb --- /dev/null +++ b/Src/Elevator/FileTypeRegistrar.h @@ -0,0 +1,158 @@ +#pragma once + +#if defined(_WIN64) + #include "IFileTypeRegistrar_64.h" +#else + #include "IFileTypeRegistrar_32.h" +#endif + +class FileTypeRegistrar : public IFileTypeRegistrar +{ +public: + FileTypeRegistrar(); + /* IUnknown */ + HRESULT STDMETHODCALLTYPE QueryInterface( + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject + ); + ULONG STDMETHODCALLTYPE AddRef(void); + ULONG STDMETHODCALLTYPE Release(void); + + /* Stuff we define */ + HRESULT STDMETHODCALLTYPE RegisterMIMEType( + /* [in, string] */ LPCWSTR mimeType, + /* [in, string] */ LPCWSTR programName, + /* [in, string] */ LPCWSTR extension, + BOOL netscapeOnly + ); + + HRESULT STDMETHODCALLTYPE RegisterCDPlayer( + /* [in, string] */ LPCWSTR programName + ); + + HRESULT STDMETHODCALLTYPE UnregisterCDPlayer( + /* [in, string] */ LPCWSTR programName + ); + + HRESULT STDMETHODCALLTYPE RegisterType( + /* [in, string] */ LPCWSTR extension, + /* [in, string] */ LPCWSTR which_str, + /* [in, string] */ LPCWSTR prog_name + ); + + HRESULT STDMETHODCALLTYPE UnregisterType( + /* [in, string] */ LPCWSTR extension, + /* [in, string] */ LPCWSTR which_str, + /* [in, string] */ LPCWSTR prog_name, + /*[in]*/ int iconNumber + ); + + HRESULT STDMETHODCALLTYPE AddDirectoryContext( + /* [in, string] */ LPCWSTR programName, + /* [in, string] */ LPCWSTR which_str, + /* [in, string] */ LPCWSTR description + ); + + HRESULT STDMETHODCALLTYPE RemoveDirectoryContext( + /* [in, string] */ LPCWSTR which_str + ); + + HRESULT STDMETHODCALLTYPE AddAgent( + /* [in, string] */ LPCWSTR agentFilename + ); + + HRESULT STDMETHODCALLTYPE RemoveAgent(); + + HRESULT STDMETHODCALLTYPE RegisterMediaPlayer( + DWORD accessEnabled, + /* [in, string] */ LPCWSTR programName, + /* [in, string] */ LPCWSTR prog_name, + int iconNumber + ); + + HRESULT STDMETHODCALLTYPE RegisterMediaPlayerProtocol(LPCWSTR protocol, LPCWSTR prog_name); + HRESULT STDMETHODCALLTYPE UnregisterMediaPlayerProtocol(LPCWSTR protocol, LPCWSTR prog_name); + + HRESULT STDMETHODCALLTYPE SetupFileType( + /* [in, string] */ LPCWSTR programName, + /* [in, string] */ LPCWSTR winamp_file, + /* [in, string] */ LPCWSTR name, + int iconNumber, + /* [in, string] */ LPCWSTR defaultShellCommand, + /* [in, string] */ LPCWSTR iconPath + ); + + HRESULT STDMETHODCALLTYPE SetupShell( + /* [in, string] */ LPCWSTR commandLine, + /* [in, string] */ LPCWSTR winamp_file, + /* [in, string] */ LPCWSTR description, + /* [in, string] */ LPCWSTR commandName, + /* [in, string] */ LPCWSTR dragAndDropGUID + ); + + HRESULT STDMETHODCALLTYPE RemoveShell( + /* [in, string] */ LPCWSTR winamp_file, + /* [in, string] */ LPCWSTR commandName + ); + + HRESULT STDMETHODCALLTYPE SetupDefaultFileType( + /* [in, string] */ LPCWSTR winamp_file, + /* [in, string] */ LPCWSTR defaultShellCommand + ); + + HRESULT STDMETHODCALLTYPE RegisterTypeShell( + /* [in, string] */ LPCWSTR programName, + /* [in, string] */ LPCWSTR which_file, + /* [in, string] */ LPCWSTR description, + int iconNumber, + /* [in, string] */ LPCWSTR commandName + ); + + HRESULT STDMETHODCALLTYPE RegisterGUID( + /* [in, string] */ LPCWSTR programName, + /* [in, string] */ LPCWSTR guidString + ); + + HRESULT STDMETHODCALLTYPE RegisterDVDPlayer( + /* [in, string] */ LPCWSTR programName, + int iconNumber, + /* [in, string] */ LPCWSTR which_file, + /* [in, string] */ LPCWSTR commandName, + /* [in, string] */ LPCWSTR provider, + /* [in, string] */ LPCWSTR description + ); + + HRESULT STDMETHODCALLTYPE InstallItem( + LPCWSTR sourceFile, + LPCWSTR destinationFolder, + LPCWSTR destinationFilename + ); + + HRESULT STDMETHODCALLTYPE DeleteItem( + LPCWSTR file + ); + + HRESULT STDMETHODCALLTYPE RenameItem( + LPCWSTR oldFile, + LPCWSTR newFile, + BOOL force + ); + + HRESULT STDMETHODCALLTYPE CleanupDirectory( + LPCWSTR directory + ); + + HRESULT STDMETHODCALLTYPE MoveDirectoryContents( + LPCWSTR oldDirectory, + LPCWSTR newDirectory + ); + + HRESULT STDMETHODCALLTYPE WriteProKey(LPCWSTR name, LPCWSTR key); + HRESULT STDMETHODCALLTYPE WriteClientUIDKey(LPCWSTR path, LPCWSTR uid_str); + + HRESULT STDMETHODCALLTYPE RegisterProtocol(LPCWSTR protocol, LPCWSTR command, LPCWSTR icon); + HRESULT STDMETHODCALLTYPE RegisterCapability(const wchar_t *programName, const wchar_t *winamp_file, const wchar_t *extension); + +//private: + volatile ULONG refCount; +};
\ No newline at end of file diff --git a/Src/Elevator/FileTypeRegistrar.rgs b/Src/Elevator/FileTypeRegistrar.rgs new file mode 100644 index 00000000..73703e1e --- /dev/null +++ b/Src/Elevator/FileTypeRegistrar.rgs @@ -0,0 +1,26 @@ +HKCR +{ + Elevator.WFileTypeRegistrar.1 = s 'WFileTypeRegistrar Class' + { + CLSID = s '{3B29AB5C-52CB-4a36-9314-E3FEE0BA7468}' + } + Elevator.WFileTypeRegistrar = s 'WFileTypeRegistrar Class' + { + CLSID = s '{3B29AB5C-52CB-4a36-9314-E3FEE0BA7468}' + CurVer = s 'Elevator.WFileTypeRegistrar.1' + } + NoRemove CLSID + { + ForceRemove {3B29AB5C-52CB-4a36-9314-E3FEE0BA7468} = s 'WFileTypeRegistrar Class' + { + ProgID = s 'Elevator.WFileTypeRegistrar.1' + VersionIndependentProgID = s 'Elevator.WFileTypeRegistrar' + ForceRemove 'Programmable' + LocalServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Both' + } + 'TypeLib' = s '{E06EFB8F-75A5-4AEF-B4E4-245664CF74EC}' + } + } +} diff --git a/Src/Elevator/IFileTypeRegistrar.idl b/Src/Elevator/IFileTypeRegistrar.idl new file mode 100644 index 00000000..18785544 --- /dev/null +++ b/Src/Elevator/IFileTypeRegistrar.idl @@ -0,0 +1,190 @@ +import "oaidl.idl"; +import "ocidl.idl"; +import "wtypes.idl"; + +[ + object, +// dual, +// nonextensible, + uuid(2E74C695-8E9C-4179-B0A0-BC2EBDEB5C2B), + helpstring("IFileTypeRegistrar Interface"), + pointer_default(unique) +] +interface IFileTypeRegistrar : IUnknown +{ + HRESULT RegisterMIMEType( + [in, string] LPCWSTR mimeType, + [in, string] LPCWSTR programName, + [in, string] LPCWSTR extension, + [in] BOOL netscapeOnly + ); + + HRESULT RegisterCDPlayer( + [in, string] LPCWSTR programName + ); + + HRESULT UnregisterCDPlayer( + [in, string] LPCWSTR programName + ); + + HRESULT RegisterType( + [in, string] LPCWSTR extension, + [in, string] LPCWSTR which_str, + [in, string] LPCWSTR prog_name + ); + + HRESULT UnregisterType( + [in, string] LPCWSTR extension, + [in, string] LPCWSTR which_str, + [in, string] LPCWSTR prog_name, + [in] int is_playlist + ); + + HRESULT AddDirectoryContext( + [in, string] LPCWSTR commandLine, + [in, string] LPCWSTR which_str, + [in, string] LPCWSTR description + ); + + HRESULT RemoveDirectoryContext( + [in, string] LPCWSTR which_str + ); + + HRESULT AddAgent( + [in, string] LPCWSTR agentFilename + ); + + HRESULT RemoveAgent(); + + HRESULT RegisterMediaPlayer( + [in] DWORD accessEnabled, + [in, string] LPCWSTR programName, + [in, string] LPCWSTR prog_name, + [in] int iconNumber + ); + + HRESULT RegisterMediaPlayerProtocol( + [in, string] LPCWSTR protocol, + [in, string] LPCWSTR prog_name + ); + + HRESULT UnregisterMediaPlayerProtocol( + [in, string] LPCWSTR protocol, + [in, string] LPCWSTR prog_name + ); + + HRESULT SetupFileType( + [in, string] LPCWSTR programName, + [in, string] LPCWSTR winamp_file, + [in, string] LPCWSTR name, + [in] int iconNumber, + [in, string] LPCWSTR defaultShellCommand, + [in, string] LPCWSTR iconPath + ); + + HRESULT SetupShell( + [in, string] LPCWSTR commandLine, + [in, string] LPCWSTR winamp_file, + [in, string] LPCWSTR description, + [in, string] LPCWSTR commandName, + [in, string] LPCWSTR dragAndDropGUID + ); + + HRESULT RemoveShell( + [in, string] LPCWSTR winamp_file, + [in, string] LPCWSTR commandName + ); + + HRESULT SetupDefaultFileType( + [in, string] LPCWSTR winamp_file, + [in, string] LPCWSTR defaultShellCommand + ); + + HRESULT RegisterTypeShell( + [in, string] LPCWSTR programName, + [in, string] LPCWSTR which_file, + [in, string] LPCWSTR description, + [in] int iconNumber, + [in, string] LPCWSTR commandName + ); + + HRESULT RegisterGUID( + [in, string] LPCWSTR programName, + [in, string] LPCWSTR guidString + ); + + HRESULT RegisterDVDPlayer( + [in, string] LPCWSTR programName, + [in] int iconNumber, + [in, string] LPCWSTR which_file, + [in, string] LPCWSTR commandName, + [in, string] LPCWSTR provider, + [in, string] LPCWSTR description + ); + + HRESULT InstallItem( + [in, string] LPCWSTR sourceFile, + [in, string] LPCWSTR destinationFolder, + [in, string] LPCWSTR destinationFilename + ); + + HRESULT DeleteItem( + [in, string] LPCWSTR file + ); + + HRESULT RenameItem( + [in, string] LPCWSTR oldFile, + [in, string] LPCWSTR newFile, + [in] BOOL force + ); + + HRESULT CleanupDirectory( + [in, string] LPCWSTR directory + ); + + HRESULT MoveDirectoryContents( + [in, string] LPCWSTR oldDirectory, + [in, string] LPCWSTR newDirectory + ); + + HRESULT WriteProKey( + [in, string] LPCWSTR name, + [in, string] LPCWSTR key + ); + + HRESULT WriteClientUIDKey( + [in, string] LPCWSTR path, + [in, string] LPCWSTR uid_str + ); + + HRESULT RegisterProtocol( + [in, string] LPCWSTR protocol, + [in, string] LPCWSTR command, + [in, string] LPCWSTR icon + ); + + HRESULT RegisterCapability( + [in, string] LPCWSTR programName, + [in, string] LPCWSTR winamp_file, + [in, string] LPCWSTR extension + ); +}; + +[ + uuid(B3600382-8669-402B-81B2-3D18B0E2318B), + version(1.1), + helpstring("Elevator 1.1 Type Library") +] +library ElevatorLib +{ + importlib("stdole2.tlb"); + [ + uuid(3B29AB5C-52CB-4a36-9314-E3FEE0BA7468), + appobject, + ] + coclass WFileTypeRegistrar + { + [default] interface IFileTypeRegistrar; + }; +}; + diff --git a/Src/Elevator/dlldata.c b/Src/Elevator/dlldata.c new file mode 100644 index 00000000..4f8e2a8c --- /dev/null +++ b/Src/Elevator/dlldata.c @@ -0,0 +1,37 @@ +/********************************************************* + DllData file -- generated by MIDL compiler + + DO NOT ALTER THIS FILE + + This file is regenerated by MIDL on every IDL file compile. + + To completely reconstruct this file, delete it and rerun MIDL + on all the IDL files in this DLL, specifying this file for the + /dlldata command line option + +*********************************************************/ + + +#include <rpcproxy.h> + +#ifdef __cplusplus +extern "C" { +#endif + +EXTERN_PROXY_FILE( IFileTypeRegistrar ) + + +PROXYFILE_LIST_START +/* Start of list */ + REFERENCE_PROXY_FILE( IFileTypeRegistrar ), +/* End of list */ +PROXYFILE_LIST_END + + +DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID ) + +#ifdef __cplusplus +} /*extern "C" */ +#endif + +/* end of generated dlldata file */ diff --git a/Src/Elevator/resource.h b/Src/Elevator/resource.h new file mode 100644 index 00000000..2a3efee0 --- /dev/null +++ b/Src/Elevator/resource.h @@ -0,0 +1,16 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Elevator.rc +// +#define IDS_PROJNAME 100 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 202 +#define _APS_NEXT_COMMAND_VALUE 32768 +#define _APS_NEXT_CONTROL_VALUE 201 +#define _APS_NEXT_SYMED_VALUE 102 +#endif +#endif diff --git a/Src/Elevator/resource1.h b/Src/Elevator/resource1.h new file mode 100644 index 00000000..ae1debff --- /dev/null +++ b/Src/Elevator/resource1.h @@ -0,0 +1,17 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Elevator.rc +// +#define IDS_WINAMP 101 +#define IDI_ICON1 102 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 103 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/Src/Elevator/resource2.h b/Src/Elevator/resource2.h new file mode 100644 index 00000000..efd98423 --- /dev/null +++ b/Src/Elevator/resource2.h @@ -0,0 +1,14 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by ElevatorPS.rc + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/Src/Elevator/stdafx.cpp b/Src/Elevator/stdafx.cpp new file mode 100644 index 00000000..72884859 --- /dev/null +++ b/Src/Elevator/stdafx.cpp @@ -0,0 +1,5 @@ +// stdafx.cpp : source file that includes just the standard includes +// Elevator.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" diff --git a/Src/Elevator/stdafx.h b/Src/Elevator/stdafx.h new file mode 100644 index 00000000..06cb6b1e --- /dev/null +++ b/Src/Elevator/stdafx.h @@ -0,0 +1,42 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +#pragma once + +#ifndef STRICT +#define STRICT +#endif + +// Modify the following defines if you have to target a platform prior to the ones specified below. +// Refer to MSDN for the latest info on corresponding values for different platforms. +#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later. +#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later. +#endif + +#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later. +#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 2000 or later. +#endif + +#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. +#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. +#endif + +#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later. +#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later. +#endif + +#define _ATL_APARTMENT_THREADED +#define _ATL_NO_AUTOMATIC_NAMESPACE + +#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit + +// turns off ATL's hiding of some common and often safely ignored warning messages +#define _ATL_ALL_WARNINGS + + +#include "resource.h" +//#include <atlbase.h> +//#include <atlcom.h> + +//using namespace ATL;
\ No newline at end of file diff --git a/Src/Elevator/version.rc2 b/Src/Elevator/version.rc2 new file mode 100644 index 00000000..af4dc44f --- /dev/null +++ b/Src/Elevator/version.rc2 @@ -0,0 +1,39 @@ + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// +#include "../Winamp/buildType.h" +VS_VERSION_INFO VERSIONINFO + FILEVERSION WINAMP_PRODUCTVER + PRODUCTVERSION WINAMP_PRODUCTVER + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Winamp SA" + VALUE "FileDescription", "Winamp Elevator" + VALUE "FileVersion", STR_WINAMP_PRODUCTVER + VALUE "InternalName", "Winamp Elevator" + VALUE "LegalCopyright", "Copyright © 2008-2023 Winamp SA" + VALUE "LegalTrademarks", "Nullsoft and Winamp are trademarks of Winamp SA" + VALUE "OriginalFilename", "Elevator.exe" + VALUE "ProductName", "Winamp" + VALUE "ProductVersion", STR_WINAMP_PRODUCTVER + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/Src/Elevator/versionPS.rc2 b/Src/Elevator/versionPS.rc2 new file mode 100644 index 00000000..9921e42b --- /dev/null +++ b/Src/Elevator/versionPS.rc2 @@ -0,0 +1,39 @@ + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// +#include "../Winamp/buildType.h" +VS_VERSION_INFO VERSIONINFO + FILEVERSION WINAMP_PRODUCTVER + PRODUCTVERSION WINAMP_PRODUCTVER + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Winamp SA" + VALUE "FileDescription", "Winamp Elevator DLL" + VALUE "FileVersion", STR_WINAMP_PRODUCTVER + VALUE "InternalName", "Winamp Elevator" + VALUE "LegalCopyright", "Copyright © 2008-2023 Winamp SA" + VALUE "LegalTrademarks", "Nullsoft and Winamp are trademarks of Winamp SA" + VALUE "OriginalFilename", "Elevatorps.exe" + VALUE "ProductName", "Winamp" + VALUE "ProductVersion", STR_WINAMP_PRODUCTVER + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END |