The MASM Forum Archive 2004 to 2012

Project Support Forums => MASM32 => WINDOWS.INC Project => Topic started by: remus2k on January 02, 2011, 11:51:56 PM

Title: Bug In Windows.inc?
Post by: remus2k on January 02, 2011, 11:51:56 PM
Hi

I playing a little with DebugPrivilege

Now use i from windows.inc

SE_DEBUG_NAME equ ("SeDebugPrivilege")

A2084: constant value too large
A2114: INVOKE argument type mismatch : argument : 2

I look by msdn and he say:
A constant was specified that was too big for the context in which it was used.


By msdn is Declare

SE_DEBUG_NAME TEXT("SeDebugPrivilege")

This Works Only if you  add the CTEXT Macro in the WIndows.inc
SE_DEBUG_NAME equ CTEXT ("SeDebugPrivilege")

Or add this in your code after the CTEXT Macro

Then if the Windows.inc buggy with all this privileges?

Title: Re: Bug In Windows.inc?
Post by: dedndave on January 03, 2011, 12:00:10 AM
how are you trying to use it ?

EDIT - it looks to me as though it should be a TEXTEQU - i dunno
the reference i find is for delphi - and it's translated from Chinese by google  :lol

http://translate.google.com/translate?js=n&prev=_t&hl=en&ie=UTF-8&layout=2&eotf=1&sl=auto&tl=en&u=http%3A%2F%2Fwww.swissdelphicenter.ch%2Ftorry%2Fshowcode.php%3Fid%3D1177&act=url





Title: Re: Bug In Windows.inc?
Post by: remus2k on January 03, 2011, 12:02:40 AM
invoke LookupPrivilegeValue,0,SE_DEBUG_NAME,ADDR tpNew.Privileges[0].Luid

A other way is

.data
_SE_DEBUG_NAME db "SeDebugPrivilege",0
.code
invoke LookupPrivilegeValue,0,addr _SE_DEBUG_NAME,ADDR tpNew.Privileges[0].Luid
Title: Re: Bug In Windows.inc?
Post by: Gunner on January 03, 2011, 12:09:18 AM
Quote from: remus2k on January 03, 2011, 12:02:40 AM
A other way is

.data
_SE_DEBUG_NAME db "SeDebugPrivilege",0
.code
invoke LookupPrivilegeValue,0,addr _SE_DEBUG_NAME,ADDR tpNew.Privileges[0].Luid


This way is correct, lpName  is a pointer to a null terminated string
Title: Re: Bug In Windows.inc?
Post by: dedndave on January 03, 2011, 12:12:00 AM
yah - it needs to be a pointer to a null-terminated string
i don't think the EQU is gonna get it
Title: Re: Bug In Windows.inc?
Post by: jj2007 on January 03, 2011, 12:16:52 AM
What's wrong with invoke LookupPrivilegeValue, 0, chr$("SeDebugPrivilege"), ADDR tpNew.Privileges[0].Luid ??
Title: Re: Bug In Windows.inc?
Post by: remus2k on January 03, 2011, 12:25:47 AM
It if not Wrong at this code

What's wrong with invoke LookupPrivilegeValue, 0, chr$("SeDebugPrivilege"), ADDR tpNew.Privileges[0].Luid


I mean only that this not works from the windows.inc
SE_DEBUG_NAME equ ("SeDebugPrivilege")


I look in the sdk under NT Defined Privileges and you can see it use a TEXT Macro :U

#define SE_DEBUG_NAME TEXT("SeDebugPrivilege")

Title: Re: Bug In Windows.inc?
Post by: dedndave on January 03, 2011, 12:27:14 AM
SE_DEBUG_NAME TEXTEQU <"SeDebugPrivilege">


invoke LookupPrivilegeValue, 0, chr$(SE_DEBUG_NAME), ADDR tpNew.Privileges[0].Luid

:P

the same string could be used for a number of other EQUates, so DB might be best