Changeset 722
- Timestamp:
- 12/6/2008 1:35:24 AM (4 years ago)
- Location:
- branches/eraser6/ShellExt
- Files:
-
- 2 edited
-
CtxMenu.cpp (modified) (4 diffs)
-
CtxMenu.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/ShellExt/CtxMenu.cpp
r720 r722 180 180 if (applicableActions & ACTION_ERASE) 181 181 { 182 InsertMenu (hSubmenu, ACTION_ERASE, MF_BYPOSITION, uID++, _T("&Erase")); 182 InsertMenu(hSubmenu, ACTION_ERASE, MF_BYPOSITION, uID++, 183 LoadString(IDS_ACTION_ERASE).c_str()); //Erase 183 184 VerbMenuIndices.push_back(ACTION_ERASE); 184 185 } 185 186 if (applicableActions & ACTION_ERASE_ON_RESTART) 186 187 { 187 InsertMenu (hSubmenu, ACTION_ERASE_ON_RESTART, MF_BYPOSITION, uID++, _T("Erase on &Restart")); 188 InsertMenu(hSubmenu, ACTION_ERASE_ON_RESTART, MF_BYPOSITION, uID++, 189 LoadString(IDS_ACTION_ERASERESTART).c_str()); //Erase on Restart 188 190 VerbMenuIndices.push_back(ACTION_ERASE_ON_RESTART); 189 191 } 190 192 if (applicableActions & ACTION_ERASE_UNUSED_SPACE) 191 193 { 192 InsertMenu (hSubmenu, ACTION_ERASE_UNUSED_SPACE, MF_BYPOSITION, uID++, _T("Erase &Unused Space")); 194 InsertMenu(hSubmenu, ACTION_ERASE_UNUSED_SPACE, MF_BYPOSITION, uID++, 195 LoadString(IDS_ACTION_ERASEUNUSEDSPACE).c_str()); //Erase Unused Space 193 196 VerbMenuIndices.push_back(ACTION_ERASE_UNUSED_SPACE); 194 197 } … … 202 205 } 203 206 204 InsertMenu (hSubmenu, ACTION_SECURE_MOVE, MF_BYPOSITION, uID++, _T("Secure &Move")); 207 InsertMenu(hSubmenu, ACTION_SECURE_MOVE, MF_BYPOSITION, uID++, 208 LoadString(IDS_ACTION_SECUREMOVE).c_str()); //Secure Move 205 209 VerbMenuIndices.push_back(ACTION_SECURE_MOVE); 206 210 } … … 351 355 LPSTR pszName, UINT cchMax) 352 356 { 353 USES_CONVERSION; 354 355 //Check idCmd, it must be 0 or 1 since we have two menu items. 356 if (idCmd > 2) 357 return E_INVALIDARG; 358 359 //If Explorer is asking for a help string, copy our string into the supplied buffer. 357 //We only know how to handle help string requests. 360 358 if (!(uFlags & GCS_HELPTEXT)) 361 359 return E_INVALIDARG; 362 360 363 static LPCTSTR szErase = _T("Erases the currently selected file\r\n"); 364 static LPCTSTR szEraseUnunsed = _T("Erases the currently selected drive's unused disk space\r\n"); 365 LPCTSTR pszText = (0 == idCmd) ? szErase : szEraseUnunsed; 366 361 //Get the command string for the given id 362 if (idCmd > VerbMenuIndices.size()) 363 return E_INVALIDARG; 364 365 std::wstring commandString; 366 switch (VerbMenuIndices[idCmd]) 367 { 368 case ACTION_ERASE: 369 case ACTION_ERASE_ON_RESTART: 370 case ACTION_ERASE_UNUSED_SPACE: 371 case ACTION_SECURE_MOVE: 372 373 default: 374 //We don't know what action this is: return E_INVALIDARG. 375 return E_INVALIDARG; 376 } 377 378 //Return the help string to Explorer. 367 379 if (uFlags & GCS_UNICODE) 368 //We need to cast pszName to a Unicode string, and then use the Unicode string copy API. 369 lstrcpynW((LPWSTR)pszName, T2CW(pszText), cchMax); 380 wcscpy_s(reinterpret_cast<wchar_t*>(pszName), cchMax, commandString.c_str()); 370 381 else 371 //Use the ANSI string copy API to return the help string. 372 lstrcpynA(pszName, T2CA(pszText), cchMax); 382 { 383 size_t convCount = 0; 384 wcstombs_s(&convCount, pszName, cchMax, commandString.c_str(), commandString.length()); 385 } 373 386 374 387 return S_OK; 375 388 } 376 377 /*378 usage: Eraser <action> <arguments>379 where action is380 addtask Adds tasks to the current task list.381 querymethods Lists all registered Erasure methods.382 383 global parameters:384 --quiet, -q Do not create a Console window to display progress.385 386 parameters for addtask:387 eraser addtask --method=<methodGUID> (--recycled | --unused=<volume> | --dir=<directory> | [file1 [file2 [...]]])388 --method, -m The Erasure method to use.389 --recycled, -r Erases files and folders in the recycle bin390 --unused, -u Erases unused space in the volume.391 optional arguments: --unused=<drive>[,clusterTips]392 clusterTips If specified, the drive's files will have their cluster tips393 erased.394 --dir, --directory, -d Erases files and folders in the directory395 optional arguments: --dir=<directory>[,e=excludeMask][,i=includeMask][,delete]396 excludeMask A wildcard expression for files and folders to exclude.397 includeMask A wildcard expression for files and folders to include.398 The include mask is applied before the exclude mask.399 delete Deletes the folder at the end of the erasure if specified.400 file1 ... fileN The list of files to erase.401 402 parameters for querymethods:403 eraser querymethods404 405 no parameters to set.406 407 All arguments are case sensitive.408 409 */410 389 411 390 HRESULT CCtxMenu::InvokeCommand(LPCMINVOKECOMMANDINFO pCmdInfo) … … 583 562 } 584 563 564 std::wstring CCtxMenu::LoadString(UINT stringID) 565 { 566 //Get a pointer to the buffer containing the string (we're copying it anyway) 567 wchar_t* buffer = NULL; 568 DWORD lastCount = ::LoadString(theApp.m_hInstance, stringID, 569 reinterpret_cast<wchar_t*>(&buffer), 0); 570 571 if (lastCount > 0) 572 return std::wstring(buffer, lastCount); 573 return std::wstring(); 574 } 575 585 576 std::wstring CCtxMenu::GetHKeyPath(HKEY handle) 586 577 { -
branches/eraser6/ShellExt/CtxMenu.h
r720 r722 83 83 Actions GetApplicableActions(); 84 84 85 static std::wstring LoadString(UINT stringID); 85 86 static std::wstring GetHKeyPath(HKEY handle); 86 87 static MENUITEMINFO* GetSeparator();
Note: See TracChangeset
for help on using the changeset viewer.
