Click here to Skip to main content
15,886,199 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Function overloading Pin
Stephen Hewitt8-Jul-07 14:54
Stephen Hewitt8-Jul-07 14:54 
Questionenglish word for base-4 number Pin
includeh107-Jul-07 5:06
includeh107-Jul-07 5:06 
AnswerRe: english word for base-4 number [modified] Pin
Tony Hill7-Jul-07 5:29
mveTony Hill7-Jul-07 5:29 
AnswerRe: english word for base-4 number Pin
Vivi Chellappa7-Jul-07 10:40
professionalVivi Chellappa7-Jul-07 10:40 
GeneralRe: english word for base-4 number Pin
Mark Salsbery7-Jul-07 11:08
Mark Salsbery7-Jul-07 11:08 
GeneralRe: english word for base-4 number Pin
Vivi Chellappa7-Jul-07 16:47
professionalVivi Chellappa7-Jul-07 16:47 
AnswerRe: english word for base-4 number Pin
pagen_hd7-Jul-07 20:52
pagen_hd7-Jul-07 20:52 
QuestionCant get SACL Pin
Akin Ocal7-Jul-07 4:27
Akin Ocal7-Jul-07 4:27 
I cant get SACL of an existing file on my system with this code.

GetNamedSecurityInfo returns 0 (ERROR_SUCCESS) , which means
there is no error in execution of it but pSACL still becomes 0x00000000
and IsValidAcl(pSACL) returns FALSE .



#include <windows.h>
#include <aclapi.h>

unsigned long enable_privilege(const char *priv)
{
HANDLE token = INVALID_HANDLE_VALUE;
u status = OpenProcessToken(
GetCurrentProcess(),
TOKEN_ADJUST_PRIVILEGES,
&token
);
if( !status )
{
return GetLastError();
}

unsigned char buf[sizeof(TOKEN_PRIVILEGES) + sizeof(LUID_AND_ATTRIBUTES)];
TOKEN_PRIVILEGES *privs = (TOKEN_PRIVILEGES*)buf;

status = LookupPrivilegeValue(
NULL,
priv,
&privs->Privileges->Luid
);
if( !status )
{
u err = GetLastError();
CloseHandle(token);
return err;
}

privs->PrivilegeCount = 1;
privs->Privileges->Attributes = SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges(
token,
FALSE, // do not disable all
privs,
0, // zero buffer for prev state
NULL, // prev state don't care
NULL // no sink for returned prev state size
);

status = GetLastError();

CloseHandle(token);

return status;
}


int _tmain(int argc, _TCHAR* argv[])
{
PACL pSACL = NULL;
PSECURITY_DESCRIPTOR pSD = NULL;

unsigned long returnValue ;

enable_privilege(SE_SECURITY_NAME );

returnValue = GetNamedSecurityInfo(
"D:\\aa.txt", // object name
SE_FILE_OBJECT, // object type
SACL_SECURITY_INFORMATION, // information type
NULL, // owner SID
NULL, // primary group SID
NULL, // DACL
&pSACL, // SACL

&pSD); // SD

if(!IsValidAcl(pSACL))
printf("FAILED , ERROR CODE : %d\n\n",returnValue);

LocalFree(pSD);

return 0 ;
}
QuestionCompiler, Linker and Assembler in Visual C++ 2005 Pin
SolidusSnake7-Jul-07 3:28
SolidusSnake7-Jul-07 3:28 
AnswerRe: Compiler, Linker and Assembler in Visual C++ 2005 Pin
Mike Dimmick7-Jul-07 4:04
Mike Dimmick7-Jul-07 4:04 
GeneralRe: Compiler, Linker and Assembler in Visual C++ 2005 Pin
SolidusSnake9-Jul-07 3:14
SolidusSnake9-Jul-07 3:14 
AnswerRe: Compiler, Linker and Assembler in Visual C++ 2005 Pin
Matthew Faithfull7-Jul-07 4:14
Matthew Faithfull7-Jul-07 4:14 
GeneralRe: Compiler, Linker and Assembler in Visual C++ 2005 Pin
SolidusSnake9-Jul-07 3:05
SolidusSnake9-Jul-07 3:05 
AnswerRe: Compiler, Linker and Assembler in Visual C++ 2005 Pin
Randor 7-Jul-07 5:03
professional Randor 7-Jul-07 5:03 
GeneralRe: Compiler, Linker and Assembler in Visual C++ 2005 Pin
SolidusSnake9-Jul-07 3:08
SolidusSnake9-Jul-07 3:08 
QuestionHow system updates input languages for processes created before input language changes ? Pin
vilius_m7-Jul-07 2:53
vilius_m7-Jul-07 2:53 
AnswerRe: How system updates input languages for processes created before input language changes ? Pin
Mike Dimmick7-Jul-07 4:09
Mike Dimmick7-Jul-07 4:09 
GeneralRe: How system updates input languages for processes created before input language changes ? Pin
vilius_m7-Jul-07 7:16
vilius_m7-Jul-07 7:16 
QuestionFormView scrolling problem Pin
Md. Ali Naser Khan7-Jul-07 2:48
Md. Ali Naser Khan7-Jul-07 2:48 
AnswerRe: FormView scrolling problem Pin
Mark Salsbery7-Jul-07 6:43
Mark Salsbery7-Jul-07 6:43 
Questionenable ctr+c and ctr+v shortkeys in edit box Pin
samira forooghi7-Jul-07 1:33
samira forooghi7-Jul-07 1:33 
AnswerRe: enable ctr+c and ctr+v shortkeys in edit box Pin
Hans Dietrich7-Jul-07 2:50
mentorHans Dietrich7-Jul-07 2:50 
GeneralRe: enable ctr+c and ctr+v shortkeys in edit box Pin
samira forooghi7-Jul-07 23:24
samira forooghi7-Jul-07 23:24 
Questionsingle selection in list control Pin
samira forooghi7-Jul-07 1:14
samira forooghi7-Jul-07 1:14 
AnswerRe: single selection in list control Pin
Hans Dietrich7-Jul-07 1:27
mentorHans Dietrich7-Jul-07 1:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.