Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VC++
to unlock the drive g:, for convenience, using a bat file unlock.bat
The bat file content is: manage-bde -unlock g: -rp 326000-202006-900200-039038-535898-009303-683253-581356
This line work manually, after double-click the .bat file under windows 7, the drive g: will be unlocked normally.
 
for more convenient, attempting to run it automatically through calling the EXE file, using CreateProcess to realize, as follows:
 
/////////////C/C++ code

SECURITY_ATTRIBUTES sa;  
HANDLE hRead,hWrite;  
 
sa.nLength = sizeof(SECURITY_ATTRIBUTES);  
sa.lpSecurityDescriptor = NULL;  
sa.bInheritHandle = TRUE;  
if (!CreatePipe(&hRead,&hWrite,&sa,0))   
{  
return FALSE;  
}   
 
STARTUPINFO si;  
PROCESS_INFORMATION pi;   
si.cb = sizeof(STARTUPINFO);  
GetStartupInfo(&si);   
si.hStdError = hWrite;  
si.hStdOutput = hWrite;  
si.wShowWindow = SW_SHOW;  
si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;  
 
if(!CreateProcess(NULL, EXECDOSCMD ,NULL,NULL,TRUE,NULL,NULL,NULL,&si,&pi))   
{
AfxMessageBox("false");
return FALSE;
}  
CloseHandle(hWrite);  
 
char buffer[4096] = {0};  
DWORD bytesRead;   
while (true)   
{  
if (ReadFile(hRead,buffer,4095,&bytesRead,NULL) == NULL)  
break;  
AfxMessageBox(buffer);  
Sleep(200);   
}
return TRUE; 
The results are
****************************************
 
C:\>manage-bde.exe -unlock g: -rp
 
326000-202006-900200-039038-535898-009303-683253-581356
 
'manage-bde.exe'is not recognized as an internal or external command, operable pregram
 
Or batch file.
 
****************************************
If the contents of the bat file to Ping www.139.com
 
Result
****************************************
 
Being Ping 163.xdwscache.glb0.lxdns.com [121.14.228.43] has 32 bytes of data:
 
From 121.14.228.43: =32 =11ms TTL=55 byte time
 
From 121.14.228.43: =32 =11ms TTL=55 byte time
 
From 121.14.228.43: =32 =10ms TTL=55 byte time
 
From 121.14.228.43: =32 =11ms TTL=55 byte time
 
121.14.228.43 Ping statistics:
 
Packet: sent = 4, received = 4, loss = 0 (0% lost),
 
The estimation of round trip time (in milliseconds):
 
The shortest = 10ms, the longest average = = 11ms, 10ms
 
****************************************
One might argue that when system boot, it can directly run .bat file, because I want to save the password in a different place, not in .bat file, so I want to use the EXE to solve. There may also be one will say, directly calls the manage-bde.exe will also unlock the drive, but I have tried for a long time, later abandoned. directly calling the .bat file, is a relatively simple approach I think.
 
Maybe the problem is not a simple VC problem!!
 
who knows how to use manage-bde that can practise my trying, Thank you.
Posted 31-Aug-12 17:13pm
vfe2003415
Edited 31-Aug-12 18:57pm
(no name)498.5K
v2
Comments
Richard MacCutchan at 1-Sep-12 3:33am
   
The message is fairly clear, the system cannot find the manage-bde.exe program in the directories specified by the PATH variable. Make sure you provide the full path to the program.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web01 | 2.8.1411022.1 | Last Updated 31 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100