locked
Application autostart windows 7 64 bit. Is it the same as manual start? RRS feed

  • Question

  • Hi,

    I've made a small program that autostarts when windows starts. The program runs, but it doesn´t do anything.

    So my question is: does it start in some restricted mode for "security" reasons? Like uac?

    And if so, how do I handle this bug? The whole point is that it should run whoever is logged in on the computer.

    Thanks!

    Wednesday, June 12, 2013 10:30 PM

Answers

  • Hi again and thanks everyone for your help!

    This is the answer to my particular problem:

    There is a bug in windows that makes the Directory.GetCurrentDirectory method report windows/system32 as the running directory on autostart. When started manually, it reports the correct running directory.

    • Marked as answer by Black Santa Tuesday, July 9, 2013 11:52 AM
    Tuesday, July 9, 2013 11:52 AM

All replies

  • You can modify the program to run as a Windows Service - this will run at startup (if configured to do so), before a user even logs in (or even if they don't).


    Reed Copsey, Jr. - http://reedcopsey.com
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    Wednesday, June 12, 2013 10:39 PM
  • Thanks for answering.

    I had it as a service, actually, but then there were problems with virtually everything when running on windows 7. Not to mention the work with debugging...

    But do you know if windows starts applications in the wrong mode?

    Thursday, June 13, 2013 7:15 AM
  • Thanks for answering.

    I had it as a service, actually, but then there were problems with virtually everything when running on windows 7. Not to mention the work with debugging...

    But do you know if windows starts applications in the wrong mode?

    If you use the Windows Task Scheduler, you have control over which account is used, and whether it's run elevated.


    Reed Copsey, Jr. - http://reedcopsey.com
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    Thursday, June 13, 2013 4:21 PM
  • Thanks

    But if you don´t want to use the task scheduler?

    There must be another way, isn´t there?

    Monday, June 17, 2013 7:24 PM
  • http://www.sevenforums.com/tutorials/1401-startup-programs-change.html

    I would be wary of using the CCleaner option in case you click a wrong button.

    --
    Andrew

    • Marked as answer by Youen Zen Monday, July 1, 2013 3:18 AM
    • Unmarked as answer by Black Santa Tuesday, July 9, 2013 11:52 AM
    Monday, June 17, 2013 7:48 PM
  • Thanks for answering.

    Turns out the program doesn´t have the "require administrator" setting in the manifest. in stead, it uses the "as invoker" setting.

    So i guess the question is:

    What does the UAC do? My program reads from the registry and writes the values to a text file (not located in any system folder). This is of course something that should be allowed, so if this is a UAC bug, I need to know how to fix it.

    Having the user "accept" the program is of course out of the question, since it would make the whole autostart thing useless.

    Thanks.

    Monday, June 17, 2013 8:58 PM
  • Hi again and thanks everyone for your help!

    This is the answer to my particular problem:

    There is a bug in windows that makes the Directory.GetCurrentDirectory method report windows/system32 as the running directory on autostart. When started manually, it reports the correct running directory.

    • Marked as answer by Black Santa Tuesday, July 9, 2013 11:52 AM
    Tuesday, July 9, 2013 11:52 AM
  • There is a bug in windows that makes the Directory.GetCurrentDirectory method report windows/system32 as the running directory on autostart. When started manually, it reports the correct running directory.

    If you'd told us what wasn't working earlier, we could have suggested something like this:

    Imports System.IO
    Imports System.Reflection
    
    Module Module1
    
        Sub Main()
            Dim progDir As String = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase)
            Console.WriteLine(progDir)
    
            Console.ReadLine()
    
        End Sub
    
    End Module

    HTH,

    Andrew

    Tuesday, July 9, 2013 7:15 PM
  • Hi Andrew,

    Yes I understand that, and I´m sorry about that, but I didn´t know until now.

    I tried just about everything before finally putting a msgbox in there. The thing is I had a log file to check how far the execution went, but since the log file was also located in the directory windows didn´t find, there was nothing to read.

    Thanks for you help, it´s greatly appreciated.

    Tuesday, July 9, 2013 8:31 PM
  • Yes I understand that, and I´m sorry about that, but I didn´t know until now.

    That's fair enough - it can take some time to narrow down where the problem is :)

    Best regards,

    Andrew

    Tuesday, July 9, 2013 9:38 PM