aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--winsup/utils/ChangeLog7
-rw-r--r--winsup/utils/mkgroup.c25
2 files changed, 28 insertions, 4 deletions
diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog
index b7a6759..ff7d660 100644
--- a/winsup/utils/ChangeLog
+++ b/winsup/utils/ChangeLog
@@ -1,3 +1,10 @@
+2002-07-01 Corinna Vinschen <corinna@vinschen.de>
+
+ * mkgroup.c: Add function pointers for functions from advapi32.dll.
+ (load_netapi): Load used functions from advapi32.dll.
+ (main): Use function pointers instead of statically linked functions
+ from advapi32.dll.
+
2002-07-01 Christopher Faylor <cgf@redhat.com>
* mount.cc (main): Ensure that mount_already_exists() also gets default
diff --git a/winsup/utils/mkgroup.c b/winsup/utils/mkgroup.c
index 5457354..666fdec 100644
--- a/winsup/utils/mkgroup.c
+++ b/winsup/utils/mkgroup.c
@@ -32,6 +32,11 @@ NET_API_STATUS WINAPI (*netlocalgroupgetmembers)(LPWSTR,LPWSTR,DWORD,PBYTE*,DWOR
NET_API_STATUS WINAPI (*netgetdcname)(LPWSTR,LPWSTR,PBYTE*);
NET_API_STATUS WINAPI (*netgroupgetusers)(LPWSTR,LPWSTR,DWORD,PBYTE*,DWORD,PDWORD,PDWORD,PDWORD);
+NTSTATUS NTAPI (*lsaclose)(LSA_HANDLE);
+NTSTATUS NTAPI (*lsaopenpolicy)(PLSA_UNICODE_STRING,PLSA_OBJECT_ATTRIBUTES,ACCESS_MASK,PLSA_HANDLE);
+NTSTATUS NTAPI (*lsaqueryinformationpolicy)(LSA_HANDLE,POLICY_INFORMATION_CLASS,PVOID*);
+NTSTATUS NTAPI (*lsafreememory)(PVOID);
+
#ifndef min
#define min(a,b) (((a)<(b))?(a):(b))
#endif
@@ -57,6 +62,18 @@ load_netapi ()
if (!(netgetdcname = (void *) GetProcAddress (h, "NetGetDCName")))
return FALSE;
+ if (!(h = LoadLibrary ("advapi32.dll")))
+ return FALSE;
+
+ if (!(lsaclose = (void *) GetProcAddress (h, "LsaClose")))
+ return FALSE;
+ if (!(lsaopenpolicy = (void *) GetProcAddress (h, "LsaOpenPolicy")))
+ return FALSE;
+ if (!(lsaqueryinformationpolicy = (void *) GetProcAddress (h, "LsaQueryInformationPolicy")))
+ return FALSE;
+ if (!(lsafreememory = (void *) GetProcAddress (h, "LsaFreeMemory")))
+ return FALSE;
+
return TRUE;
}
@@ -573,10 +590,10 @@ main (int argc, char **argv)
psid = (PSID) buf;
else
{
- ret = LsaOpenPolicy(NULL, &oa, POLICY_VIEW_LOCAL_INFORMATION, &lsa);
+ ret = lsaopenpolicy (NULL, &oa, POLICY_VIEW_LOCAL_INFORMATION, &lsa);
if (ret == STATUS_SUCCESS && lsa != INVALID_HANDLE_VALUE)
{
- ret = LsaQueryInformationPolicy (lsa,
+ ret = lsaqueryinformationpolicy (lsa,
PolicyPrimaryDomainInformation,
(PVOID *) &pdi);
if (ret == STATUS_SUCCESS)
@@ -586,9 +603,9 @@ main (int argc, char **argv)
CopySid (1024, (PSID) buf, pdi->Sid);
psid = (PSID) buf;
}
- LsaFreeMemory (pdi);
+ lsafreememory (pdi);
}
- LsaClose (lsa);
+ lsaclose (lsa);
}
}
if (!psid)