DCOMPERM.H

/*++ 

DCOM Permission Configuration Sample
Copyright (c) 1996, Microsoft Corporation. All rights reserved.

Module Name:

dcomperm.h

Abstract:

Include file for DCOM Permission Configuration sample

Author:

Michael Nelson

Environment:

Windows NT

--*/

#define GUIDSTR_MAX 38

#ifndef STR2UNI

#define STR2UNI(unistr, regstr) \
mbstowcs (unistr, regstr, strlen (regstr)+1);

#define UNI2STR(regstr, unistr) \
wcstombs (regstr, unistr, wcslen (unistr)+1);

#endif


//
// Wrappers
//

DWORD
ListDefaultAccessACL();

DWORD
ListDefaultLaunchACL();

DWORD
ListAppIDAccessACL (
LPTSTR AppID
);

DWORD
ListAppIDLaunchACL (
LPTSTR AppID
);

DWORD
ChangeDefaultAccessACL (
LPTSTR Principal,
BOOL SetPrincipal,
BOOL Permit
);

DWORD
ChangeDefaultLaunchACL (
LPTSTR Principal,
BOOL SetPrincipal,
BOOL Permit
);

DWORD
ChangeAppIDAccessACL (
LPTSTR AppID,
LPTSTR Principal,
BOOL SetPrincipal,
BOOL Permit
);

DWORD
ChangeAppIDLaunchACL (
LPTSTR AppID,
LPTSTR Principal,
BOOL SetPrincipal,
BOOL Permit
);

DWORD GetRunAsPassword (
LPTSTR AppID,
LPTSTR Password
);

DWORD SetRunAsPassword (
LPTSTR AppID,
LPTSTR Principal,
LPTSTR Password
);

DWORD GetRunAsPassword (
LPTSTR AppID,
LPTSTR Password
);

DWORD SetRunAsPassword (
LPTSTR AppID,
LPTSTR Password
);

//
// Internal functions
//

DWORD
CreateNewSD (
SECURITY_DESCRIPTOR **SD
);

DWORD
MakeSDAbsolute (
PSECURITY_DESCRIPTOR OldSD,
PSECURITY_DESCRIPTOR *NewSD
);

DWORD
SetNamedValueSD (
HKEY RootKey,
LPTSTR KeyName,
LPTSTR ValueName,
SECURITY_DESCRIPTOR *SD
);

DWORD
GetNamedValueSD (
HKEY RootKey,
LPTSTR KeyName,
LPTSTR ValueName,
SECURITY_DESCRIPTOR **SD,
BOOL *NewSD
);

DWORD
ListNamedValueSD (
HKEY RootKey,
LPTSTR KeyName,
LPTSTR ValueName
);

DWORD
AddPrincipalToNamedValueSD (
HKEY RootKey,
LPTSTR KeyName,
LPTSTR ValueName,
LPTSTR Principal,
BOOL Permit
);

DWORD
RemovePrincipalFromNamedValueSD (
HKEY RootKey,
LPTSTR KeyName,
LPTSTR ValueName,
LPTSTR Principal
);

DWORD
GetCurrentUserSID (
PSID *Sid
);

DWORD
GetPrincipalSID (
LPTSTR Principal,
PSID *Sid
);

DWORD
CopyACL (
PACL OldACL,
PACL NewACL
);

DWORD
AddAccessDeniedACEToACL (
PACL *Acl,
DWORD PermissionMask,
LPTSTR Principal
);

DWORD
AddAccessAllowedACEToACL (
PACL *Acl,
DWORD PermissionMask,
LPTSTR Principal
);

DWORD
RemovePrincipalFromACL (
PACL Acl,
LPTSTR Principal
);

void
ListACL (
PACL Acl
);

DWORD
SetAccountRights (
LPTSTR User,
LPTSTR Privilege
);

//
// Utility Functions
//

LPTSTR
SystemMessage (
LPTSTR szBuffer,
HRESULT hr
);