It is currently Sat Nov 25, 2017 2:52 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: MSConfig not seeing startup entry
PostPosted: Sun Sep 17, 2017 8:08 am 
Offline
Addict
Addict

Joined: Mon Feb 16, 2015 2:49 pm
Posts: 1027
Hi dudes. :)

I added my exe to "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run" and it works great -- it runs at logon as expected. Good stuff; happy days.

But when I open MSConfig and go to the "Startup" tab, it's NOT listed there, even after a reboot. :( Anyone know why? Surely it should be appearing there?

Here's some screenshots: https://i.imgur.com/ZrODZrC.png

My exe, starting with "A", should be there?


Top
 Profile  
Reply with quote  
 Post subject: Re: MSConfig not seeing startup entry
PostPosted: Sun Sep 17, 2017 6:35 pm 
Offline
Addict
Addict

Joined: Sun Apr 12, 2009 6:27 am
Posts: 2848
Try
Code:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run

_________________
Egypt my love


Top
 Profile  
Reply with quote  
 Post subject: Re: MSConfig not seeing startup entry
PostPosted: Mon Sep 18, 2017 8:19 am 
Offline
Addict
Addict

Joined: Mon Feb 16, 2015 2:49 pm
Posts: 1027
Hi Rashad, no need to try that because my exe needs to run from a limited account, which can't write to HKEY_LOCAL_MACHINE.

So even if it appears there in MSConfig for HKEY_LOCAL_MACHINE, it won't help with HKEY_CURRENT_USER.


Top
 Profile  
Reply with quote  
 Post subject: Re: MSConfig not seeing startup entry
PostPosted: Mon Sep 18, 2017 1:21 pm 
Offline
Addict
Addict

