|
-
May 19th, 2007, 04:31 PM
#1
Check if LPCWSTR is an atom or not?
I have a hook on the function CreateWindowExW. I tried to call wcscmp on the lpClassName parameter to see what class I am created, but when lpClassName is an atom it crashes. How can I check whether or not lpClassName is an atom or LPCWSTR?
Thanks,
inbugable
-
May 19th, 2007, 04:50 PM
#2
Re: Check if LPCWSTR is an atom or not?
From MSDN on CreateWindowEx:
lpClassName
[in] Long pointer to a null-terminated string or an integer atom. If this parameter is an atom, it must be a global atom created by a previous call to the RegisterClass function. The atom, a 16-bit value less than 0xC000, must be in the low-order word of lpClassName; the high-order word must be zero.
Maybe you can make a check to see if the lpClassName argument meets the criteria of an atom.
- petter
Last edited by wildfrog; May 19th, 2007 at 05:59 PM.
Reason: typo in red...
-
May 19th, 2007, 05:01 PM
#3
Re: Check if LPCWSTR is an atom or not?
Thanks but its not working. Could you post some sample code plz?
Thanks
-
May 19th, 2007, 05:07 PM
#4
Re: Check if LPCWSTR is an atom or not?
 Originally Posted by inbugable
Thanks but its not working.
First, please show us what did you try and it's not working.
-
May 19th, 2007, 05:11 PM
#5
Re: Check if LPCWSTR is an atom or not?
I tried:
if(HIWORD((ATOM)lpClassName) == 0){
and
if((ATOM)lpClassName < 0xC000){
-
May 19th, 2007, 05:23 PM
#6
Re: Check if LPCWSTR is an atom or not?
Wildfrogs posting is correct so....
1) What is the actual 32 bit hex value you are testing (a debugger and a breakpoint makes this trivial).
2) Why do you think the value is (or is not) an Atom. What is the code that generates the value? [please dont forget code tags - like you forgot them in your previous post !]
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions 
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
May 19th, 2007, 05:35 PM
#7
Re: Check if LPCWSTR is an atom or not?
Just to quote this
 Originally Posted by inbugable
if(HIWORD((ATOM)lpClassName) == 0)
As already said above, ATOM is a 16-bit (WORD) value so
Code:
HIWORD((ATOM)someting)
will be always 0.
-
May 19th, 2007, 05:41 PM
#8
Re: Check if LPCWSTR is an atom or not?
1) The class is 0xC038 but casted to a LPCWSTR
2) I dont know the code that generates the value because im running injected code in another process
-
May 19th, 2007, 05:45 PM
#9
Re: Check if LPCWSTR is an atom or not?
I'm sorry, the quote from MSDN was for Windows CE. I'll try again:
lpClassName
[in] Pointer to a null-terminated string or a class atom created by a previous call to the RegisterClass or RegisterClassEx function. The atom must be in the low-order word of lpClassName; the high-order word must be zero. If lpClassName is a string, it specifies the window class name. The class name can be any name registered with RegisterClass or RegisterClassEx, provided that the module that registers the class is also the module that creates the window. The class name can also be any of the predefined system class names.
What if you try this:
Code:
if (HIWORD(lpClassName) == 0)
{
// atom
} else
{
// class name
}
- petter
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|