Jump to content
Xtreme .Net Talk

TripleB

Avatar/Signature
  • Posts

    38
  • Joined

  • Last visited

Everything posted by TripleB

  1. impersonate Hey all, I have found an example of microsoft: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemSecurityPrincipalWindowsIdentityClassImpersonateTopic.asp this works as it should but the problem I am facing is that I fysicaly attach the hard disk to another pc (our pc) and acces those directories witch are linked to an user account, as far as I know this isn't possible because the windows on our pc doesnt know the excistence of that user account correct? now the question is: Can I acces that user account from our windows. I have the user account name and pasword if that helps. the easiest way would be if i could change the owner of that account to our user account (which i do manualy now) but i don't know where to look for this to implement this... thx in advance
  2. ok good to know but still, If I use my code in save mode(because i didn't knew your answer) it I get the file properties AND the security tab so .....
  3. Hey fsx, tell me if I am mistaking but doesn't the security tab only show when you are logged on as Administrator or in save mode?? Greetz
  4. Hey, You might look @ the solution i posted on my thread about the properties dialog box maybe you can start from there ...... this one: Greetz
  5. Hello you all, for everyone who likes to know the solution this is what i was able to find greetz [structLayout(LayoutKind.Sequential)] public class SHELLEXECUTEINFO { public int cbSize; public int fMask; public int hwnd; [MarshalAs(UnmanagedType.LPWStr)] public string lpVerb; [MarshalAs(UnmanagedType.LPWStr)] public string lpFile; [MarshalAs(UnmanagedType.LPWStr)] public string lpParameters; [MarshalAs(UnmanagedType.LPWStr)] public string lpDirectory; public int nShow; public int hInstApp; public int lpIDList; public string lpClass; public int hkeyClass; public int dwHotKey; public int hIcon; public int hProcess; } [DllImport("Shell32.dll", CharSet=CharSet.Auto)] public static extern int ShellExecuteEx (SHELLEXECUTEINFO shinfo); private const int SW_SHOW = 5; private const int SEE_MASK_INVOKEIDLIST = 0x0C; private void Form1_Load(object sender, System.EventArgs e) { SHELLEXECUTEINFO shInfo = new SHELLEXECUTEINFO(); shInfo.cbSize = Marshal.SizeOf(typeof(SHELLEXECUTEINFO)); shInfo.lpFile = @"c:\windows\notepad.exe"; shInfo.nShow = SW_SHOW; shInfo.fMask = SEE_MASK_INVOKEIDLIST; shInfo.lpVerb = "properties"; ShellExecuteEx (shInfo); }
  6. Hey, You could use the namespace System.IO then you simply do: Directory.exists(path) for more info see: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemiodirectoryclasstopic.asp greetz
  7. Yes true... but have got to much to do Hey Arch4ngel, I know it isn't hard to recreate, but call me lasy but I just don't feel like putting time in that... I still have more important things to implement and thougth why not take the easy way... if I don't get a positive respons I will recreate it but hopefully it won't be necessary Greetz
  8. Hellow all, I would like to show the file/dir properties dialog box in c# .net. The right mousebutton on file/dir properties dialog box you know... Can I use the built in windows thing of do I have to recreate it my self? Greetz
  9. invasive or not In my situation not... Hello all, Arch4Angel: I know it seems invasive but everything I would do with that application (and currently doing manualy) happens with the conscent of the customer, .... I work in a computer store that repares pc's does formats etc... for example customer brings in pc windows doesn't boot anymore no way of repairing the windows... Customer wants windows to be reinstalled and wants backups to be taken but his account is secured with a password, so now I grant my self acces to his account by changing the owner of the files and directories. So manualy this poses no problem, but it in this application I would like to automate it. I am going to read the links Derek provided me maybe. If it is possible to supply the user account name + password to make the copy work would also be an option because I have acces to it if I ask the client for it so... Greetz and thx for your replies
  10. Hey Derek, thx for your reply, I have to admit you've lost me a bit... the only solution that i understand a bit is the last one with the account, this is what i would do manualy just reassign all the files to an other account. But how can i do this through code... for the other solutions can you give me a direction where i can find info about setting credentials in a process and about ACL, thx Greetz
  11. No but let me explain.... No, it would be used in a store that repares pc's does formats and so on, the idea is that you connect the harddisk to a pc where the application is installed on then you start a scan, and automaticly copy or copy some files manualy, but as i said in my main post if the user directory is protected with a password then you aren't able to acces these files, so that is what i need to bypass through code.... Greetz
  12. Hello all, I am writing some kind of a backup program to be used in a techinical service department of a store. the idea is to scan a harddisk for possible backups and so on. Now most of it offers no problem except the fact if the directory is protected with a password, meaning that a user account is coupled to the directories. I know how to by pass this manualy but i would like to do this through code, so that the user of the backup program doesn't need to know how to do this. so this in a few words. how to change the owner of a directory/ directories.... any help would be appreciated ps language being used is c# thx in advance
  13. Hello everyone, I'm trying to obtain the file associated icon, I know that i can do this with the api function SHgetFileInfo but I can't get it to work in C++ .net what i have so far is [structLayoutAttribute(LayoutKind::Sequential)] __gc struct SHFILEINFO { public: const static int NAMESIZE = 80; IntPtr hIcon; int iIcon; unsigned int dwAttributes; String* szDisplayName; String* szTypeName; }; [DllImportAttribute("Shell32.dll",CharSet=CharSet::Auto)] extern "C" unsigned int* SHGetFileInfo(String* pszPath,unsigned int dwFileAttributes,SHFILEINFO* psfi,unsigned int cbFileInfo,unsigned int uFlags); int _tmain(void) { SHFILEINFO* sfi; SHGetFileInfo("c:\\test.txt",FILE_ATTRIBUTE_NORMAL,sfi,Marshal::SizeOf(__typeof(SHFILEINFO)),SHGFI_SYSICONINDEX | SHGFI_SMALLICON | SHGFI_USEFILEATTRIBUTES); return 0; } It runs whitout erros but the SHFILEINFO struct sfi remains empty and I haven't got a clue why , I am fairly new to C++ and .Net so every help is realy appreciated. Thanx in advance,
×
×
  • Create New...