Joined: Sun Apr 12, 2009 6:27 am
Posts: 2848
OK
Try next snippet
Code:
  listptr=0
  result$=Space(270)
  SHGetSpecialFolderLocation_(0,#CSIDL_STARTUP,@listptr)
  SHGetPathFromIDList_(listptr,@result$)
  Path$ = Trim(result$)
 
  Linkn$ = "RASHAD.LNK"                               ;Link Name(Your Program Name)
  Prog$ = "C:\PB_Player\PB_Player.exe"                ;Programme Name (With Full Path)
  WorkDir$ = "C:\PB_Player\"                          ;Working Directory
 
  If OpenFile(0,Path$+"\temp.vbs")
    CloseFile(0)
    DeleteFile(Path$+"\temp.vbs")
  EndIf 
  DeleteFile(Path$+"\RASHAD.LNK")

If CreateFile(0, GetHomeDirectory()+"temp.vbs",#PB_File_SharedRead)
  WriteStringN(0, "Set oWS = WScript.CreateObject("+Chr(34)+"WScript.Shell"+Chr(34)+")")
  WriteStringN(0, "sLinkFile = "+Chr(34)+Path$+"\"+Linkn$+Chr(34))
  WriteStringN(0, "Set oLink = oWS.CreateShortcut(sLinkFile)")
  WriteStringN(0, "oLink.TargetPath = "+Chr(34)+Prog$+Chr(34))
  WriteStringN(0, "oLink.IconLocation = "+Chr(34)+Prog$+", 0"+Chr(34))
  WriteStringN(0, "oLink.WindowStyle = "+Chr(34)+"1"+Chr(34))                   ;#SW_SHOWNORMAL = 1 ,#SW_SHOWMINIMIZED = 2 ,#SW_SHOWMAXIMIZED = 3
  WriteStringN(0, "oLink.WorkingDirectory = "+Chr(34)+WorkDir$+Chr(34))
  WriteStringN(0, "oLink.Save")
  CloseFile(0)
Else
  MessageRequester("Error", "Error: can't write the file", 0)
EndIf

;RunProgram("WScript.exe"," "+GetHomeDirectory()+"temp.vbs","",#PB_Program_Wait| #PB_Program_Hide)
RunProgram(GetHomeDirectory()+"temp.vbs","","", #PB_Program_Wait|#PB_Program_Hide)
DeleteFile(GetHomeDirectory()+"temp.vbs")

_________________
Egypt my love


Top
 Profile  
Reply with quote  
 Post subject: Re: MSConfig not seeing startup entry
PostPosted: Mon Sep 18, 2017 9:19 pm 
Offline
Addict
Addict

Joined: Sun Apr 12, 2009 6:27 am
Posts: 2848
Danilo ---> ts-soft ---> RASHAD
Using code
Code:

Macro DEFINE_GUID(Name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
  CompilerIf Defined(Name, #PB_Variable)
    If SizeOf(Name) = SizeOf(GUID)
      Name\Data1    = l
      Name\Data2    = w1
      Name\Data3    = w2
      Name\Data4[0] = b1
      Name\Data4[1] = b2
      Name\Data4[2] = b3
      Name\Data4[3] = b4
      Name\Data4[4] = b5
      Name\Data4[5] = b6
      Name\Data4[6] = b7
      Name\Data4[7] = b8
    Else
      Debug "Error - variable not declared as guid"
    EndIf
  CompilerEndIf
EndMacro


Procedure CreateShortcut(Path.s, Link.s, WorkingDir.s = "", Argument.s = "", ShowCommand.l = #SW_SHOWNORMAL, Description.s =  "", HotKey.l = #Null, IconFile.s = "|", IconIndex.l = 0)
  Protected psl.IShellLinkW, ppf.IPersistFile, Result
  Protected.GUID CLSID_ShellLink, IID_IShellLink, IID_IPersistFile
 
  DEFINE_GUID(CLSID_ShellLink, $00021401, $0000,$0000, $C0, $00, $00, $00, $00, $00, $00, $46) ; {00021401-0000-0000-C000-000000000046}
  DEFINE_GUID(IID_IShellLink, $000214F9, $0000,$0000, $C0, $00, $00, $00, $00, $00, $00, $46)  ; {000214F9-0000-0000-C000-000000000046}
  DEFINE_GUID(IID_IPersistFile, $0000010B, $0000,$0000, $C0, $00, $00, $00, $00, $00, $00, $46); {0000010b-0000-0000-C000-000000000046}
 
  If IconFile = "|" : IconFile = Path : EndIf

  CoInitialize_(0)
  If CoCreateInstance_(@CLSID_ShellLink, 0, 1, @IID_IShellLink, @psl) =  #S_OK

    Set_ShellLink_preferences:
    psl\SetPath(Path)
    psl\SetArguments(Argument)
    psl\SetWorkingDirectory(WorkingDir)
    psl\SetDescription(DESCRIPTION)
    psl\SetShowCmd(ShowCommand)
    psl\SetHotkey(HotKey)
    psl\SetIconLocation(IconFile, IconIndex)
    ShellLink_SAVE:
    If psl\QueryInterface(@IID_IPersistFile, @ppf) = #S_OK
      ppf\Save(Link, #True)
      result = 1
      ppf\Release()
    EndIf
    psl\Release()
  EndIf
  CoUninitialize_()
  ProcedureReturn result
EndProcedure


listptr = 0
result$=Space(270)
SHGetSpecialFolderLocation_(0,#CSIDL_STARTUP,@listptr)
SHGetPathFromIDList_(listptr,@result$)
Path$ = Trim(result$)

CreateShortcut("C:\pb_player\pb_player.exe",Path$+"\rashad.lnk","","",#SW_SHOWMAXIMIZED,"",#Null,"%SystemRoot%\system32\SHELL32.dll",12)

_________________
Egypt my love


Top
 Profile  
Reply with quote  
 Post subject: Re: MSConfig not seeing startup entry
PostPosted: Wed Sep 20, 2017 10:47 am 
Offline
Addict
Addict

Joined: Mon Feb 16, 2015 2:49 pm
Posts: 1027
Hi Rashad, both your examples didn't put anything in the Startup tab of MSConfig for me. Thanks for trying. BTW, I'm using Win 7.


Top
 Profile  
Reply with quote  
 Post subject: Re: MSConfig not seeing startup entry
PostPosted: Thu Sep 21, 2017 5:41 pm 
Offline
Addict
Addict

Joined: Sun Apr 12, 2009 6:27 am
Posts: 2848
The 2nd snippet works as expected with Windows 7,8,10

_________________
Egypt my love


Top
 Profile  
Reply with quote  
 Post subject: Re: MSConfig not seeing startup entry
PostPosted: Thu Sep 21, 2017 10:29 pm 
Offline
Addict
Addict

Joined: Mon Feb 16, 2015 2:49 pm
Posts: 1027
Hmm, definitely doesn't work here with Win 7. I even tried turning of my AV in case it was interfering. I'll try it in a virtual machine later to see.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye