|
No i am running in windows xp network and i am reading this key
HKEY_CURRENT_USER\\Software\\Policies\\Microsoft\\Windows\\Control Panel\\Desktop\\ScreenSaveTimeOut
This key is set through group policy by the system admin for a particular domain but i am unable to read this key in non admin rights , but in admin rights i can read this key.
Why it is soooooooooo ??
Below is my code
void GetScreenSaverTimeOutInfo()
{
try
{
HKEY hKey;
strCategory=SysAllocString(L"ScreenSaverInfo");
strItemName=SysAllocString(L"ScreenSaveTimeOut");
strInstallDate=SysAllocString(L"-NA-");
strVersion=SysAllocString(L"-NA-");
strValue1=SysAllocString(L"-NA-");
strValue2=SysAllocString(L"-NA-");
strValue3=SysAllocString(L"-NA-");
if (RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Software\\Policies\\Microsoft\\Windows\\Control Panel\\Desktop"), 0, KEY_ALL_ACCESS, &hKey)!=ERROR_SUCCESS)
{
WriteToFile(GetNewRow());
}
else
{
DWORD dwType = REG_SZ;
TCHAR buf[10] ;
DWORD dwBufSize = 10;
if( RegQueryValueEx(hKey,TEXT("ScreenSaveTimeOut"),0, &dwType, (LPBYTE)&buf, &dwBufSize) == ERROR_SUCCESS)
{
strValue1=SysAllocString(buf);
WriteToFile(GetNewRow());
SysFreeString(strValue1);
SysFreeString(buf);
}
else
{
WriteToFile(GetNewRow());
}
RegCloseKey(hKey);
}
SysFreeString(strCategory);
SysFreeString(strItemName);
SysFreeString(strInstallDate);
SysFreeString(strVersion);
SysFreeString(strValue1);
SysFreeString(strValue2);
SysFreeString(strValue3);
}
catch(char *error)
{
error="Error occurred in function GetScreenSaverSecureInfo()";
throw error;
}
}
|
|
|
|
|
It's because that key is protected from user access - registry keys can have permissions and ACLs just like files can. You can see and manipulate those using regedit.
The group policy stuff does a lot of this sort of thing - you'll find even if you change the values under the key, they'll get reset again when you next login.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
is there any way i can read this key ??????????
|
|
|
|
|
Member 6392036 wrote: is there any way i can read this key ???
Of course, open it with KEY_QUERY_VALUE or KEY_READ access rights instead of KEY_ALL_ACCESS .
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
It's amazing to see how people cannot take care of little things like that. They just throw anything at it and expect it to work. Not to mention they'll blame UAC then.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Rajesh R Subramanian wrote: Not to mention they'll blame UAC then.
I've been blaming UAC[^] for basically everything the latest 15 or so years.
I can assure you that my first encounter wasn't really friendly.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Rajesh R Subramanian wrote: It's amazing to see how people cannot take care of little things like that
which little things you are talking please elaborate it.
|
|
|
|
|
Little things like using KEY_QUERY_VALUE instead of KEY_ALL_ACCESS when applicable.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
I think registry write access will be only available to privileged users. If you want your application to read/write settings under any account then perhaps you should make use of app configuration file to keep track of settings.
|
|
|
|
|
Hello everyone:
Disk format is NTFS.How can I get file record like using DeviceIoControl function with the control code FSCTL_GET_NTFS_FILE_RECORD to retrieve the file record?
Any information is appreciated,thanks in advance.
|
|
|
|
|
can u please clear your question.
|
|
|
|
|
See my reply to chandu004.
|
|
|
|
|
do you mean to say,
you need to pass FSCTL_GET_NTFS_FILE_RECORD to DeviceIoControl to get a record in file?
if so, i remember, there are some in and out parameters in DeviceIOControl,
so you can retrieve the record from a file in your despatch handler code and then pass the structure out to the user layer.
but still, some clarity is required on your post.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
sorry,I mean that how to get file record from file name easily.I haven't have a good idea so far.
|
|
|
|
|
please explain your problem in detail.
it is very vague.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
I mean if I only know the file name,how can I get the file record?The record structure is below:
typedef struct { LARGE_INTEGER FileReferenceNumber; DWORD FileRecordLength; BYTE FileRecordBuffer[1];
} NTFS_FILE_RECORD_OUTPUT_BUFFER, *PNTFS_FILE_RECORD_OUTPUT_BUFFER;
This structure can be obtained by DeviceIoControl function.Now I only have the file name,so I can't use this function.I need another method to get this struct information.
|
|
|
|
|
do you still want to use device io control for this or do you want any other way?
for example, you can use the following code to retrieve a structure from a file.
NTFS_FILE_RECORD_OUTPUT_BUFFER s;
FILE *fp;
fp=fopen(yourfilename,"rb");
fread(&s,sizeof(NTFS_FILE_RECORD_OUTPUT_BUFFER),1,fp);
fclose(fp);
or if you want to achieve this only using deviceiocontrol, then,
pass the filename to the deviceiocontrol as input parameter,
openthe file inside, read the structure and pass it as out parameter to the device io control.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
modified on Wednesday, July 22, 2009 7:24 AM
|
|
|
|
|
Thank you for your reply!I use this record information to get the layout of the file on the NTFS disk.This is called data run in the NTFS document,which is can be retrived from http://www.linux-ntfs.org/doku.php[^]
By the way, why the beginning of the file is the NTFS_FILE_RECORD_OUTPUT_BUFFER record?Could you give me some information?
|
|
|
|
|
i think you are entirely deviating the topic from what you exactly wanted.
please explain your problem very clearly and i shall definitely help you solve your problem.
explain your requirement and problem in steps.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
I'm sorry for make you confused.My problem is if I know a file name(contains path),how can I get the layout of the file on a NTFS disk?
For instance,if the file name is e:\data.bin,this file was split to three parts on the disk.Now how can I get each part's starting logical cluster number,data length on the disk.The meaning of starting logical cluster number and data length is explained in the NTFS document I mentioned above.
Do I explain my question clearly?
|
|
|
|
|
denghp wrote: Any information is appreciated,thanks in advance.
See here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I know this method,but that's not what I want.Thank you for your reply.
|
|
|
|
|
denghp wrote: ...but that's not what I want.
You asked, "How can I get file record like using DeviceIoControl function with the control code FSCTL_GET_NTFS_FILE_RECORD to retrieve the file record?" The link I provided had an example of such.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi All,
I'm tearing my hear out over this one. I am subclassing controls dynamically at runtime. I run through each child control of a window, and check it's class. If the class is "BUTTON" I want to subclass it to one of four controls:
CThemedButton : public CButton
CThemedRadioButton : public CButton
CThemedGroupBox : public CButton
CThemedCheckBox : public CButton
However, I cannot for the life of me get the correct combination of window styles to make this work in every case. My code is as below:
bool bGroupBox = (dwControlStyle&BS_GROUPBOX);<br />
bool bRadioButton = (dwControlStyle&BS_RADIOBUTTON);<br />
bool bAutoRadioButton = (dwControlStyle&BS_AUTORADIOBUTTON);<br />
bool bCheckBox = (dwControlStyle&BS_CHECKBOX);<br />
bool bAutoCheckBox = (dwControlStyle&BS_AUTOCHECKBOX);<br />
bool bPushLike = (dwControlStyle&BS_PUSHLIKE);
But I'm getting bizarre results. It seems that BS_AUTORADIOBUTTON for example is a combination of other flags, as is BS_GROUPBOX. The end result is I get some buttons that are subclassed, unless they're the default buttons, group boxes aren't picked up, check boxes are missed. The button styles aren't proper flags it seems, so I'm getting cases where bRadioButton, bAutoRadioButton and bGroupBox are all true!
Please can anyone help me here? This should be simple but it's been causing me no end of problems.
Thanks in advance,
Dave Kerr
|
|
|
|