#include "stdafx.h"
#include "windows.h"
#include "aclapi.h"
#include "accctrl.h"
#include "sddl.h"
//MARAZM
WINADVAPI
BOOL
WINAPI
ConvertSecurityDescriptorToStringSecurityDescriptorA(
IN PSECURITY_DESCRIPTOR SecurityDescriptor,
IN DWORD RequestedStringSDRevision,
IN SECURITY_INFORMATION SecurityInformation,
OUT LPSTR *StringSecurityDescriptor OPTIONAL,
OUT PULONG StringSecurityDescriptorLen OPTIONAL
);
WINADVAPI
BOOL
WINAPI
ConvertSecurityDescriptorToStringSecurityDescriptorW(
IN PSECURITY_DESCRIPTOR SecurityDescriptor,
IN DWORD RequestedStringSDRevision,
IN SECURITY_INFORMATION SecurityInformation,
OUT LPWSTR *StringSecurityDescriptor OPTIONAL,
OUT PULONG StringSecurityDescriptorLen OPTIONAL
);
#ifdef UNICODE
#define ConvertSecurityDescriptorToStringSecurityDescriptor ConvertSecurityDescriptorToStringSecurityDescriptorW
#else
#define ConvertSecurityDescriptorToStringSecurityDescriptor ConvertSecurityDescriptorToStringSecurityDescriptorA
#endif // !UNICODE
//End of MARAZM
int main(int argc, char* argv[])
{
DWORD dwRes = 0;
PACL pOldDACL = NULL, pNewDACL = NULL;
PSECURITY_DESCRIPTOR pSD = NULL;
LPTSTR stringDescriptor;
ULONG SDDLen;
dwRes = GetNamedSecurityInfo("c:\\windows\\", SE_FILE_OBJECT,
DACL_SECURITY_INFORMATION,
NULL, NULL, &pOldDACL, NULL, &pSD);
if (ERROR_SUCCESS != dwRes) {
printf( "GetNamedSecurityInfo Error %u\n", dwRes );}
if(ConvertSecurityDescriptorToStringSecurityDescriptor(
pSD,
SDDL_REVISION,
OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|DACL_SECURITY_INFORMATION,
&stringDescriptor,
&SDDLen
))printf( "If 'this message !visible' then 'go take gun and shoot yourself!!!'" );
return 0;
}
Sddl.h млин...
Код:
Руки походу кривые стали... постоянно пишет:
error LNK2001: unresolved external symbol "__declspec(dllimport) int __stdcall ConvertSecurityDescriptorToStringSecurityDescriptorA(void *,unsigned long,unsigned long,char * *,unsigned long *)" (__imp_?ConvertSecurityDescriptorToString
SecurityDescriptorA@@YGHPAXKKPAPADPAK@Z)
Памагите....ПЛЗ... :o пишу extern "C", не помогает... :(
Да advapi32.lib дописано в линкере, и advapi32.dll присутствует...
Код:
#include "stdafx.h"
#include <windows.h>
#include <aclapi.h>
#include <accctrl.h>
#define _WIN32_WINNT 0x5100
#include <sddl.h>
int main(int argc, char* argv[])
{
DWORD dwRes = 0;
PACL pOldDACL = NULL, pNewDACL = NULL;
PSECURITY_DESCRIPTOR pSD = NULL;
LPTSTR stringDescriptor;
ULONG SDDLen;
dwRes = GetNamedSecurityInfo("c:\\windows\\", SE_FILE_OBJECT,
DACL_SECURITY_INFORMATION,
NULL, NULL, &pOldDACL, NULL, &pSD);
if (ERROR_SUCCESS != dwRes) {
printf( "GetNamedSecurityInfo Error %u\n", dwRes );}
if(ConvertSecurityDescriptorToStringSecurityDescriptor(
pSD,
SDDL_REVISION,
OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|DACL_SECURITY_INFORMATION,
&stringDescriptor,
&SDDLen
))printf( "If 'this message !visible' then 'go take gun and shoot yourself!!!'" );
return 0;
}
#include <windows.h>
#include <aclapi.h>
#include <accctrl.h>
#define _WIN32_WINNT 0x5100
#include <sddl.h>
int main(int argc, char* argv[])
{
DWORD dwRes = 0;
PACL pOldDACL = NULL, pNewDACL = NULL;
PSECURITY_DESCRIPTOR pSD = NULL;
LPTSTR stringDescriptor;
ULONG SDDLen;
dwRes = GetNamedSecurityInfo("c:\\windows\\", SE_FILE_OBJECT,
DACL_SECURITY_INFORMATION,
NULL, NULL, &pOldDACL, NULL, &pSD);
if (ERROR_SUCCESS != dwRes) {
printf( "GetNamedSecurityInfo Error %u\n", dwRes );}
if(ConvertSecurityDescriptorToStringSecurityDescriptor(
pSD,
SDDL_REVISION,
OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|DACL_SECURITY_INFORMATION,
&stringDescriptor,
&SDDLen
))printf( "If 'this message !visible' then 'go take gun and shoot yourself!!!'" );
return 0;
}
Спасибо... смекнул.... /dev/hands править надо... 8) Щаз... попробую...
:_( Трабл не с WINNT похоже... под VC 6.0 напрочь отказывается работать... :_( Эх, буду искать VC 7.0... Я так понял чтобы под шестой программить с sddl нуно Platform SDK поставить, хотя... может все же /dev/hands...