• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 209
  • Last Modified:

Security in Windows 2000

One windows NT/2000 user have no acces right of the files in one directory, but I want the program that user execute can access these files, How can I fulfill this?
0
Seashore
Asked:
Seashore
  • 4
  • 3
  • 2
  • +1
1 Solution
 
jkrCommented:
>>How can I fulfill this?

No way but impersonating an account that is granted access, which means obtaining the credentials - and for that you usually need a username/password. If you do not have the correct permissions to access a file, there usually is something else going wrong..
0
 
SeashoreAuthor Commented:
I need code sample.
0
 
DanRollinsCommented:
Seashore,
Do you have a username and password for an account that can access those files?
-- Dan
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
SeashoreAuthor Commented:
Yes, I Have
0
 
jkrCommented:
>>but I want the program that user execute can access these files

In this case (having the username and the password) you would call 'CreateProcessWithLogonW()' (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/createprocesswithlogonw.asp), e.g.

   STARTUPINFO         si;
   PROCESS_INFORMATION pi;

   BOOL                bRes;

   bRes    =   CreateProcessWithLogonW(
                 L"TheUser",
                 L"TheDomain",
                 L"ThePassword",
                 LOGON_WITH_PROFILE ,
                 L"C:\\path\\program.exe",
                 NULL,
                 0,
                 NULL,
                 0,
                 &si,
                 &pi
               );
0
 
SeashoreAuthor Commented:
When I run this code, I got a access violation in module "advapi32.dll".
I use Windows 2000 professional.
0
 
bcladdCommented:
No comment has been added lately, so it's time to clean up this TA. I will
leave a recommendation in the Cleanup topic area that this question is:

Answered: Points to DanRollins: Grade A

Please leave any comments here within the next seven days.

Experts: Silence means you don't care. Grading recommendations are made in light
of the posted grading guidlines (http://www.experts-exchange.com/help.jsp#hi73).

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

-bcl (bcladd)
EE Cleanup Volunteer
0
 
jkrCommented:
bcladd,

>>Answered: Points to DanRollins: Grade A

Are you sure that 'Do you have a username and password for an account that can access those files?' answered the Q? Not trying to put down Dan's comment, but please review again :o)
0
 
bcladdCommented:
Damn, damn, damn.

I read the right post; attributed it to the wrong poster. My apologies to DanRollins and jkr:

The recommended disposition of this question is:

Answered: Points to jkr: Grade A

(I don't actually have to change the answer I accepted (mentally), just read who posted it correctly.)

-bcl
0
 
DanRollinsCommented:
dang and that was one of my more brilliant insights.  But It's not about the points.  I'm just here to help...[jkr make points] :)
0
 
jkrCommented:
Dan - :o)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now