ReactOS 0.4.15-dev-5666-gc548b97
mydocs.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: mydocs
3 * LICENSE: LGPL-2.1+ (https://spdx.org/licenses/LGPL-2.1+)
4 * PURPOSE: MyDocs implementation
5 * COPYRIGHT: Copyright 2019 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
6 */
7
8#include "precomp.hpp"
9
11
12BEGIN_OBJECT_MAP(ObjectMap)
13 OBJECT_ENTRY(CLSID_MyDocsDropHandler, CMyDocsDropHandler)
15
18
19static BOOL
21{
26 {
28 return TRUE;
29 }
30 return FALSE;
31}
32
33static HRESULT
35{
36 WCHAR szTarget[MAX_PATH], szSendToFile[MAX_PATH];
37
39
40 StringCbCopyW(szSendToFile, sizeof(szSendToFile), pszSendTo);
41 PathAppendW(szSendToFile, PathFindFileNameW(szTarget));
42 StringCbCatW(szSendToFile, sizeof(szSendToFile), L".mydocs");
43
44 if (!CreateEmptyFile(szSendToFile))
45 {
46 ERR("CreateEmptyFile(%S, %S) failed!\n", szSendToFile, szTarget);
47 return E_FAIL;
48 }
49
50 return S_OK;
51}
52
53static HRESULT
55{
57 SHGFP_TYPE_DEFAULT, pszPath);
58}
59
61{
63 return S_FALSE;
64 return gModule.DllCanUnloadNow();
65}
66
68{
69 TRACE("CLSID:%s,IID:%s\n", wine_dbgstr_guid(&rclsid), wine_dbgstr_guid(&riid));
70
72
73 TRACE("-- pointer to class factory: %p\n", *ppv);
74
75 return hr;
76}
77
79{
82 return hr;
83
84 WCHAR szSendTo[MAX_PATH];
85 hr = GetDefaultUserSendTo(szSendTo);
86 if (SUCCEEDED(hr))
88
89 return S_OK;
90}
91
93{
96 return hr;
97
98 return S_OK;
99}
100
102{
103 TRACE("%p 0x%x %p\n", hInstance, dwReason, fImpLoad);
105 {
106 gModule.Init(ObjectMap, hInstance, NULL);
108 }
109 else if (dwReason == DLL_PROCESS_DETACH)
110 {
111 gModule.Term();
112 }
113 return TRUE;
114}
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define STDAPI_(t)
Definition: basetyps.h:42
#define STDAPI
Definition: basetyps.h:41
#define ERR(fmt,...)
Definition: debug.h:110
HINSTANCE hInstance
Definition: charmap.c:19
void Term()
Definition: atlbase.h:821
HRESULT DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
Definition: atlbase.h:936
HRESULT DllUnregisterServer(BOOL bUnRegTypeLib=TRUE)
Definition: atlbase.h:946
HRESULT Init(_ATL_OBJMAP_ENTRY *p, HINSTANCE, const GUID *plibid)
Definition: atlbase.h:798
HRESULT DllCanUnloadNow()
Definition: atlbase.h:929
HRESULT DllRegisterServer(BOOL bRegTypeLib=TRUE)
Definition: atlbase.h:941
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define MAX_PATH
Definition: compat.h:34
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define FILE_SHARE_READ
Definition: compat.h:136
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:2558
BOOL WINAPI SHGetSpecialFolderPathW(HWND hwndOwner, LPWSTR szPath, int nFolder, BOOL bCreate)
Definition: shellpath.c:3061
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
Definition: path.c:394
BOOL WINAPI PathAppendW(LPWSTR lpszPath, LPCWSTR lpszAppend)
Definition: path.c:126
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
BOOL WINAPI DllMain(IN HINSTANCE hinstDLL, IN DWORD dwReason, IN LPVOID lpvReserved)
Definition: kbsdll.c:95
#define END_OBJECT_MAP()
Definition: atlcom.h:652
#define OBJECT_ENTRY(clsid, class)
Definition: atlcom.h:654
#define BEGIN_OBJECT_MAP(x)
Definition: atlcom.h:650
#define CREATE_ALWAYS
Definition: disk.h:72
_In_ HANDLE hFile
Definition: mswsock.h:90
STDAPI DllRegisterServer(void)
Definition: mydocs.cpp:78
static BOOL CreateEmptyFile(LPCWSTR pszFile)
Definition: mydocs.cpp:20
DWORD LPVOID fImpLoad
Definition: mydocs.cpp:102
LONG g_ModuleRefCnt
Definition: mydocs.cpp:17
STDAPI DllUnregisterServer(void)
Definition: mydocs.cpp:92
static HRESULT CreateSendToMyDocuments(LPCWSTR pszSendTo)
Definition: mydocs.cpp:34
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
Definition: mydocs.cpp:67
return TRUE
Definition: mydocs.cpp:113
CComModule gModule
Definition: mydocs.cpp:16
DWORD dwReason
Definition: mydocs.cpp:101
static HRESULT GetDefaultUserSendTo(LPWSTR pszPath)
Definition: mydocs.cpp:54
STDAPI DllCanUnloadNow(void)
Definition: mydocs.cpp:60
#define GENERIC_WRITE
Definition: nt_native.h:90
#define L(x)
Definition: ntvdm.h:50
long LONG
Definition: pedump.c:60
#define REFIID
Definition: guiddef.h:118
#define REFCLSID
Definition: guiddef.h:117
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:197
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
HRESULT hr
Definition: shlfolder.c:183
#define CSIDL_SENDTO
Definition: shlobj.h:2034
#define CSIDL_MYDOCUMENTS
Definition: shlobj.h:2037
@ SHGFP_TYPE_DEFAULT
Definition: shlobj.h:2002
#define TRACE(s)
Definition: solgame.cpp:4
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
STRSAFEAPI StringCbCatW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:342
#define S_FALSE
Definition: winerror.h:2357
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185