Please help: Win32_Directory ExecQuery

Below is a code snippet from an actual program I'm experimenting with. I want to make use of the Win32_Directory functions Compress and Uncompress. Right now I'm just trying to gain access to a Win32_Directory object.

Here is the problem. Whether i use ExecQuery or GetObject, I have the same outcome:
- With ExecQuery, it works fine so long as I don't use a WHERE clause--
i.e. any Win32_Directory object (which amounts to all of them) but
fails with timeout when I insert a WHERE clause as below. In
particular the query is "SELECT * FROM Win32_Directory WHERE Name =
- With GetObject, it works fine so long as I don't specify a particular
Win32_Directory object like Win32_Directory.Name="c:\mydir"

Can someone tell me what I may be doing wrong to cause this operation to time out?

Thanks in advance.

/* ****CODE SNIPPET************************************************
* ****************************************************************/
IWbemLocator* pWbemLocator = 0;
CComBSTR lNameSpace("\\localhost\root\cimv2"); // Default namespace
IWbemServices* pWbemServices = 0;


/* After successful initialization of the Locator
* and Services objects
* I do the following:
* */

BSTR bstrQuery = SysAllocString(L"SELECT * FROM Win32_Directory where Extension='txt'");

BSTR bstrQLang = SysAllocString(L"WQL");

IEnumWbemClassObject *piwco;
IWbemClassObject *pico;

hRes = pWbemServices->ExecQuery( bstrQLang, bstrQuery, WBEM_FLAG_RETURN_IMMEDIATELY | WBEM_FLAG_FORWARD_ONLY, NULL,&piwco);

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!