|
See the community comments at the MSDN for CheckTokenMembership [^].
There should be no different behaviour when compiled with VC 6 or VS 10 and executed on the same system using the same AdvApi.dll.
|
|
|
|
|
I'm not an expert on the subject, but I do have experience with UAC, Vista + and VS2010.
I spent several months reading up on the topic.
On Vista+, your user account can be made or set to administrator, or the group administrator, just like on Windows XP, in which the setting claims you can make any changes to the system you desire, if your are using the Windows Desktop.
But the Windows Desktop runs in 3 modes, mode 1 is a virtual mode, or a clone of the real windows desktop, mode 2, when you elevate, is the real administrators desktop, and mode 3 is the highest level of windows desktop.
When you ran your code, it said of course you are an administrator, but you have to elevate past the clone desktop, by bringing up the elevate permission dialog in order to actually run code that requires administrative permissions in the real desktop. If you don't elevate, your code will not run, and return an error code 740.
When you set UAC in the manifest to a higher level than AsInvoked, when the program starts, it will invoke the elevate dialog, and elevate the program to the next desktop level.
I suspect your code is old school for Windows XP, and just sort of gives you the actual answer, which is true when running as AsInvoked.
Writing for Vista and Windows 7 is a totally different way of thinking, UAC first, everything else second. You have to get permission from the desktop to make changes to the OS, or keep your programs boundaries in an isolated environment.
|
|
|
|
|
I want to make a window like snapshot manager tree node in VMWare?
Does anybody know how to make it???
Thinks in advance!!..
I am S-jun..
|
|
|
|
|
Jing_K wrote: I want to
Then you should start with some research; put the keywords of your proposed solution into Google and start learning about the features you want to use.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
+5
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
thanks,
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
q1: C programme that accepts valid file names as command line arguments and for each of the arguments, prints the type of the file (regular file, directory file, character special file, block special file,
symbolic link, etc)
#include<stdio.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
int main(int argc,char *argv[])
{
int i;
struct stat buf;
for(i=1;i<argc;i++)
{
printf("%s",argv[i]);
if(lstat(argv[i],&buf)==-1)
{
printf(" Lstat error\n");
continue;
}
if(S_ISREG(buf.st_mode))
printf(" Regular file\n");
if(S_ISDIR(buf.st_mode))
printf(" Directory file\n");
if(S_ISCHR(buf.st_mode))
printf(" Character file\n");
if(S_ISBLK(buf.st_mode))
printf(" Block file\n");
if(S_ISLNK(buf.st_mode))
printf(" Symbolic link file\n");
}
}
/////////////////////////////////////////////////////
q2: C programme to do the following: Using fork() create a child process. The child process prints its own process id and id of its parent and then exits. The parent waits for the childto finish(by executing wait()) and prints its own process id and the id of its child and then exits.
#include <stdio.h>
#include<stdlib.h>
#include<sys/stat.h>
#include<sys/types.h>
int main()
{
pid_t ppid,mpid,pid,status=0;
pid=fork();
if(pid<0)
{
printf("Error");
exit(0);
}
if(pid==0)
{
mpid=getpid();
printf("\n I am child, my id is %d",mpid);
ppid=getppid();
printf("\n I am parent, my id is %d ",ppid);
exit(1);
}
pid=waitpid(pid,&status,0);
mpid=getpid();
printf("\n I am parent with id %d and my child is %d \n",mpid,pid);
}
both giving sysntax error,where is the mistake,can any rectify it,i have tried[in fedora 12-linux] i couldnt got solution
|
|
|
|
|
connect2janu wrote: both giving sysntax error,where is the mistake...
Your compiler should tell you exactly where and what the problem is.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Instead of posting only the code, you should post the compiler error as well. And please edit the post to format the code section properly.
|
|
|
|
|
Is it just me or not but in my day we didn't ask for help at the first hurdle and things were hard then, no internet, remember compiling 16 bit code for the large memory model? We had to find the answers ourselves.
It strikes me it is too easy today to throw an ill-formed/undefined question at CP and expect an answer! What happened to research? What happened to thinking out a problem till you got the the very nub of the issue; because once you know the right question to ask, the answer almost suggests itself.
I mean, linked lists, writing data to a file? Thats really simple stuff that anyone studying a programming course should e able to work out for themselves!
==============================
Nothing to say.
|
|
|
|
|
Well, you're right in that it's too easy to just shoot a question into the great Internet Void (tm) and sit back and wait for an answer. One of the things that kill me is the number of questions that claim to be "urgent" yet they're willing to wait for who known how many hours for somebody to notice their question on CP or anywhere else. If it's "urgent" you should be researching it yourself.
Personally, I blame the instructors (since apparently many of these questioners are in classes somewhere). Linked Lists, Reading / Writing Files, this is all Computer Science 1 stuff yet there are no apparent "cookbook answers" or "class tutorials" on this stuff that explains it more fully. You'd think that problems with this stuff would be a predictable outcome so instructors should prepare to instruct on the topic.
And maybe it's the proliferation of "online universities" where there is no physical contact with a "teaching staff" who can provide personalized instruction / answers. Back in the 60's, we had professors who lectured and Teaching Assistants who held other classes and a group of top students (Program Advisors) that sat at desks in the Comp Sci Department and helped fellow students through the homework assignments. I did that job for a couple of semesters. Who provides that service now? Code Project and other such sites.
|
|
|
|
|
Chuck O'Toole wrote: Back in the 60's, we had professors who lectured
Back in the 60's I was learning programming on the job from my peers, and reading the manuals.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Ah yes, the good old days when my bedtime reading was the IBM 7090 Principles of Operation manual Back then, Computer Science wasn't it's own discipline but fell under the Math Department (they didn't know where else to put it). And OJT was the only way anybody got any training.
|
|
|
|
|
Richard MacCutchan wrote: Back in the 60's I was
and I was in diapers, learning how to walk and talk.
Independent ACN Business OwnerMake toll free long distance calls from your smart phone with ACN Mobile World. When connected via wifi, calls will not use any of your minutes or data, nor will there be any roaming charges. Certain conditions apply. See my website for details.
Within you lies the power for good - Use it!
|
|
|
|
|
That was not univote worthy, countered.
|
|
|
|
|
Back in the 60's my mother was being born. So yeah.
I think that this issue is not only disturbing regarding the fact that people shoot questions on the internet void hoping for an answer to come from the beyond, but as in some cases in which I worked with "experienced" developers which had to ask me, an "I have been programming as a job for 6 months" student how to retrieve items to a .net list.
It's everywhere, and its spreading fast. You better cover up!
- Arthur Souza
www.lotusrpg.com.br
|
|
|
|
|
arthurfsouza wrote: I worked with "experienced" developers which had to ask me, an "I have been programming as a job for 6 months" student how to retrieve items to a .net list.
I get the point you are trying to make, but just because a person is experienced, that does not automatically mean they are experienced in the same disciplines as you.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
I find the existence of experienced .net developers that don't know how to retrieve an item from a generic List<t> much more disturbing than that of students that just throw questions on the internet expecting answers from the beyond.
Or perhaps one evolves (using that word loosely) into another.
- Arthur Souza
www.lotusrpg.com.br
|
|
|
|
|
In my college course, the instructor was around for class, then vanished, leaving 2 or 3 of us to help the rest.
How I wish Google had existed then.
I need an app that will automatically deliver a new BBBBBBBBaBB (beautiful blonde bimbo brandishing bountiful bobbing bare breasts and bodacious butt) every day.
John Simmons / outlaw programmer
|
|
|
|
|
I went back for new training in '04. The instructors were leaving most in the dust, while for me, they were clearly describing something I'd already read in the text books handed out before classes started. It was semi-helpful review for me because I'd cracked open the books and read them as much as I could before class started. I've attended lectures where that person left me in the dust, because I didn't know there was research I could have done ahead of time. In both cases, they weren't of much help to me because I'm more of a visual learner.
|
|
|
|
|
That seems a bit unfair - I remember sitting in classes where the instructor explained the material, we had text books, but still some folks would ask for someone to explain what had been explained to them.
There will always be idiots who think that programming is a good job, and they should be able to do it well, and that if they can't, it is someone elses fault.
|
|
|
|
|
Erudite_Eric wrote: Is it just me or not but in my day we didn't ask for help at the first hurdle
and things were hard then, no internet, remember compiling 16 bit code for the
large memory model? We had to find the answers ourselves.
First because there were very few resources.
Second because it was often difficult to access those resources.
Third there were far fewer people doing it.
Erudite_Eric wrote: It strikes me it is too easy today to throw an ill-formed/undefined question at
CP and expect an answer! What happened to research? What happened to thinking
out a problem till you got the the very nub of the issue; because once you know
the right question to ask, the answer almost suggests itself.
Based on that argument every doctor would learn solely by reading books and experimenting.
The reason people didn't use resources long ago was because they didn't exist long ago. The reason that they use them now is because they exist now.
|
|
|
|
|
jschell wrote: Based on that argument every doctor would learn solely by reading books and
experimenting.
Call me old fashioned but I wouldn't wanted to be treated by a doctor that got his answers off of WebMD or other Medical BBS. Who knows what quality of answer they'd get there.
Nope, I want doctors taught by experienced professors in University Medical Schools, preferably ones attached to real hospitals so the students can do "rounds" with actual doctors. That's how they learn.
That's the analagous discussion to what's here. Would you hire a programmer who said "I learned everything I know from Code Project"? I wouldn't. Have I picked up things here or learned something I didn't know, sure I have. But CP is the *last* place I come to, not the first.
|
|
|
|
|
Chuck O'Toole wrote: But CP is the *last* place I come to, not the first
Amen!
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
Many hobbyists are more skilled and/or knowledgeable in what they do than professionals.
Why? The hobbyist always loves what he does. The professional loved it once, but now it's just a job that gets bread on the table.
Of course there's many great professionals too, but I wouldn't trust a professional more than I would trust a fanatic hobbyist.
I learned almost everything I know from CP and I spent last saturday fixing code from a Microsoft Certified *insert some titles here*.
And it isn't the first time I fixed her code either.
It's an OO world.
public class Naerling : Lazy<Person>{
public void DoWork(){ throw new NotImplementedException(); }
}
|
|
|
|