Results 1 to 11 of 11

Thread: Win7 and vista permission problems

  1. #1

    Thread Starter
    Fanatic Member coolcurrent4u's Avatar
    Join Date
    Apr 2008
    Location
    *****
    Posts
    993

    Win7 and vista permission problems

    Hello guys,

    I recently developed an app in vb6 that has to modify some system file for it to function properly eg host.

    Even when running in in admin user account, "not the default administrator", permission to that file is locked or the file is readonly.

    Unless the program is run in the default administrator account, then the file is locked. teh program works well in winxp, except vista and win7

    what do i do now, as i need a way to add dns record to the host file without running as administrator account
    Programming is all about good logic. Spend more time here


    (Generate pronounceable password) (Generate random number c#) (Filter array with another array)

  2. #2
    New Member
    Join Date
    Jul 2010
    Posts
    11

    Re: Win7 and vista permission problems

    In Vista and Win 7 you have to run as "Administrator" by right clicking your application and selecting to run as "Administrator". Though if the user is mentioned as the "Administrator" it is not so. And moreover no vb6 application will run on win7 and vista. Better always use WinXP.

  3. #3
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Win7 and vista permission problems

    The first half of that reply is correct, but I'm afraid that this part is very wrong:
    Quote Originally Posted by [email protected] View Post
    And moreover no vb6 application will run on win7 and vista. Better always use WinXP.
    In most cases VB6 applications work perfectly on Vista/7 with no changes at all, or just the same changes needed for XP and 2000 to allow non-admin users to be able to run them (such as this particular issue).

    In fact generally Vista/7 require fewer code changes than XP/2000 for a non-admin, due to features such as virtualisation automatically fixing your mistakes to some degree.

  4. #4
    New Member
    Join Date
    Jul 2010
    Posts
    11

    Re: Win7 and vista permission problems

    Oops sorry i had used a wrong word saying that the VB6 application wont work in win7 and vista.

    What i had meant is if any code has to be done using vb6 in win7 and vista, it is not so easily possible.

    This is what i tried to mean.

    Sorry for my wordings.

    Thanks for pointing it out.

  5. #5

    Thread Starter
    Fanatic Member coolcurrent4u's Avatar
    Join Date
    Apr 2008
    Location
    *****
    Posts
    993

    Re: Win7 and vista permission problems

    thanks for response

    instead of rightclicking, is there a way to force the app to require administrator privileged before starting?

    The app is installed and run under admin account
    Last edited by coolcurrent4u; Oct 21st, 2010 at 11:11 AM.
    Programming is all about good logic. Spend more time here


    (Generate pronounceable password) (Generate random number c#) (Filter array with another array)

  6. #6
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Win7 and vista permission problems

    You can manifest it to do that. It has been asked before, try doing a few Searches on the forum.

  7. #7

    Thread Starter
    Fanatic Member coolcurrent4u's Avatar
    Join Date
    Apr 2008
    Location
    *****
    Posts
    993

    Re: Win7 and vista permission problems

    i found some code that requires attaching manifest to my app.

    vb Code:
    1. <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    2. <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    3.    <assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="MyApp" type="win32"/>
    4.       <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    5.       <security>
    6.          <requestedPrivileges>
    7.             <requestedExecutionLevel level="requireAdministrator"/>
    8.          </requestedPrivileges>
    9.       </security>
    10.    </trustInfo>
    11. </assembly>

    I have not tested it yet, but in case it works, the problem is that i already manifest for xp styles. is there a way i cam merge the two manifest, or i only need to change some parameters

    optionally, where can i get detailed information about manifest and vb
    Programming is all about good logic. Spend more time here


    (Generate pronounceable password) (Generate random number c#) (Filter array with another array)

  8. #8
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Win7 and vista permission problems

    Manifest files are not specific to VB (there is no link at all) but to executables, you can find info about manifest files at Microsoft.

    You can merge multiple files together. I'm not sure of the details, but it should be easy to work out... I suspect you just need to copy the security section to the other file.

  9. #9

    Thread Starter
    Fanatic Member coolcurrent4u's Avatar
    Join Date
    Apr 2008
    Location
    *****
    Posts
    993

    Re: Win7 and vista permission problems

    Thanks Si,

    I'll try it out
    Programming is all about good logic. Spend more time here


    (Generate pronounceable password) (Generate random number c#) (Filter array with another array)

  10. #10
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Win7 and vista permission problems

    It isn't a question of "merging files together."

    An application manifest is an XML document that can provide lots of information about your application to Windows. Just copy/pasting things into your manifest can have effects you don't expect if you don't understand what you're doing.

    For example the presence of a trustInfo section tells Windows your program is "Vista aware" which will bypass many 9x/XP AppCompat shims. This can cause your program to fail in unexpected ways if it isn't actually aware of the rules of the road.

  11. #11
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Win7 and vista permission problems

    la volp has posted an app (source) to add manifests to your project res file, for both xp styles and admin elevation
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width