ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

objsel.c
Go to the documentation of this file.
00001 /*
00002  * Object Picker Dialog
00003  *
00004  * Copyright 2005 Thomas Weidenmueller <w3seek@reactos.com>
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00019  */
00020 
00021 #include "objsel_private.h"
00022 #include "rpcproxy.h"
00023 
00024 #include "wine/debug.h"
00025 
00026 WINE_DEFAULT_DEBUG_CHANNEL(objsel);
00027 
00028 LONG dll_refs = 0;
00029 static HINSTANCE hInstance;
00030 
00031 /***********************************************************************
00032  *      DllEntryPoint
00033  */
00034 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
00035 {
00036     switch(fdwReason)
00037     {
00038         case DLL_PROCESS_ATTACH:
00039             hInstance = hinstDLL;
00040             DisableThreadLibraryCalls(hInstance);
00041             break;
00042     }
00043     return TRUE;
00044 }
00045 
00046 
00047 /***********************************************************************
00048  *      DllGetClassObject (OBJSEL.@)
00049  */
00050 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
00051 {
00052     TRACE("(%s, %s, %p)\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv);
00053 
00054     *ppv = NULL;
00055 
00056     if (IsEqualGUID(rclsid, &CLSID_DsObjectPicker))
00057         return IClassFactory_QueryInterface(&OBJSEL_ClassFactory.IClassFactory_iface, iid, ppv);
00058 
00059     FIXME("CLSID: %s, IID: %s\n", debugstr_guid(rclsid), debugstr_guid(iid));
00060     return CLASS_E_CLASSNOTAVAILABLE;
00061 }
00062 
00063 
00064 /***********************************************************************
00065  *      DllCanUnloadNow (OBJSEL.@)
00066  */
00067 HRESULT WINAPI DllCanUnloadNow(void)
00068 {
00069     return dll_refs != 0 ? S_FALSE : S_OK;
00070 }
00071 
00072 
00073 /***********************************************************************
00074  *      DllRegisterServer (OBJSEL.@)
00075  */
00076 HRESULT WINAPI DllRegisterServer(void)
00077 {
00078     return __wine_register_resources( hInstance );
00079 }
00080 
00081 
00082 /***********************************************************************
00083  *      DllUnregisterServer (OBJSEL.@)
00084  */
00085 HRESULT WINAPI DllUnregisterServer(void)
00086 {
00087     return __wine_unregister_resources( hInstance );
00088 }
00089 
00090 
00091 /**********************************************************************
00092  * OBJSEL_IDsObjectPicker_Destroy (also IUnknown)
00093  */
00094 static VOID OBJSEL_IDsObjectPicker_Destroy(IDsObjectPickerImpl *This)
00095 {
00096     HeapFree(GetProcessHeap(),
00097              0,
00098              This);
00099 }
00100 
00101 
00102 static inline IDsObjectPickerImpl *impl_from_IDsObjectPicker(IDsObjectPicker *iface)
00103 {
00104     return CONTAINING_RECORD(iface, IDsObjectPickerImpl, IDsObjectPicker_iface);
00105 }
00106 
00107 /**********************************************************************
00108  * OBJSEL_IDsObjectPicker_AddRef (also IUnknown)
00109  */
00110 static ULONG WINAPI OBJSEL_IDsObjectPicker_AddRef(IDsObjectPicker * iface)
00111 {
00112     IDsObjectPickerImpl *This = impl_from_IDsObjectPicker(iface);
00113     ULONG ref;
00114 
00115     TRACE("\n");
00116 
00117     if (This == NULL) return E_POINTER;
00118 
00119     ref = InterlockedIncrement(&This->ref);
00120 
00121     if (ref == 1)
00122     {
00123         InterlockedIncrement(&dll_refs);
00124     }
00125 
00126     return ref;
00127 }
00128 
00129 
00130 /**********************************************************************
00131  * OBJSEL_IDsObjectPicker_Release (also IUnknown)
00132  */
00133 static ULONG WINAPI OBJSEL_IDsObjectPicker_Release(IDsObjectPicker * iface)
00134 {
00135     IDsObjectPickerImpl *This = impl_from_IDsObjectPicker(iface);
00136     ULONG ref;
00137 
00138     TRACE("\n");
00139 
00140     if (This == NULL) return E_POINTER;
00141 
00142     ref = InterlockedDecrement(&This->ref);
00143 
00144     if (ref == 0)
00145     {
00146         InterlockedDecrement(&dll_refs);
00147         OBJSEL_IDsObjectPicker_Destroy(This);
00148     }
00149 
00150     return ref;
00151 }
00152 
00153 
00154 /**********************************************************************
00155  * OBJSEL_IDsObjectPicker_QueryInterface (also IUnknown)
00156  */
00157 static HRESULT WINAPI OBJSEL_IDsObjectPicker_QueryInterface(
00158     IDsObjectPicker * iface,
00159     REFIID riid,
00160     LPVOID *ppvObj)
00161 {
00162     TRACE("\n\tIID:\t%s\n",debugstr_guid(riid));
00163 
00164     if (ppvObj == NULL) return E_POINTER;
00165 
00166     if (IsEqualGUID(riid, &IID_IUnknown) ||
00167     IsEqualGUID(riid, &IID_IDsObjectPicker))
00168     {
00169         *ppvObj = iface;
00170     OBJSEL_IDsObjectPicker_AddRef(iface);
00171     return S_OK;
00172     }
00173 
00174     FIXME("- no interface IID: %s\n", debugstr_guid(riid));
00175     return E_NOINTERFACE;
00176 }
00177 
00178 
00179 /**********************************************************************
00180  * OBJSEL_IDsObjectPicker_Initialize
00181  */
00182 static HRESULT WINAPI OBJSEL_IDsObjectPicker_Initialize(
00183     IDsObjectPicker * iface,
00184     PDSOP_INIT_INFO pInitInfo)
00185 {
00186     FIXME("stub!\n");
00187     return S_OK;
00188 }
00189 
00190 
00191 /**********************************************************************
00192  * OBJSEL_IDsObjectPicker_InvokeDialog
00193  */
00194 static HRESULT WINAPI OBJSEL_IDsObjectPicker_InvokeDialog(
00195     IDsObjectPicker * iface,
00196     HWND hwndParent,
00197     IDataObject** ppdoSelections)
00198 {
00199     FIXME("stub!\n");
00200     return S_FALSE;
00201 }
00202 
00203 
00204 /**********************************************************************
00205  * IDsObjectPicker_Vtbl
00206  */
00207 static IDsObjectPickerVtbl IDsObjectPicker_Vtbl =
00208 {
00209     OBJSEL_IDsObjectPicker_QueryInterface,
00210     OBJSEL_IDsObjectPicker_AddRef,
00211     OBJSEL_IDsObjectPicker_Release,
00212     OBJSEL_IDsObjectPicker_Initialize,
00213     OBJSEL_IDsObjectPicker_InvokeDialog
00214 };
00215 
00216 
00217 /**********************************************************************
00218  * OBJSEL_IDsObjectPicker_Create
00219  */
00220 HRESULT WINAPI OBJSEL_IDsObjectPicker_Create(LPVOID *ppvObj)
00221 {
00222     IDsObjectPickerImpl *Instance = HeapAlloc(GetProcessHeap(),
00223                                               HEAP_ZERO_MEMORY,
00224                                               sizeof(IDsObjectPickerImpl));
00225     if (Instance != NULL)
00226     {
00227         Instance->IDsObjectPicker_iface.lpVtbl = &IDsObjectPicker_Vtbl;
00228         OBJSEL_IDsObjectPicker_AddRef(&Instance->IDsObjectPicker_iface);
00229 
00230         *ppvObj = Instance;
00231         return S_OK;
00232     }
00233     else
00234         return E_OUTOFMEMORY;
00235 }

Generated on Fri May 25 2012 04:23:39 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.