|
Hello,
I am trying to create a Windows service with the following WMI code from MSDN(except reading the credentials which I am hard coding):
Example: Getting WMI Data from a Remote Computer
- When I run this code as application, it runs fine. When I run this code as Windows service, it gives me "Access Denied" in ExecQuery().
- In ConnectServer(), when I pass NULL as username/password, as application it runs fine but in service it gives "Access Denied". Is there API or something to know the username and password used to start the service , so that I can use it in ConnectServer().
Please help.
|
|
|
|
|
hackcrackvirus wrote: I am trying to create a Windows service with the following WMI code from MSDN(except reading the credentials which I am hard coding):
Example: Getting WMI Data from a Remote Computer
- When I run this code as application, it runs fine. When I run this code as Windows service, it gives me "Access Denied" in ExecQuery().
Hi,
Yes the Microsoft sample may return 0x80070005 on Windows 2003/Vista/Win7. This Help and Support article addresses the issue:
WMI Sample in MSDN to remotely target a machine results in an 0x80070005 - Access Denied errorr[^]
Best Wishes,
-David Delaune
|
|
|
|
|
- In ConnectServer(), when I pass NULL as username/password, as application it runs fine(i.e. uses login credentials) but in service it gives "Access Denied".
Please help.
|
|
|
|
|
Maybe simple but ..
Using VC Studio 2003.
MFC cstring related to formating a UINT64 in hex .
CString cstrFormat;
WORD wRow,wCol;
UINT64 n64Address = 0x100000000;
char * pcFmt;
cstrFormat.Format (pcFmt, n64Address);
pCtrl->SetItemText( wRow, wCol, (LPCTSTR) cstrFormat);
Result of CstrFormat is 0 , upper bytes are truncated to a 32 bit result in cstring
So I know I can use printf ... but their must be a way to get the format to work.
|
|
|
|
|
something like this?
cstrFormat.Format("%I64", *n64Address);
|
|
|
|
|
Thanks,
You sent me down the right path.
cstrFormat.Format("%I64d", *n64Address); works
|
|
|
|
|
Hi,
I am using VC7. and make thumbnails of images when we call Bitmap::FromFile(L"C:\\Test.bmp") and return value store in Bitmap pointer. It return 0x0000000 address and we get error code 8. I have included gdiplus.h header file and GdiPlus.lib file.
But it is working well with other downloaded sample program
|
|
|
|
|
need to check your code. can you post code snippet here
|
|
|
|
|
I have fully checked and also only call that funcyion
but problem still
|
|
|
|
|
Do u have the "GdiplusStartup"?
|
|
|
|
|
Hi,
I am using VC7. and make thumbnails of images when we call Bitmap::FromFile(L"C:\\Test.bmp") and return value store in Bitmap pointer. It return 0x0000000 address and we get error code 8. I have included gdiplus.h header file and GdiPlus.lib file.
But it is working well with other downloaded sample program
ghy
|
|
|
|
|
Hi,
I am using VC7. and make thumbnails of images when we call Bitmap::FromFile(L"C:\\Test.bmp") and return value store in Bitmap pointer. It return 0x0000000 address and we get error code 8. I have included gdiplus.h header file and GdiPlus.lib file.
But it is working well with other downloaded sample program.
ghy
|
|
|
|
|
HI,
How can i change the width of Crect variable..
ie CRect rect;
need to change the width of rect...
|
|
|
|
|
InflateRect (n,0);
or, it's only four members...
rc.left -= 3;
rc.right += 3;
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
HI Guys iam converting a CString to LPSTR iam getting only first charcter what can any body suggest me how to get complete string I tried the folowing i did n't get it
CString str=_T("Hello");
LPSTR ptr=str.GetBuffer(0);
iam getting only first character into ptr and tried other also its not working
LPSTR ptr=str.GetBuffer(str.GetLength());
|
|
|
|
|
Please, read the documentation about the GetBuffer to understand why you should never call this function without knowing what it does.
Furthermore, CString provides a cast operator that returns the same type as the GetBuffer function.
And how are you checking that you only get the first character ? Why do you need to store that into a LPSTR variable ?
|
|
|
|
|
Cedric Moonen wrote: CString provides a cast operator that returns the same type as the GetBuffer function.
CString has an LPCTSTR operator, whereas GetBuffer() returns an LPTSTR (which is not const ).
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
you need to call release buffer also
|
|
|
|
|
I bet the content of CString is Unicode, and LPSTR is a multibyte string.
Try casting to LPTSTR instead.
Even better, if you don't support Win98 and older versions, just drop this "T" stuff and always use wide strings instead.
|
|
|
|
|
Whenever I right-click on my CDockablePane, a context menu (Floating, Docking, Tabbed Document, Auto Hide, Hide) appear. How do I disable this?
|
|
|
|
|
Your in luck! I am currently working on a CDockablePane derived class. You need to overide CPane::OnShowControlBarMenu[^]
Just tested it and it works. The really wierd thing is... the MSDN says:
TRUE if the menu can be displayed; otherwise, FALSE.
But... I had to do the exact opposite! Can you confirm this in your code?
Best Wishes,
-David Delaune
|
|
|
|
|
CFieldPane is derived from CDockablePane.
BOOL CFieldPane::OnShowControlBarMenu(CPoint point)
{
return TRUE;
}
Nothing happens. The context menu still appear
|
|
|
|
|
I did this.
BOOL CFieldPane::OnShowControlBarMenu(CPoint point)
{
return FALSE;
}
.. and the context menu doesn't appear anymore. Thanks David
|
|
|
|
|
I simply overrode CDockablePane::OnContextMenu(CWnd* /*pWnd*/, CPoint /*point*/) to have the function do nothing and just return. Now when I right-click, the only context menu I see is the one from my CDialog window that I have embedded into my CDockablePane window. Before I did this, the CDockablePane context menu would pop up immediately after I selected an item from my CDialog window's context menu.
|
|
|
|
|
Hello folks, I'm encountering a problem. Doing message-passing, I'm sending/receiving buffers from various/mixed architectured machines (32 and 64 bits). I first tried to use this as a buffer skeleton :
typedef struct{
int nCount;
short nMode;
sHue sColor;
char* pTest;
char aData[10];
}sStack,*psStack;
On a 32 bits platform, if aData is grown to 12, it fits the whole struct size (12 bytes from offset 20 = 32), thus growing it to 13 push the struct's end to 36 (4 bytes alignment).
However I *NEED* the struct to be exactly the same size, whenever this code runs on a 32 bits machine or, you might have guessed it, a 64 bits one. So I tried :
#pragma pack(8)
typedef struct{
[...]. }sStack,*psStack;
#pragma pack()
Yet it just doesn't works like expected on a 32 bits build. The struct's size is still 32 bytes, whereas I expected at least 36 (pTest pointer using 8 bytes, thus aData lying at offset 24, hence growing the struct to 34 bytes, aligned to 36 bytes).
stdcall or cdecl calls should remains set to 32 or 64 bits accordingly to the native platform, that means a ((psStack)buff)->pTest instruction shouldn't need to be casted for suiting 32 or 64 bits build. I just need the pointers in struct to be casted to the size of an __int64 (with the needed 4 padding bytes) !
Any luck someone to have a hint, a trick, or just the full answer ? Thanks anyway...
Kochise
In Code we trust !
|
|
|
|