locked
couldn't build project RRS feed

  • Question

  • hi all

    Microsoft visual studio 2005

    windows vista

    here is my programm

    i get it from http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ietechcol/dnwebgen/protectedmode.asp

     

    #include <sddl.h>

    #include <AccCtrl.h>

    #include <Aclapi.h>

     

    void SetLowLabelToFile()

    {

    // The LABEL_SECURITY_INFORMATION SDDL SACL to be set for low integrity

    #define LOW_INTEGRITY_SDDL_SACL_W L"SSadML;;NW;;;LW)"

    DWORD dwErr = ERROR_SUCCESS;

    PSECURITY_DESCRIPTOR pSD = NULL;

    PACL pSacl = NULL; // not allocated

    BOOL fSaclPresent = FALSE;

    BOOL fSaclDefaulted = FALSE;

    LPCWSTR pwszFileName = L"Sample.txt";

    if (ConvertStringSecurityDescriptorToSecurityDescriptorW(

    LOW_INTEGRITY_SDDL_SACL_W, SDDL_REVISION_1, &pSD, NULL))

    {

    if (GetSecurityDescriptorSacl(pSD, &fSaclPresent, &pSacl,

    &fSaclDefaulted))

    {

    // Note that psidOwner, psidGroup, and pDacl are

    // all NULL and set the new LABEL_SECURITY_INFORMATION

    dwErr = SetNamedSecurityInfoW((LPWSTR) pwszFileName,

    SE_FILE_OBJECT, LABEL_SECURITY_INFORMATION,

    NULL, NULL, NULL, pSacl);

    }

    LocalFree(pSD);

    }

    }

     

    when i try to build

    Visual studio writes

     

    ------ Build started: Project: vista3, Configuration: Debug Win32 ------

    Compiling...

    vista3.cpp

    c:\users\.apm9h\documents\visual studio 2005\projects\vista3\vista3\vista3.cpp(23) : error C3861: 'ConvertStringSecurityDescriptorToSecurityDescriptorW': identifier not found

    c:\users\.apm9h\documents\visual studio 2005\projects\vista3\vista3\vista3.cpp(32) : error C2065: 'LABEL_SECURITY_INFORMATION' : undeclared identifier

    Build log was saved at "file://c:\Users\.APM9H\Documents\Visual Studio 2005\Projects\vista3\vista3\Debug\BuildLog.htm"

    vista3 - 2 error(s), 0 warning(s)

    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

     

    i have 2 questions

     

    1. why 'ConvertStringSecurityDescriptorToSecurityDescriptorW': identifier not found and what could i do,

    2. what must i write instead of 'LABEL_SECURITY_INFORMATION'

    thx all.

     

    Saturday, May 12, 2007 4:31 PM

All replies

  • 1. ConvertStringSecurityDescriptorToSecurityDescriptor is only defined if _WIN32_WINNT >= 0x0500.  Make sure you define _WIN32_WINNT to be at least 0x0500.

    2. LABEL_SECURITY_INFORMATION is a new flag that was added to the newer MS Windows SDK for Vista.  I'm guessing you're not building with the newer SDK.
    Thursday, May 17, 2007 3:38 PM
  •  waishan wrote:
    1. ConvertStringSecurityDescriptorToSecurityDescriptor is only defined if _WIN32_WINNT >= 0x0500.  Make sure you define _WIN32_WINNT to be at least 0x0500.

    2. LABEL_SECURITY_INFORMATION is a new flag that was added to the newer MS Windows SDK for Vista.  I'm guessing you're not building with the newer SDK.

     

    i need to use new functions that was added in vista.

    what should i do to  make this file build sucsessful/

    ps i'm working in vista ultimate x64 in visual studio prof 2005

    Friday, May 18, 2007 12:37 PM
  • If you want to use the newer functions then you need to install the newer SDK.  You can find it here.
    http://www.microsoft.com/downloads/details.aspx?familyid=C2B1E300-F358-4523-B479-F53D234CDCCF
    Tuesday, May 22, 2007 4:31 PM