|
GetLogicalDrives() enumerates all mounted disk partitions, not physical drives.
You can enumerate the drive letters with (or without) GetLogicalDrives, then call QueryDosDevice() to find out which physical drive the letter is mapped to.
Alternatively, you can decode the information in the registry at HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices
stackoverflow answer.
|
|
|
|
|
Have you considered DeviceIoControl(IOCTL_DISK_GET_PARTITION_INFO) ?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Hi all,
CoInitialize(NULL);
hres = CoInitializeSecurity(
NULL,
-1,
NULL,
NULL,
RPC_C_AUTHN_LEVEL_DEFAULT,
RPC_C_IMP_LEVEL_IMPERSONATE,
NULL,
EOAC_NONE,
NULL
);
if (FAILED(hres))
{
CString str=_T("");
str.Format(_T("Failed to initialize security. Error code = %0x"),hres);
}
here coinitializesecurity failed with error code 800706ba.
please help how can i resolve this why this error comes
thanks...
|
|
|
|
|
First to know is the error message for that code. 0x8007xxxx codes are just the same as 'normal' Windows error codes (the highest bit is the error bit and 7 is the Win32 facility). So passing 0x6BA to ::FormatMessage() gives us the error message:
The RPC server is unavailable.
Now you can use Google to find solutions. The first result is Troubleshooting "The RPC server is unavailable"[^]
|
|
|
|
|
Did you check to see what that error code means? It suggests that some service required for this call is not available. Check the documentation[^] for further details.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
please help me to solve this...
|
|
|
|
|
Solve what? I have no idea what is happening in your system except that a system call gives you an error code. You need to do some diagnosis (and probably some Google searching) to discover why this happens. Have you checked that all the parameters are correct on your call to CoInitializeSecurity() ?
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
When user click the item of the CListCtrl, I create a CTreeCtrl dynamicly to let use the data,
but the CTreeCtrl is disabled, I do not know why.
Is there anyone know why it is.
modified 15-Jan-13 10:31am.
|
|
|
|
|
yu-jian wrote: but the CTreeCtrl is disabled, I do not know why. Is there anyone know why it is. Without seeing some of your code we cannot even begin to guess what may be happening.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Sorry
CPoint point;
GetCursorPos(&point);
this->ScreenToClient(&point);
CRect rect;
rect.top = point.y;
rect.left = point.x;
rect.right = rect.left + 200;
rect.bottom = rect.top + 300;
CComboBox* pComboBox = new CComboBox();
pComboBox->Create(WS_VISIBLE, rect, this, NULL);
pComboBox->ShowWindow(SW_SHOW);
CDeviceInfoArray arrDeviceInfo;
...
for(int i = 0; i < arrDeviceInfo.GetCount(); ++i)
{
CString strDevice;
strDevice.Format("%d", arrDeviceInfo[i]);
pComboBox->AddString(strDevice);
}
|
|
|
|
|
Is your CTreeCtrl being disguised as a CComboBox ?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Firstly, I use the CTreeCtrl, but failed, then I use the CComboBox, but also failed, too.
I thought that it's the same problem.
|
|
|
|
|
I don't know what this has to do with a tree control, but your Create() call is missing some windows styles (specifically WS_CHILD ), and your control does not have an id. See the documentation[^] for more details.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
At least show us the code you use to create the Tree Control
|
|
|
|
|
please show your CTreeListCtrl creation code. without seeing code how we can predict issue? 
|
|
|
|
|
Hi All.
I need to your help in blow questions..
I have to use internet over GPRS modem in windows xp and windows 7, so i have created a dial-up connection using Rasdial API
But i get some problems.
that is, when i creat Ras entry by RasSetEntryProperties api, the entry come up with the default maximum speed of 115200 (but i must use other baud rate, for example, 7200000) .
I can edit this manually in the modem settings, but dose anyone know the API's i can use to set it in code?
I don't want to modify registry about modem.
I have looked through the MDSN, but RasSetEntryProperties function dosen't do it, and it says, lpbDeviceInfo param is unused in Windows XP.
Are there any other solutions except modify registry before making ras entry?
Sorry for my bad english.
Regards.
|
|
|
|
|
This looked easy but it wasn't
I want to
1/ Test if I have rights to delete a file
2/ lock it
3/ read it
4/ delete it
This is all in one process
Gave up on 1/ but tried to use CreateFile to lock it and found xerces-c was not able to access the file for reading in the same process.
Any pointers (no pun intended). Not .net just C++/Win32
Thanks
Iain
|
|
|
|
|
Iain Wiseman wrote: and found xerces-c was not able to access the file for reading in the same process. You really need to explain that in technical terms, i.e. what code you used and what errors you received. I'm not sure about item 1, but 2,3 and 4 are quite straightforward in Windows.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
I want to disable other processing from locking the file.
When I use CreateFile, this works except it also prevents Xerces from reading the file so the code looks a little like this
m_Handle = CreateFile(
TEXT(inFullyQualifiedPath.c_str()),
GENERIC_ALL,
0,
NULL,
OPEN_EXISTING,
NULL,
NULL);
m_ConfigFileParser = new xercesc::XercesDOMParser;
m_ConfigFileParser->parse(m_Filename.c_str());
The reading of the file fails because Xerces cannot open the file.
|
|
|
|
|
Solved by using
GENERIC_READ and FILE_SHARE_READ | FILE_SHARE_WRITE
|
|
|
|
|
Iain Wiseman wrote: FILE_SHARE_READ | FILE_SHARE_WRITE You do understand that those options allow other processes to read and write the file at the same time.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
If this isn't correct then is there something that is?
It seemed to work when I ran a separate process with the same code and put a pause in it.
I totally sure you are right. If you do know the right combination I would be grateful. It seemed such a simple thing to want to do.
Iain
|
|
|
|
|
Sorry, I'm not sure exactly what your problem is. You said it works now, I was just pointing out that those options mean you do not have exclusive access to the file.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
I am simply after in one process being able to prevent someone else opening a file whilst I am reading it. I do not have control over the opening of the file as this is done within the Xerces library. The file is an xml file hence the use of xerces. Once I have completed the read I want to sometimes delete the file.
Ideally I would have like to in my process
Check I have exclusive rights to the file
Read it using xerces
Delete it
|
|
|
|
|
A Simple work around to your problem would be use your original code to get the exclusive access to file,
Read the file and create a temporary file which you can pass it to Xerces.. later delete the temp file.. and if you want delete even the source/original file.
Other alternatives could be to check if xerces takes text(some temp buffer) as input instead of file name.. so you can read the file in buffer and pass it to xerces.
|
|
|
|