Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygendrvdefext.cpp
Go to the documentation of this file.
00001 /* 00002 * Provides default drive shell extension 00003 * 00004 * Copyright 2005 Johannes Anderwald 00005 * Copyright 2012 Rafal Harabien 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with this library; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00020 */ 00021 00022 #define _USE_MATH_DEFINES 00023 #include <precomp.h> 00024 #include <math.h> 00025 00026 WINE_DEFAULT_DEBUG_CHANNEL(shell); 00027 00028 static const GUID GUID_DEVCLASS_DISKDRIVE = {0x4d36e967L, 0xe325, 0x11ce, {0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18}}; 00029 00030 typedef enum 00031 { 00032 HWPD_STANDARDLIST = 0, 00033 HWPD_LARGELIST, 00034 HWPD_MAX = HWPD_LARGELIST 00035 } HWPAGE_DISPLAYMODE, *PHWPAGE_DISPLAYMODE; 00036 00037 EXTERN_C HWND WINAPI 00038 DeviceCreateHardwarePageEx(HWND hWndParent, 00039 LPGUID lpGuids, 00040 UINT uNumberOfGuids, 00041 HWPAGE_DISPLAYMODE DisplayMode); 00042 UINT SH_FormatByteSize(LONGLONG cbSize, LPWSTR pwszResult, UINT cchResultMax); 00043 00044 static VOID 00045 GetDriveNameWithLetter(LPWSTR pwszText, UINT cchTextMax, LPCWSTR pwszDrive) 00046 { 00047 DWORD dwMaxComp, dwFileSys; 00048 SIZE_T cchText = 0; 00049 00050 if (GetVolumeInformationW(pwszDrive, pwszText, cchTextMax, NULL, &dwMaxComp, &dwFileSys, NULL, 0)) 00051 { 00052 cchText = wcslen(pwszText); 00053 if (cchText == 0) 00054 { 00055 /* load default volume label */ 00056 cchText = LoadStringW(shell32_hInstance, IDS_DRIVE_FIXED, pwszText, cchTextMax); 00057 } 00058 } 00059 00060 StringCchPrintfW(pwszText + cchText, cchTextMax - cchText, L" (%c)", pwszDrive[0]); 00061 } 00062 00063 static VOID 00064 InitializeChkDskDialog(HWND hwndDlg, LPCWSTR pwszDrive) 00065 { 00066 WCHAR wszText[100]; 00067 UINT Length; 00068 SetWindowLongPtr(hwndDlg, DWLP_USER, (INT_PTR)pwszDrive); 00069 00070 Length = GetWindowTextW(hwndDlg, wszText, sizeof(wszText) / sizeof(WCHAR)); 00071 wszText[Length] = L' '; 00072 GetDriveNameWithLetter(&wszText[Length + 1], (sizeof(wszText) / sizeof(WCHAR)) - Length - 1, pwszDrive); 00073 SetWindowText(hwndDlg, wszText); 00074 } 00075 00076 static HWND hChkdskDrvDialog = NULL; 00077 static BOOLEAN bChkdskSuccess = FALSE; 00078 00079 static BOOLEAN NTAPI 00080 ChkdskCallback( 00081 IN CALLBACKCOMMAND Command, 00082 IN ULONG SubAction, 00083 IN PVOID ActionInfo) 00084 { 00085 PDWORD Progress; 00086 PBOOLEAN pSuccess; 00087 switch(Command) 00088 { 00089 case PROGRESS: 00090 Progress = (PDWORD)ActionInfo; 00091 SendDlgItemMessageW(hChkdskDrvDialog, 14002, PBM_SETPOS, (WPARAM)*Progress, 0); 00092 break; 00093 case DONE: 00094 pSuccess = (PBOOLEAN)ActionInfo; 00095 bChkdskSuccess = (*pSuccess); 00096 break; 00097 00098 case VOLUMEINUSE: 00099 case INSUFFICIENTRIGHTS: 00100 case FSNOTSUPPORTED: 00101 case CLUSTERSIZETOOSMALL: 00102 bChkdskSuccess = FALSE; 00103 FIXME("\n"); 00104 break; 00105 00106 default: 00107 break; 00108 } 00109 00110 return TRUE; 00111 } 00112 00113 static VOID 00114 ChkDskNow(HWND hwndDlg, LPCWSTR pwszDrive) 00115 { 00116 //DWORD ClusterSize = 0; 00117 WCHAR wszFs[30]; 00118 ULARGE_INTEGER TotalNumberOfFreeBytes, FreeBytesAvailableUser; 00119 BOOLEAN bCorrectErrors = FALSE, bScanDrive = FALSE; 00120 00121 if(!GetVolumeInformationW(pwszDrive, NULL, 0, NULL, NULL, NULL, wszFs, _countof(wszFs))) 00122 { 00123 FIXME("failed to get drive fs type\n"); 00124 return; 00125 } 00126 00127 if (!GetDiskFreeSpaceExW(pwszDrive, &FreeBytesAvailableUser, &TotalNumberOfFreeBytes, NULL)) 00128 { 00129 FIXME("failed to get drive space type\n"); 00130 return; 00131 } 00132 00133 /*if (!GetDefaultClusterSize(wszFs, &ClusterSize, &TotalNumberOfFreeBytes)) 00134 { 00135 FIXME("invalid cluster size\n"); 00136 return; 00137 }*/ 00138 00139 if (SendDlgItemMessageW(hwndDlg, 14000, BM_GETCHECK, 0, 0) == BST_CHECKED) 00140 bCorrectErrors = TRUE; 00141 00142 if (SendDlgItemMessageW(hwndDlg, 14001, BM_GETCHECK, 0, 0) == BST_CHECKED) 00143 bScanDrive = TRUE; 00144 00145 hChkdskDrvDialog = hwndDlg; 00146 bChkdskSuccess = FALSE; 00147 SendDlgItemMessageW(hwndDlg, 14002, PBM_SETRANGE, 0, MAKELPARAM(0, 100)); 00148 Chkdsk((LPWSTR)pwszDrive, (LPWSTR)wszFs, bCorrectErrors, TRUE, FALSE, bScanDrive, NULL, NULL, ChkdskCallback); // FIXME: casts 00149 00150 hChkdskDrvDialog = NULL; 00151 bChkdskSuccess = FALSE; 00152 } 00153 00154 static INT_PTR CALLBACK 00155 ChkDskDlg( 00156 HWND hwndDlg, 00157 UINT uMsg, 00158 WPARAM wParam, 00159 LPARAM lParam) 00160 { 00161 switch(uMsg) 00162 { 00163 case WM_INITDIALOG: 00164 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)lParam); 00165 InitializeChkDskDialog(hwndDlg, (LPCWSTR)lParam); 00166 return TRUE; 00167 case WM_COMMAND: 00168 switch(LOWORD(wParam)) 00169 { 00170 case IDCANCEL: 00171 EndDialog(hwndDlg, 0); 00172 break; 00173 case IDOK: 00174 { 00175 LPCWSTR pwszDrive = (LPCWSTR)GetWindowLongPtr(hwndDlg, DWLP_USER); 00176 ChkDskNow(hwndDlg, pwszDrive); 00177 break; 00178 } 00179 } 00180 break; 00181 } 00182 00183 return FALSE; 00184 } 00185 00186 VOID 00187 CDrvDefExt::PaintStaticControls(HWND hwndDlg, LPDRAWITEMSTRUCT pDrawItem) 00188 { 00189 HBRUSH hBrush; 00190 00191 if (pDrawItem->CtlID == 14013) 00192 { 00193 hBrush = CreateSolidBrush(RGB(0, 0, 255)); 00194 if (hBrush) 00195 { 00196 FillRect(pDrawItem->hDC, &pDrawItem->rcItem, hBrush); 00197 DeleteObject((HGDIOBJ)hBrush); 00198 } 00199 } 00200 else if (pDrawItem->CtlID == 14014) 00201 { 00202 hBrush = CreateSolidBrush(RGB(255, 0, 255)); 00203 if (hBrush) 00204 { 00205 FillRect(pDrawItem->hDC, &pDrawItem->rcItem, hBrush); 00206 DeleteObject((HGDIOBJ)hBrush); 00207 } 00208 } 00209 else if (pDrawItem->CtlID == 14015) 00210 { 00211 HBRUSH hBlueBrush = CreateSolidBrush(RGB(0, 0, 255)); 00212 HBRUSH hMagBrush = CreateSolidBrush(RGB(255, 0, 255)); 00213 HPEN hDarkBluePen = CreatePen(PS_SOLID, 1, RGB(0, 0, 128)); 00214 HPEN hDarkMagPen = CreatePen(PS_SOLID, 1, RGB(128, 0, 128)); 00215 00216 INT xCenter = (pDrawItem->rcItem.left + pDrawItem->rcItem.right)/2; 00217 INT yCenter = (pDrawItem->rcItem.top + pDrawItem->rcItem.bottom - 10)/2; 00218 INT cx = pDrawItem->rcItem.right - pDrawItem->rcItem.left; 00219 INT cy = pDrawItem->rcItem.bottom - pDrawItem->rcItem.top - 10; 00220 TRACE("FreeSpace %u a %f cx %d\n", m_FreeSpacePerc, M_PI+m_FreeSpacePerc/100.0f*M_PI*2.0f, cx); 00221 00222 HBRUSH hbrOld = (HBRUSH)SelectObject(pDrawItem->hDC, hMagBrush); 00223 INT xRadial = xCenter + (INT)(cos(M_PI+m_FreeSpacePerc/100.0f*M_PI*2.0f)*cx/2); 00224 INT yRadial = yCenter - (INT)(sin(M_PI+m_FreeSpacePerc/100.0f*M_PI*2.0f)*cy/2); 00225 Pie(pDrawItem->hDC, 00226 pDrawItem->rcItem.left, pDrawItem->rcItem.top, 00227 pDrawItem->rcItem.right, pDrawItem->rcItem.bottom - 10, 00228 pDrawItem->rcItem.left, yCenter, 00229 xRadial, yRadial); 00230 00231 SelectObject(pDrawItem->hDC, hBlueBrush); 00232 Pie(pDrawItem->hDC, 00233 pDrawItem->rcItem.left, pDrawItem->rcItem.top, 00234 pDrawItem->rcItem.right, pDrawItem->rcItem.bottom - 10, 00235 xRadial, yRadial, 00236 pDrawItem->rcItem.left, yCenter); 00237 SelectObject(pDrawItem->hDC, hbrOld); 00238 00239 HPEN hOldPen = (HPEN)SelectObject(pDrawItem->hDC, hDarkBluePen); 00240 for (INT x = pDrawItem->rcItem.left; x < pDrawItem->rcItem.right; ++x) 00241 { 00242 if (m_FreeSpacePerc < 50 && x == xRadial) 00243 SelectObject(pDrawItem->hDC, hDarkMagPen); 00244 00245 double cos_val = (x - xCenter)*2.0f/cx; 00246 INT y = yCenter+(INT)(sin(acos(cos_val))*cy/2); 00247 MoveToEx(pDrawItem->hDC, x, y, NULL); 00248 LineTo(pDrawItem->hDC, x, y + 10); 00249 } 00250 SelectObject(pDrawItem->hDC, hOldPen); 00251 00252 DeleteObject(hBlueBrush); 00253 DeleteObject(hMagBrush); 00254 DeleteObject(hDarkBluePen); 00255 DeleteObject(hDarkMagPen); 00256 } 00257 } 00258 00259 VOID 00260 CDrvDefExt::InitGeneralPage(HWND hwndDlg) 00261 { 00262 WCHAR wszVolumeName[MAX_PATH+1] = {0}; 00263 WCHAR wszFileSystem[MAX_PATH+1] = {0}; 00264 WCHAR wszBuf[128]; 00265 BOOL bRet; 00266 00267 bRet = GetVolumeInformationW(m_wszDrive, wszVolumeName, _countof(wszVolumeName), NULL, NULL, NULL, wszFileSystem, _countof(wszFileSystem)); 00268 if (bRet) 00269 { 00270 /* Set volume label and filesystem */ 00271 SetDlgItemTextW(hwndDlg, 14000, wszVolumeName); 00272 SetDlgItemTextW(hwndDlg, 14002, wszFileSystem); 00273 } 00274 00275 /* Set drive type and icon */ 00276 UINT DriveType = GetDriveTypeW(m_wszDrive); 00277 UINT IconId, TypeStrId = 0; 00278 switch (DriveType) 00279 { 00280 case DRIVE_CDROM: IconId = IDI_SHELL_CDROM; TypeStrId = IDS_DRIVE_CDROM; break; 00281 case DRIVE_REMOVABLE: IconId = IDI_SHELL_FLOPPY; break; 00282 case DRIVE_RAMDISK: IconId = IDI_SHELL_RAMDISK; break; 00283 default: IconId = IDI_SHELL_DRIVE; TypeStrId = IDS_DRIVE_FIXED; 00284 } 00285 HICON hIcon = (HICON)LoadImage(shell32_hInstance, MAKEINTRESOURCE(IconId), IMAGE_ICON, 32, 32, LR_SHARED); 00286 if (hIcon) 00287 SendDlgItemMessageW(hwndDlg, 14016, STM_SETICON, (WPARAM)hIcon, 0); 00288 if (TypeStrId && LoadStringW(shell32_hInstance, TypeStrId, wszBuf, _countof(wszBuf))) 00289 SetDlgItemTextW(hwndDlg, 14001, wszBuf); 00290 00291 ULARGE_INTEGER FreeBytesAvailable, TotalNumberOfBytes; 00292 if(GetDiskFreeSpaceExW(m_wszDrive, &FreeBytesAvailable, &TotalNumberOfBytes, NULL)) 00293 { 00294 /* Init free space percentage used for drawing piechart */ 00295 m_FreeSpacePerc = (UINT)(FreeBytesAvailable.QuadPart * 100ull / TotalNumberOfBytes.QuadPart); 00296 00297 /* Used space */ 00298 if (SH_FormatByteSize(TotalNumberOfBytes.QuadPart - FreeBytesAvailable.QuadPart, wszBuf, _countof(wszBuf))) 00299 SetDlgItemTextW(hwndDlg, 14003, wszBuf); 00300 00301 if (StrFormatByteSizeW(TotalNumberOfBytes.QuadPart - FreeBytesAvailable.QuadPart, wszBuf, _countof(wszBuf))) 00302 SetDlgItemTextW(hwndDlg, 14004, wszBuf); 00303 00304 /* Free space */ 00305 if (SH_FormatByteSize(FreeBytesAvailable.QuadPart, wszBuf, _countof(wszBuf))) 00306 SetDlgItemTextW(hwndDlg, 14005, wszBuf); 00307 00308 if (StrFormatByteSizeW(FreeBytesAvailable.QuadPart, wszBuf, _countof(wszBuf))) 00309 SetDlgItemTextW(hwndDlg, 14006, wszBuf); 00310 00311 /* Total space */ 00312 if (SH_FormatByteSize(FreeBytesAvailable.QuadPart, wszBuf, _countof(wszBuf))) 00313 SetDlgItemTextW(hwndDlg, 14007, wszBuf); 00314 00315 if (StrFormatByteSizeW(TotalNumberOfBytes.QuadPart, wszBuf, _countof(wszBuf))) 00316 SetDlgItemTextW(hwndDlg, 14008, wszBuf); 00317 } 00318 00319 /* Set drive description */ 00320 WCHAR wszFormat[50]; 00321 GetDlgItemTextW(hwndDlg, 14009, wszFormat, _countof(wszFormat)); 00322 swprintf(wszBuf, wszFormat, m_wszDrive[0]); 00323 SetDlgItemTextW(hwndDlg, 14009, wszBuf); 00324 } 00325 00326 INT_PTR CALLBACK 00327 CDrvDefExt::GeneralPageProc( 00328 HWND hwndDlg, 00329 UINT uMsg, 00330 WPARAM wParam, 00331 LPARAM lParam) 00332 { 00333 switch(uMsg) 00334 { 00335 case WM_INITDIALOG: 00336 { 00337 LPPROPSHEETPAGEW ppsp = (LPPROPSHEETPAGEW)lParam; 00338 if (ppsp == NULL) 00339 break; 00340 00341 CDrvDefExt *pDrvDefExt = (CDrvDefExt*)ppsp->lParam; 00342 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pDrvDefExt); 00343 pDrvDefExt->InitGeneralPage(hwndDlg); 00344 return TRUE; 00345 } 00346 case WM_DRAWITEM: 00347 { 00348 LPDRAWITEMSTRUCT pDrawItem = (LPDRAWITEMSTRUCT)lParam; 00349 00350 if (pDrawItem->CtlID >= 14013 && pDrawItem->CtlID <= 14015) 00351 { 00352 CDrvDefExt *pDrvDefExt = (CDrvDefExt*)GetWindowLongPtr(hwndDlg, DWLP_USER); 00353 pDrvDefExt->PaintStaticControls(hwndDlg, pDrawItem); 00354 return TRUE; 00355 } 00356 break; 00357 } 00358 case WM_PAINT: 00359 break; 00360 case WM_COMMAND: 00361 if (LOWORD(wParam) == 14010) /* Disk Cleanup */ 00362 { 00363 CDrvDefExt *pDrvDefExt = (CDrvDefExt*)GetWindowLongPtr(hwndDlg, DWLP_USER); 00364 WCHAR wszBuf[256]; 00365 DWORD cbBuf = sizeof(wszBuf); 00366 00367 if (RegGetValueW(HKEY_LOCAL_MACHINE, 00368 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MyComputer\\CleanupPath", 00369 NULL, 00370 RRF_RT_REG_SZ, 00371 NULL, 00372 (PVOID)wszBuf, 00373 &cbBuf) == ERROR_SUCCESS) 00374 { 00375 WCHAR wszCmd[MAX_PATH]; 00376 00377 StringCbPrintfW(wszCmd, sizeof(wszCmd), wszBuf, pDrvDefExt->m_wszDrive[0]); 00378 00379 if (ShellExecuteW(hwndDlg, NULL, wszCmd, NULL, NULL, SW_SHOW) <= (HINSTANCE)32) 00380 ERR("Failed to create cleanup process %ls\n", wszCmd); 00381 } 00382 } 00383 else if (LOWORD(wParam) == 14000) /* Label */ 00384 { 00385 if (HIWORD(wParam) == EN_CHANGE) 00386 PropSheet_Changed(GetParent(hwndDlg), hwndDlg); 00387 } 00388 break; 00389 case WM_NOTIFY: 00390 if (((LPNMHDR)lParam)->hwndFrom == GetParent(hwndDlg)) 00391 { 00392 /* Property Sheet */ 00393 LPPSHNOTIFY lppsn = (LPPSHNOTIFY)lParam; 00394 00395 if (lppsn->hdr.code == PSN_APPLY) 00396 { 00397 CDrvDefExt *pDrvDefExt = (CDrvDefExt*)GetWindowLongPtr(hwndDlg, DWLP_USER); 00398 WCHAR wszBuf[256]; 00399 00400 if (GetDlgItemTextW(hwndDlg, 14000, wszBuf, _countof(wszBuf))) 00401 SetVolumeLabelW(pDrvDefExt->m_wszDrive, wszBuf); 00402 SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, PSNRET_NOERROR); 00403 return TRUE; 00404 } 00405 } 00406 break; 00407 00408 default: 00409 break; 00410 } 00411 00412 return FALSE; 00413 } 00414 00415 INT_PTR CALLBACK 00416 CDrvDefExt::ExtraPageProc( 00417 HWND hwndDlg, 00418 UINT uMsg, 00419 WPARAM wParam, 00420 LPARAM lParam) 00421 { 00422 switch (uMsg) 00423 { 00424 case WM_INITDIALOG: 00425 { 00426 LPPROPSHEETPAGEW ppsp = (LPPROPSHEETPAGEW)lParam; 00427 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)ppsp->lParam); 00428 return TRUE; 00429 } 00430 case WM_COMMAND: 00431 { 00432 WCHAR wszBuf[MAX_PATH]; 00433 DWORD cbBuf = sizeof(wszBuf); 00434 CDrvDefExt *pDrvDefExt = (CDrvDefExt*)GetWindowLongPtr(hwndDlg, DWLP_USER); 00435 00436 switch(LOWORD(wParam)) 00437 { 00438 case 14000: 00439 DialogBoxParamW(shell32_hInstance, MAKEINTRESOURCEW(IDD_CHECK_DISK), hwndDlg, ChkDskDlg, (LPARAM)pDrvDefExt->m_wszDrive); 00440 break; 00441 case 14001: 00442 if (RegGetValueW(HKEY_LOCAL_MACHINE, 00443 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MyComputer\\DefragPath", 00444 NULL, 00445 RRF_RT_REG_SZ, 00446 NULL, 00447 (PVOID)wszBuf, 00448 &cbBuf) == ERROR_SUCCESS) 00449 { 00450 WCHAR wszCmd[MAX_PATH]; 00451 00452 StringCbPrintfW(wszCmd, sizeof(wszCmd), wszBuf, pDrvDefExt->m_wszDrive[0]); 00453 00454 if (ShellExecuteW(hwndDlg, NULL, wszCmd, NULL, NULL, SW_SHOW) <= (HINSTANCE)32) 00455 ERR("Failed to create defrag process %ls\n", wszCmd); 00456 } 00457 break; 00458 case 14002: 00459 if (RegGetValueW(HKEY_LOCAL_MACHINE, 00460 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MyComputer\\BackupPath", 00461 NULL, 00462 RRF_RT_REG_EXPAND_SZ, 00463 NULL, 00464 (PVOID)wszBuf, 00465 &cbBuf) == ERROR_SUCCESS) 00466 { 00467 if (ShellExecuteW(hwndDlg, NULL, wszBuf, NULL, NULL, SW_SHOW) <= (HINSTANCE)32) 00468 ERR("Failed to create backup process %ls\n", wszBuf); 00469 } 00470 } 00471 break; 00472 } 00473 } 00474 return FALSE; 00475 } 00476 00477 INT_PTR CALLBACK 00478 CDrvDefExt::HardwarePageProc( 00479 HWND hwndDlg, 00480 UINT uMsg, 00481 WPARAM wParam, 00482 LPARAM lParam) 00483 { 00484 UNREFERENCED_PARAMETER(lParam); 00485 UNREFERENCED_PARAMETER(wParam); 00486 00487 switch(uMsg) 00488 { 00489 case WM_INITDIALOG: 00490 { 00491 GUID Guid = GUID_DEVCLASS_DISKDRIVE; 00492 00493 /* create the hardware page */ 00494 DeviceCreateHardwarePageEx(hwndDlg, &Guid, 1, HWPD_STANDARDLIST); 00495 break; 00496 } 00497 } 00498 00499 return FALSE; 00500 } 00501 00502 CDrvDefExt::CDrvDefExt() 00503 { 00504 m_wszDrive[0] = L'\0'; 00505 } 00506 00507 CDrvDefExt::~CDrvDefExt() 00508 { 00509 00510 } 00511 00512 HRESULT WINAPI 00513 CDrvDefExt::Initialize(LPCITEMIDLIST pidlFolder, IDataObject *pDataObj, HKEY hkeyProgID) 00514 { 00515 FORMATETC format; 00516 STGMEDIUM stgm; 00517 HRESULT hr; 00518 00519 TRACE("%p %p %p %p\n", this, pidlFolder, pDataObj, hkeyProgID); 00520 00521 if (!pDataObj) 00522 return E_FAIL; 00523 00524 format.cfFormat = CF_HDROP; 00525 format.ptd = NULL; 00526 format.dwAspect = DVASPECT_CONTENT; 00527 format.lindex = -1; 00528 format.tymed = TYMED_HGLOBAL; 00529 00530 hr = pDataObj->GetData(&format, &stgm); 00531 if (FAILED(hr)) 00532 return hr; 00533 00534 if (!DragQueryFileW((HDROP)stgm.hGlobal, 0, m_wszDrive, _countof(m_wszDrive))) 00535 { 00536 ERR("DragQueryFileW failed\n"); 00537 ReleaseStgMedium(&stgm); 00538 return E_FAIL; 00539 } 00540 00541 ReleaseStgMedium(&stgm); 00542 TRACE("Drive properties %ls\n", m_wszDrive); 00543 00544 return S_OK; 00545 } 00546 00547 HRESULT WINAPI 00548 CDrvDefExt::QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) 00549 { 00550 UNIMPLEMENTED; 00551 return E_NOTIMPL; 00552 } 00553 00554 HRESULT WINAPI 00555 CDrvDefExt::InvokeCommand(LPCMINVOKECOMMANDINFO lpici) 00556 { 00557 UNIMPLEMENTED; 00558 return E_NOTIMPL; 00559 } 00560 00561 HRESULT WINAPI 00562 CDrvDefExt::GetCommandString(UINT_PTR idCmd, UINT uType, UINT *pwReserved, LPSTR pszName, UINT cchMax) 00563 { 00564 UNIMPLEMENTED; 00565 return E_NOTIMPL; 00566 } 00567 00568 HRESULT WINAPI 00569 CDrvDefExt::AddPages(LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam) 00570 { 00571 HPROPSHEETPAGE hPage; 00572 00573 hPage = SH_CreatePropertySheetPage(IDD_DRIVE_PROPERTIES, 00574 GeneralPageProc, 00575 (LPARAM)this, 00576 NULL); 00577 if (hPage) 00578 pfnAddPage(hPage, lParam); 00579 00580 if (GetDriveTypeW(m_wszDrive) == DRIVE_FIXED) 00581 { 00582 hPage = SH_CreatePropertySheetPage(IDD_DRIVE_TOOLS, 00583 ExtraPageProc, 00584 (LPARAM)this, 00585 NULL); 00586 if (hPage) 00587 pfnAddPage(hPage, lParam); 00588 } 00589 00590 hPage = SH_CreatePropertySheetPage(IDD_DRIVE_HARDWARE, 00591 HardwarePageProc, 00592 (LPARAM)this, 00593 NULL); 00594 if (hPage) 00595 pfnAddPage(hPage, lParam); 00596 00597 return S_OK; 00598 } 00599 00600 HRESULT WINAPI 00601 CDrvDefExt::ReplacePage(UINT uPageID, LPFNADDPROPSHEETPAGE pfnReplacePage, LPARAM lParam) 00602 { 00603 UNIMPLEMENTED; 00604 return E_NOTIMPL; 00605 } 00606 00607 HRESULT WINAPI 00608 CDrvDefExt::SetSite(IUnknown *punk) 00609 { 00610 UNIMPLEMENTED; 00611 return E_NOTIMPL; 00612 } 00613 00614 HRESULT WINAPI 00615 CDrvDefExt::GetSite(REFIID iid, void **ppvSite) 00616 { 00617 UNIMPLEMENTED; 00618 return E_NOTIMPL; 00619 } Generated on Sat May 26 2012 04:24:54 for ReactOS by
1.7.6.1
|