|
-
October 23rd, 2001, 04:12 PM
#1
Help to get/set workgroup in Win2K/NT
Can you help me? How to get workgroup name on the Windows2000/NT by VC++ system calls? Due to the security of 2000/NT operating system, the workgroup(not domain) name was saved inside local Sam database, I want to know how to extract the data from the System..
Any help will be great appreciated...
-
October 23rd, 2006, 09:46 PM
#2
Re: Help to get/set workgroup in Win2K/NT
Hi Chris!
How to get my workgroup?
The following code get workgroup from local computer using the NetWkstaGetInfo() function.
1. Import file (Netapi32.lib).
2. include file (lm.h).
Code:
BOOL GetWorkgroup(LPTSTR pszName)
{
DWORD dwLevel = 102;
LPWKSTA_INFO_102 pBuf = NULL;
NET_API_STATUS nStatus;
LPTSTR pszServerName = NULL;
BOOL bRes=FALSE;
nStatus = NetWkstaGetInfo(NULL, dwLevel, (LPBYTE *)&pBuf);
if (nStatus == NERR_Success)
{
TCHAR szTemp[MAX_PATH]={'\0',};
int BufSize=sizeof(szTemp)/sizeof(TCHAR);
#ifdef UNICODE
_tcscpy(szTemp, pBuf->wki102_langroup);
#else
::WideCharToMultiByte(CP_ACP, 0, pBuf->wki102_langroup, -1, szTemp, BufSize, 0, 0);
#endif
lstrcpy(pszName, szTemp);
bRes=TRUE;
}
if (pBuf != NULL)
NetApiBufferFree(pBuf);
return bRes;
}
Last edited by PeejAvery; April 30th, 2008 at 01:48 PM.
Reason: Fixed code tags.
-
October 23rd, 2006, 10:22 PM
#3
Re: Help to get/set workgroup in Win2K/NT
Hi ezway. Welcome to the forums. One thing to note before posting is how old a thread is. You posted on a 5 year old thread.
Please remember to post on more recent and relevant topics.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
April 30th, 2008, 12:14 PM
#4
Re: Help to get/set workgroup in Win2K/NT
Awesome thank you, solved my problem!
-
January 16th, 2009, 02:17 AM
#5
Re: Help to get/set workgroup in Win2K/NT
I think ezway did the right thing.
-
January 16th, 2009, 03:49 AM
#6
Re: Help to get/set workgroup in Win2K/NT
 Originally Posted by BitNinja
I think ezway did the right thing.
Yeah, this is the landmark to move on
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
|