Prev: A problem using PrintForm
Next: How To Know
From: Nobody on 21 Dec 2009 04:24 "MikeD" <nobody(a)nowhere.edu> wrote in message news:eh7amZegKHA.5568(a)TK2MSFTNGP02.phx.gbl... > What does the batch file do? Are there any commands which prompt the user > in any way? If so, I can see how this may not run from a service unless > the "allow to interact with desktop" option , or whatever it's called, is > enabled. One of the changes in Vista and after is that services run in their own session for security reasons, called session 0, which is non interactive, so you can't show a GUI to control the service, nor use things like FindWindow/EnumWindows/SendMessage/PostMessage to talk to the service from a GUI app. If you need to make software that configures a service, you have to make a second EXE and communicate with the service using some mechanism, such as named pipes, winsock, or the registry. See this article: Application Compatibility: Session 0 Isolation http://msdn.microsoft.com/en-us/library/bb756986.aspx This is what Session 0 Isolation is trying to prevent(Look for "WM_TIMER" and "Session 0"): http://en.wikipedia.org/wiki/Shatter_attack
From: Steve Ricketts on 21 Dec 2009 10:20 The .bat file calls ImageMagick four times. The "%IM%" is the path to the ImageMagic executables and the .bat file shows the replaced values so it's writing the .bat file back out... just not executing it. The shell return value shows a value but I haven't done anything with it. I essentially don't have to log anything out, each line of the .bat file will produce another file so I can tell none of them are being executed. If objFSO.FileExists(sAry(2)) Then Set objTextFile = objFSO.OpenTextFile(sAry(2), ForReading) sWork = objTextFile.ReadAll objTextFile.Close sWork = Replace(sWork, "%IM%", Exe) Set objTextFile = objFSO.OpenTextFile(sAry(2), ForWriting) objTextFile.Write (sWork) objTextFile.Close ret = Shell(sAry(2), vbHide) End If ..bat file contents: %IM%convert -size 80x20 gradient:#FFFFFF-#09355A normal.gif %IM%convert -size 80x20 gradient:#09355A-#FFFFFF hover.gif %IM%composite -compose CopyOpacity mask.gif normal.gif btn_normal.gif %IM%composite -compose CopyOpacity mask.gif hover.gif btn_hover.gif sr "mscir" <mscir(a)yahoo.com> wrote in message news:hgmeja$2pd0$1(a)adenine.netfront.net... > Steve Ricketts wrote: >> I need to make a modification to a service written in VB6 that modifies >> and then executes a .bat file. This runs fine when it's run from the >> command line, but when I start it as a service, it creates the .bat file >> but doesn't run it. I'm sure there's some sort of a permissions issue >> with the account the service is running under but I've tried the local >> system account as well as the administrator's account and there is no >> difference. >> Can someone tell me what I need to do in order to run a .bat file from a >> service? >> Thanks, >> Steve > > Can you post your code? > > How about modifying the .bat file to write a line to a text file each time > it performs a step, so you can see what kind of progress, if any, is being > made? > > If you're using the Shell command are you watching the returned value? > e.g. > > Dim RetVal > RetVal = Shell("(path)\(file).bat", vbWindowState) > > http://www.codetoad.com/forum/18_23202.asp > > Mike
From: Steve Ricketts on 21 Dec 2009 10:22 See previous post for contents. Actually, the service is being sent the command to execute the .bat file from a web page via an IP connection. The service doesn't know what the specifics are in the bat file because the parameters change slightly. There are no user prompts in the service or the .bat file. sr "MikeD" <nobody(a)nowhere.edu> wrote in message news:eh7amZegKHA.5568(a)TK2MSFTNGP02.phx.gbl... > > > "Steve Ricketts" <velocedge(a)hotmail.com> wrote in message > news:uBAkxXcgKHA.1540(a)TK2MSFTNGP06.phx.gbl... >> I need to make a modification to a service written in VB6 that modifies >> and then executes a .bat file. This runs fine when it's run from the >> command line, but when I start it as a service, it creates the .bat file >> but doesn't run it. I'm sure there's some sort of a permissions issue >> with the account the service is running under but I've tried the local >> system account as well as the administrator's account and there is no >> difference. >> >> Can someone tell me what I need to do in order to run a .bat file from a >> service? > > What does the batch file do? Are there any commands which prompt the user > in any way? If so, I can see how this may not run from a service unless > the "allow to interact with desktop" option , or whatever it's called, is > enabled. > > But if the program is writing this batch file, why can't it just perform > the same tasks? > > -- > Mike > >
From: Steve Ricketts on 21 Dec 2009 10:26 Contents are changed each time it's run. The bat file builds a rounded corner button .gif with transparency with gradient colors based on a start and end value. All the sizes and colors will differ as well as the type. sr "mscir" <mscir(a)yahoo.com> wrote in message news:hgnaud$vi4$1(a)adenine.netfront.net... > MikeD wrote: > >> "Steve Ricketts" <velocedge(a)hotmail.com> wrote >>> I need to make a modification to a service written in VB6 that modifies >>> and then executes a .bat file. This runs fine when it's run from the >>> command line, but when I start it as a service, it creates the .bat file >>> but doesn't run it. I'm sure there's some sort of a permissions issue >>> with the account the service is running under but I've tried the local >>> system account as well as the administrator's account and there is no >>> difference. >>> Can someone tell me what I need to do in order to run a .bat file from a >>> service? >> >> What does the batch file do? Are there any commands which prompt the user >> in any way? If so, I can see how this may not run from a service unless >> the "allow to interact with desktop" option , or whatever it's called, is >> enabled. >> But if the program is writing this batch file, why can't it just perform >> the same tasks? > > I was wondering about that too, do you use a batch file for speed, or > could you replace it with a VB program?
From: Steve Ricketts on 21 Dec 2009 10:28
There are no GUI elements in this service. I am actually sending the command to execute the .bat file and its location, which changes every time, via a TCP connection from another program. sr "Nobody" <nobody(a)nobody.com> wrote in message news:##vrv9hgKHA.1540(a)TK2MSFTNGP06.phx.gbl... > "MikeD" <nobody(a)nowhere.edu> wrote in message > news:eh7amZegKHA.5568(a)TK2MSFTNGP02.phx.gbl... >> What does the batch file do? Are there any commands which prompt the user >> in any way? If so, I can see how this may not run from a service unless >> the "allow to interact with desktop" option , or whatever it's called, is >> enabled. > > One of the changes in Vista and after is that services run in their own > session for security reasons, called session 0, which is non interactive, > so you can't show a GUI to control the service, nor use things like > FindWindow/EnumWindows/SendMessage/PostMessage to talk to the service from > a GUI app. If you need to make software that configures a service, you > have to make a second EXE and communicate with the service using some > mechanism, such as named pipes, winsock, or the registry. > > See this article: > > Application Compatibility: Session 0 Isolation > http://msdn.microsoft.com/en-us/library/bb756986.aspx > > This is what Session 0 Isolation is trying to prevent(Look for "WM_TIMER" > and "Session 0"): > > http://en.wikipedia.org/wiki/Shatter_attack > > |