From: Daz on
Hi everyone!

I am trying to obtain the current user's SID, by using a combination of
GetUserNameEx() and LookupAccountName(), however, I keep receiving the
error:

error LNK2019: unresolved external symbol _GetUserNameExW(a)12 referenced
in function "wchar_t const * __cdecl GetCurrentUsername(void)"
(?GetCurrentUsername@@YAPB_WXZ) WGAFix.obj

I have tried looking up working examples to see where I am going wrong,
and came across an example at
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=1028&lngWId=3

When I compile this one it an empty project on it's own, I get:

error LNK2019: unresolved external symbol _GetUserNameExW(a)12 referenced
in function _main main.obj

I can find the declaration for this function, but I can't seem to find
it's implementation anywhere, as it doesn't appear to be in the header
file. What gives? Please could someone point out where I am going
wrong, as it's bound to be me.

I have tried everything I can think of, and I have run out of ideas...

Thanks in advance.

Daz

From: Igor Tandetnik on
"Daz" <cutenfuzzy(a)gmail.com> wrote in message
news:1151497291.108138.201090(a)m73g2000cwd.googlegroups.com
> error LNK2019: unresolved external symbol _GetUserNameExW(a)12

Did you follow the documentation's suggestion to "Link to Secur32.lib" ?
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


From: Daz on

Igor Tandetnik wrote:

> With sufficient thrust, pigs fly just fine. However, this is not
> necessarily a good idea. It is hard to be sure where they are going to
> land, and it could be dangerous sitting under them as they fly
> overhead. -- RFC 1925

No I haven't. I completely missed that part...

Thanks Igor! :)

From: Daz on

Igor Tandetnik wrote:

> Did you follow the documentation's suggestion to "Link to Secur32.lib" ?

Err... This is what I meant to quote. Maybe I have been staring into my
IDE for too long...

 | 
Pages: 1
Prev: fopen_s
Next: problems between versions