|
Hello;
in order to get full description of an event located in eventViewer
i used ReadEvetLog to obtain event id and source name ;
i can after read the dll which contains the message description
example for security center is xpsp2res.dll ;
1. i used load library to load the file
2. i used findRessource to find message N° 1800
the second operation fils always ;
i don't know why???
CODE
HMODULE handle;
HANDLE Res;
DWORD dwLongBuff;
char Buffer[MAX_BUFFER_SIZE];
va_list list[10];
handle=LoadLibrary("c:\\windows\\system32\\xpsp2res.dll");
if (handle==NULL) printf("failure to load"); else printf ("loading ok");
HRSRC hrsrc=FindResource(handle,"#1800",RT_MESSAGETABLE);
if (hrsrc==NULL) printf("failure to load2"); else printf ("loading ok2");
dwLongBuff=FormatMessage(FORMAT_MESSAGE_FROM_HMODULE,handle,
1036,4,Buffer,MAX_BUFFER_SIZE,list);
|
|
|
|
|
fx9200 wrote: the second operation fils always
Does FindResource or FormatMessage fail ?
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
Hi Guys,
Can anyone pls tell me how to convert char to unsigned char unstr[1000];
i am trying to do the following,
strcpy(unstr,(unsigned char *)"TESTING");
But i get an comilation error : cannot convert parameter 1 from 'unsigned char [100]' to 'char *'
Pls kindly adivse me
Thanks
Cheers )
Thank you guys.....
Tuscon.....
|
|
|
|
|
strcpy((char *)unstr,"TESTING");
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
_mbsncpy ?
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
|
|
|
|
|
You can also use memcpy instead of strcpy .
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
hi all i want to implement windows hooks in service.i had implemented the hooks at the standard application(as DLL) it works fine.but the problem is that it did not worked for the service. i mean callback function is not called when service executed.
tell me what i do. any help is welcomed.
Tasleem Arif
|
|
|
|
|
Nt services are running in a difrent window station and desktop called -Service0x0-3e7$\default . All our applications are under Winsta0\default . So there may not be any applications running with an associated window object to invoke the hooked WindoProc.
Try by changing the service type to SERVICE_INTERACTIVE_PROCESS so that the service will run under Winsta0\default desktop.
cheers...Milton KB
|
|
|
|
|
i think u did not understand my question.
i had implemented hooks as dll and used in desktop application and it works fine.when i use the same dll from service then it did not work i mean setwidows hooks is called and the callback function in response to hook is not called.
and my service is controlled by the SCM and present in services list in the controll panel->admntool->services.
how to do that in i mean changing service type.
-- modified at 6:05 Wednesday 16th August, 2006
Tasleem Arif
|
|
|
|
|
I had understood what exactly u meant. Ur windows hook is not working in a service app while it works fine in a desktop application. This is what I understood before and now as well. The answer is same as before.
Hope you are aware of the fact that the Desktop window is the parent window of all other windows we create using Createwindow() API. Actually this desktop what we are seeing is just one among a number of other desktops which Windows OS keeps invisible(some of them are visible as well. eg: logon desktop). This is a mystery to most of us. Actually there is something called a window station and a window station can have n number of desktops in it. A window station is a secure kernel object that contains a clipboard, a private atom table, a set of desktops, and a set of windows.
see the info http://www.pluralsight.com/wiki/default.aspx/Keith.GuideBook/WhatIsAWindowStation.html[^]
All our applications (including your desktop application what you were talking about) are running under a desktop called Winsta0\default .
But NT Services are running in a different window station and desktop called Service0x0-3e7$\default .
Your hook will not get invoked as there are no windows in the service desktop. So try by changing the service type to SERVICE_INTERACTIVE_PROCESS so that the service will run under Winsta0\default desktop and you will start getting the notifications in the windows hook.
cheers Milton KB
|
|
|
|
|
thanks for such a descriptive answer, how can i change the service type to SERVICE_INTERFACTIVE_PROCESS only change the create service paramter to this or had to call different api calls for that purpose.
one thing Thank U very Much Again.
Tasleem Arif
|
|
|
|
|
Yes u can use SERVICE_INTERFACTIVE_PROCESS in ur CreateService call.
cheers..Milton KB
|
|
|
|
|
|
Hi! Sir,
You know that we can disable USB Enhanced Host Controller by hand.That is,
right click my computer,select property,select hardware,click Device Manager,
click General Serial Bus Controller,right click USB Enhanced Host Controller,
select Disable,so,we disabled this device.
Now my question is: how to disable USB Enhanced Host Controller by VC code?
Couse i wanna my usb device run under usb1.1 but not usb2.0,so i have to disable
USB Enhanced Host Controller in my vc code before attach my usb device to pc.
Thanks for any help!
All the blesses we enjoy are the fruits of labor,toil,study and self-denail.
|
|
|
|
|
Hi!
While executing a code ported from VC6 to VC8, I an getting unhandled exception. When I debugged my code I found that LoadFrame() is causing a probelm saying::
First-chance exception at 0x104817fd (msvcp80d.dll) in KPVault.exe: 0xC0000005: Access violation writing location 0x0000424b.<br />
Unhandled exception at 0x104817fd (msvcp80d.dll) in KPVault.exe: 0xC0000005: Access violation writing location 0x0000424b.
I am calling LoadFrame as
CMainFrame* pFrame = new CMainFrame;<br />
pFrame->LoadFrame(IDR_MAINFRAME,<br />
WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL,<br />
NULL);
I checked all my resources named as IDR_MAINFRAME. Those are a String, Menu, Acceralator, Icon and a Toolbar.
VC6 build for the same code runs just fine. Then What is causing this problem??
Thx.
|
|
|
|
|
Hi,
I'm getting the following linker error while building a project on x64| Debug. There is no problem while build on XP|Debug.The definition of HtmlHelp is found in windowsddk folder in XP. Is there anything I need to do in terams of finding the corresponding definition on x64. In case I do need to where I can get the definition.
<classname>.obj : error LNK2019: unresolved external symbol HtmlHelpA referenced in function "public: int __cdecl <classname>::LinkToHTMLHelp(unsigned long)" (?LinkToHTMLHelp@CTapas@@QEAAHK@Z)
1>Debug/hpqtap08.dll : fatal error LNK1120: 1 unresolved externals
Thanks
|
|
|
|
|
You get this because the function is not defined for 64bit, probably the prototype is surrounded by #ifdef WINxx or something like that. Find where the 64b version is located, and include it.
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
The prototype of the function is defined as below in the file htmlhelp.h under winxpsdk/include (SDK code) path.
HWND WINAPI HtmlHelp(
HWND hwndCaller,
LPCSTR pszFile,
UINT uCommand,
DWORD_PTR dwData
);
I dont have the cpp file with me and have no idea which extra lib if any is to be included for the x64 platform to execute the build.
Thanks
Ashutosh
|
|
|
|
|
The prototype of the function is defined as below in the file htmlhelp.h under winxpsdk/include (SDK code) path.
HWND WINAPI HtmlHelp(
HWND hwndCaller,
LPCSTR pszFile,
UINT uCommand,
DWORD_PTR dwData
);
I dont have the cpp file with me and have no idea which extra lib if any is to be included for the x64 platform to execute the build.
Thanks
Ashutosh
|
|
|
|
|
how can i load from my database data to my CListCtrl fast ?because now i must wait up to 10 min to load the data !
i now (WM_TIMER and virtual list that is not a solution for me because i have all the code rady ! must be something ...
this is the code :
the FillList4 is loaded in my oninit dialog !
void CMyList::FillList4()
{
CNote *pNote = new CNote();
pNote->Open();
CString sNrInregistrare;
if (pNote->GetRecordCount())
pNote->MoveFirst();
int x = 0;
while(!pNote->IsEOF())
{
int nItem = m_list4.InsertItem(x, pNote->m_name);
m_list4.SetItemText(nItem, 1, pNote->m_city);
pNote->MoveNext();
x++;
}
pNote->Close();
}
! Remember that : i have 4 CListCtrl to load with data 1 table have ~1000 and ~1500 data
Please help me because i don t have any ideea at all !
Thanks !!!!!
Bravoone
|
|
|
|
|
It looks really weird. What is the hardware configuration of the machine where it took 10 minutes to load this 1000 or 1500 records?
Comment out the data access code and insert the same number of hard coded strings in a loop into the ListCtrls. Check what the time for this is. If it takes less time, then we can confirm that the issue is with db access, may be indexing is missing.
Try this and see what the result is.
cheers..Milton KB
|
|
|
|
|
the computer ...hm... is p4 2,6Ghz , 1Gb memory ,nVidia Gforce 5500 128 M
the computer is not the problem !
Because i need this program to work to p2 233 Mhz ,64 M !
On both computers it takes ~10 min to load the data on my lists ( i have 6 tables - 1 table have ~1000 - 1500 maybe 3000 records ) and all will be loaded ! its a kill ! i don t have any ideea how can i do ...
i remind you must work with my code !
Please help me!!!!!!!!!!!!!1
Bravoone
|
|
|
|
|
the index its coll ,the database works fine (visualfoxpro db ((DBC))
Bravoone
|
|
|
|
|
It looks ur hardware is more than enough and it should not take that much time. So issue is in ur CNote. its better u change that code with ADO or try whatever google link kakan mentioned.
cheers..Milton KB
|
|
|
|
|
The problem might be in your class CNote. What does it look like?
|
|
|
|