|
I did not get the c program code suiting my requirement. I was expecting to find a code from you but not a proverb or saying of any person. sorry for my remark but I mean it.
|
|
|
|
|
you should really do your own homework.... IF (really big if) you pass your course and actually start commercial development you cant rely on forum posters to do your work for you.
|
|
|
|
|
krsrinivas wrote: I was expecting to find a code from you
You expect a lot, don't you ? Now, if you want help, read the posting guidelines and ask your question properly. If you really want the full code for your program, then this is certainly not the correct forum to ask. You should instead go on rentacoder and pay somebody to do your work for you.
|
|
|
|
|
Hello!
I'm trying to get ACL from HKEY_LOCAL_MACHINE (also such problem with HKEY_CURRENT_CONFIG) registry key.
#include <iostream>
#include <conio.h>
#include <sddl.h>
#include <Aclapi.h>
#include<string.h>
#include <strsafe.h>
#include <windows.h>
char information[1024];
int My_GetObjectAcl(int qtype,char *filestr){
int i,j;
char sd[4096];
char temp1[256];
DWORD sdsize;
char strnew[4096];
DWORD sdnewlen=0; DWORD count;
PEXPLICIT_ACCESS pList[10];
BOOL d1,d2;
PACL pDacl=NULL;
DWORD aclSize;
BYTE bACEType;
LPVOID pAce;
LPBOOL bbb=0;
PSID pSID=NULL;
PSID osid=NULL;
SID_NAME_USE SidType;
ACCESS_ALLOWED_ACE *ACE;
DWORD tmp;
SE_OBJECT_TYPE otype;
char Name[100], Domain[100];
DWORD NameSize = 100, DomainSize = 100;
LPSTR *sidstring;
char str1[512], str2[512];
memset(temp1,0,256);
switch (qtype){
case 1: otype=SE_FILE_OBJECT; break;
case 2: otype=SE_REGISTRY_KEY; break;
default: return 5;
}
printf("Trying read: %s\n",filestr);
pDacl=(PACL)GlobalAlloc(GMEM_FIXED,1000);
if (qtype==1){
if (!GetFileSecurityA((LPCSTR)filestr,DACL_SECURITY_INFORMATION,sd,4096,&sdsize)) {printf("Error %d\n",GetLastError());return 5;}
i=GetSecurityDescriptorDacl(sd,&d1,&pDacl,&d2);
if (!i){ printf("Error %d\n",GetLastError());return 5;}
} else
if(GetNamedSecurityInfoA((LPSTR)filestr,otype,DACL_SECURITY_INFORMATION,NULL,NULL,&pDacl,NULL,NULL)!=ERROR_SUCCESS){printf("::%d",qtype); return 5;}
memset(temp1,0,256);
sprintf(temp1,"Number of ace entries: %d \n",pDacl->AceCount);
strcat(information,temp1);
for (i=0;i<pDacl->AceCount;i++){
memset(str1,'\0',512);
j=0;
NameSize = 100; DomainSize = 100;
GetAce(pDacl,i,&pAce);
bACEType = ((ACE_HEADER*)pAce)->AceType;
ACE = ((ACCESS_ALLOWED_ACE *)pAce);
pSID = (PSID)&(ACE->SidStart);
j=LookupAccountSidA(NULL,pSID,Name,&NameSize,Domain, &DomainSize,&SidType);
if (j==0) printf("\n\n%lu\n\n",GetLastError());
strcpy(str1,Domain);
strcat(str1,"\\");
strcat(str1,Name);
CharToOemA(Name,Name);
memset(temp1,0,256);
sprintf(temp1,"%s\\%s: \n",Domain,Name);
strcat(information,temp1);
switch(bACEType){
case ACCESS_ALLOWED_ACE_TYPE:memset(temp1,0,256);sprintf(temp1,"%s","TYPE:ALLOWED ");strcat(information,temp1);break;
case ACCESS_DENIED_ACE_TYPE:memset(temp1,0,256);sprintf(temp1,"%s","TYPE:DENIED ");strcat(information,temp1); break;
}
memset(temp1,0,256);
sprintf(temp1,"Mask: %X\n",ACE->Mask);
strcat(information,temp1);
memset(temp1,0,256);
tmp=0x80000000;
for (j=0;j<32;j++){
if ((ACE->Mask)&tmp) strcat(temp1,"1"); else strcat(temp1,"0");
tmp=tmp>>1;
}
strcat(information,temp1);
}
return 0;
}
int main()
{int k;
k=My_GetObjectAcl(2,"CURRENT_USER\\");
printf("%s\n",information);
memset(information,0,1024);
k=My_GetObjectAcl(2,"LOCAL_MACHINE\\");
printf("%s\n",information);
getch();
} ;
With CURRENT_USER\\ , USERS\\ and CLASSES_ROOT\\ - all fine. But LOCAL_MACHINE\\ and CURRENT_CONFIG\\ - error. It's really necessary to me to understand why it doesn't work. Please, help me to manage with this problem.Thank You.
modified on Sunday, May 3, 2009 5:53 AM
|
|
|
|
|
The code I'm trying to use:
std::string url = "http://www.psc-range.com/";
browser->Navigate(SysAllocString(url.c_str()),&vFlags,&vTargetFrameName,NULL,NULL);
The error:
'SysAllocString' : cannot convert parameter 1 from 'const char *' to 'const OLECHAR *'
I've managed to get this working:
browser->Navigate(SysAllocString(L"http://www.psc-range.com/"),&vFlags,&vTargetFrameName,NULL,NULL);
Unfortunately I need to get it work with any valid URL, not just one. If someone would please point me in the right direction I would appreciate it.
|
|
|
|
|
Seems like OLECHAR wants a unicode string and you are giving it an ASCII string, try converting your url to unicode, maybe like this:
std::basic_string<WCHAR> wide_url = L("http:\\...");
browser->Navigate(SysAllocString(wide_url.c_str()),&vFlags,&vTargetFrameName,NULL,NULL);
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Dear all,
I have a list control,In that how can i load different images for each row.Please any one help me.
Thanks and Regards
Tamil
|
|
|
|
|
Can try SetImageList( CImageList* pImageList ) function and having different images in the CImageList
|
|
|
|
|
Additionally to what Elsie suggested you can also try using an owner drawn list control.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
THis structure will give the exact time?
To elborate:
TIME_ZONE_INFORMATION is returned by an application running in another machine, how can i get the time details(hours, minutes, sceonds) from this structure. My understanding is this structure gives the TimeZone information but not the exact system time of that machine.
Correct me if iam wrong
|
|
|
|
|
Are you wanting to use NetRemoteTOD() ?
"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 working on client-server type application,server basically working on domain group.
server view all clients of domain group,and assign permission to use usb drives or not.
its all done,i m doning this with help of sockets.
please tell me how can i check on server side is any client can attach usb drive in his computer.
so please tell me how can i do this.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
how to hide the main window of a dialog based programe in mfc? and also make it invisable in application list of CTRL+ALT+DEL,not the process list.
thanks
|
|
|
|
|
I guess ShowWindow(SW_HIDE) would help.
It would hide the window and make the application not listed in the Applications list of Window's Task manager
|
|
|
|
|
i have tried the showwindow. but failed. in the mfc dialog based application the showwindow does't hide the main window. you can try.
|
|
|
|
|
I tried in a dialog based app.It is hiding the window.It should work i guess. Can you share your code snippet.
|
|
|
|
|
Sorry if i didnt address your exact issue.
Thanks
|
|
|
|
|
i put showwindow(sw_hide) in the oninitdialog. where did you use the showwindow()?
|
|
|
|
|
tyr2000 wrote: i have tried the showwindow. but failed.
What code did you use, and where?
"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 used showwindow(SW_HIDE) in the OnInitDialog();but it seems not work; why?
|
|
|
|
|
Because the base class implementation shows the window. 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
|
|
|
|
|
Great tip.
Thank you very much.
|
|
|
|
|
I'm trying to determine a way to write raw bytes of data to an ethernet cable (but more importantly, to the device to which it is attached), EXACTLY as described here for parallel cables:
I/O Uncesored 1 - Controlling LEDs (Light Emitting Diodes with Parallel Port
Looking into Inpout32.dll, which the article makes use of, it seems that it was developed specifically for parallel ports.
Then I looked into Physical "I/O Range" of the Network Adapter card itself: 0x9C00-0x9CFF .
It appears that there is a 256 bit range in which data can be written to/read from. However, when trying to initialize a pointer (dereferenced with the & sign), I get a segfault. Not that I ever really expected that to work anyway. If it's important, I'm running under a user w/ admin priveledges.
It couldn't be as simple as using the MFC CAsyncConnection stream classes and overloaded << and >> operators, could it?
How should I go about doing this? Is the solution going to be as complicated as writing my own kernel-mode driver?
Thanks,
-Adam
|
|
|
|
|
Hey, i don't know if this could help you or not but maybe take a peek at raw sockets[^], althorough i believe these don't go deep enough for you...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Hi,
The parallel port example you mention does not easily (if at all) translate to being applied to a network cable (which is more comparable to serial that parallel).
I did once build myself an ISA card to do some fast I/O work and wrote a driver to interface it to windows so based on the amount of work that required, I recommend looking into an API or streams etc.
To communicate with a networked device use of a network comms API or stream would seem to be the way to go - I've not done this but I'm sure there are articles on it.
|
|
|
|
|