Understanding GetUserObjectSecurity function
-
Hello all, As you all probably know I am very new to programming. I am trying to understand the terminology involved with programming. So if you all do not mind, lets use the following example as I try and explain it. Please refer to the following link: http://msdn.microsoft.com/en-us/library/aa446675(VS.85).aspx[LINK] GetUserObjectSecurity is a function. Its function is a member of what? does GetUserObjectSecurity have to be included in int main() ? If not can you please explain the reasoning? If you look at the link I provided above, on the page it has a syntax block. In the syntax block, it is refering to BOOL. Now I have seen bool and BOOL and was wondering if this is included in your source code? I read that BOOL is the older version of bool? And all bool is for, is for true/false correct? I also read that bool is a type of int, meaning could you use bool main() ? Obviously I am confused on this. Also when you use bool, is it required to be typed out in your source, or is it implied by some <header> file? How do you properly use bool? I also read that bool uses one (byte), versus BOOL uses 32(bits). Why is this? When using GetUserObjectSecurity, what are the usages of the parameters? Can anyone provide an example with an explanation? Thank you all so very much for your time and effort in helping me learn C++ and to continue my academic future. V/R Rob
-
Hello all, As you all probably know I am very new to programming. I am trying to understand the terminology involved with programming. So if you all do not mind, lets use the following example as I try and explain it. Please refer to the following link: http://msdn.microsoft.com/en-us/library/aa446675(VS.85).aspx[LINK] GetUserObjectSecurity is a function. Its function is a member of what? does GetUserObjectSecurity have to be included in int main() ? If not can you please explain the reasoning? If you look at the link I provided above, on the page it has a syntax block. In the syntax block, it is refering to BOOL. Now I have seen bool and BOOL and was wondering if this is included in your source code? I read that BOOL is the older version of bool? And all bool is for, is for true/false correct? I also read that bool is a type of int, meaning could you use bool main() ? Obviously I am confused on this. Also when you use bool, is it required to be typed out in your source, or is it implied by some <header> file? How do you properly use bool? I also read that bool uses one (byte), versus BOOL uses 32(bits). Why is this? When using GetUserObjectSecurity, what are the usages of the parameters? Can anyone provide an example with an explanation? Thank you all so very much for your time and effort in helping me learn C++ and to continue my academic future. V/R Rob
rbwest86 wrote:
GetUserObjectSecurity is a function. Its function is a member of what?
I don't quite get this. If you're asking "where" is this function located, then I would say it is within a DLL named
User32.dll
, and comes with a companion lib file namedUser32.lib
(The prototype is defined inWinuser.h
, which is in turn included byWindows.h
). So when you link toUser32.lib
, you could use the function like using a function that is within your code.rbwest86 wrote:
does GetUserObjectSecurity have to be included in int main()
You don't "include" a function, you call it. You can call this function, wherever you want to, given that you've included the relevant header file and linked to the relevant library, discussed above.
rbwest86 wrote:
I read that BOOL is the older version of bool? And all bool is for, is for true/false correct?
BOOL
is actuallyint
, defined like this:typedef int BOOL;
(I'm not sure about the file, just right click and select go to definition.) Also, Google for "BOOL vs bool".rbwest86 wrote:
Is BOOL older version of bool?
No.
rbwest86 wrote:
And all bool is for, is for true/false correct?
Yes.
rbwest86 wrote:
I also read that bool uses one (byte), versus BOOL uses 32(bits). Why is this?
BOOL
uses 32 bits because it *is* an integer (discussed above).bool
is limited to work withtrue
andfalse
. But withBOOL
, you could use any integer. And this can come handy, if you're returningBOOL
from a function and you could: *return -1
to indicate that the function failed *return 1
to indicate that the function succeeded *return 5
to indicate that the something went wrong, but the error was handled. (A file wasn't existing, but it was created and written into) * etc.,rbwest86 wrote:
Also when you use bool, is it required to be typed out in your source, or is it implied by some
file? How do you properly use bool?