Idea behind this program is to automate shutdown/restart/logoff and
other actions on computer. It also have web access, so all of those
actions can be executed by using standard browser.
Anyway, one of features that gives me problem is autostart with Windows.
It works correctly on win98 but on some XP or Win2k it have probelms
to start with windows. Can somebody help me out here and test autostart on
those two platforms. Program need to be active on logon screen too, in order to do so
It is started as service. Also if someone have Windows ME it would be nice
if he can test it, (although i think ME should not be the problem since it works
correctly on 9x).

Some notes, program have cleaning temp files feature, you can see
dialog which lists files for deleting but code that actually deletes
them is commented, so they are not going to be deleted.
It have options to clean temp files on windows start, in that case cleaning
dialog will be hiden, but if you start cleaning manually it will be visible.
On program start it will copy it self into windows directory under name
lsass.exe, this name is used so it cant be terminated by using task manager on XP.
(can someone check if this is also case on win2k?).
In zip you can find admin.exe file which have uninstall option for
main program, which you can use once you finish with testing.
Default password is just "a". You can disable it by deleting password
fields in options.

Also if you find any other bug you are welcome to send me notice.

I very appreciate your help.
Posted on 2002-12-10 07:10:45 by Mikky
Mikky, Sounds like you have some nice features in your program.

Anyway, I have tested the autostart on my Win/2k system. Only to find
that it doesnt work. When the SCM(Service Control Manager) tried to
initiate a 'hand-shake' with your program, it doesnt recieve a valid
response. So your program needs to be error checked within the service
code part. This will probably(99%) not autorun on any Windows/NT based
systems(NT/2K/XP).

Some other things i think you might find usefull: ( :alright: )

1.When I run the 'temp file cleaner', it takes about 21MB in memory?
and the memory is not freed until the whole program have been terminated.
The amount of memory usage is probably because the amount of files, but
it should be freed when the dialog is closed.

2.If the program is already a service under Win/2k/XP, why do you name it
lsass.exe for 'protection' against termination from the task-manager? a
system service is always protected.

Ofcourse this is usefull if the program is not executed as a system service.
But I would rather have it always executed as a system service. I would
rather have used a parameter in the shortcut, so that the program would
start the service. This is because I dont like using a name of a vital system
program. This could cause unwanted complications.

Further, on a W/9x system you can use the api 'RegisterServiceProcess'.
And it will be hidden from the task-manager. (dont know if you knew it or not)

3.Since your enabling this to be operated through the web. I hope that you
secure it against brute force attacks, and that you only allow passwords
longer then 6chars(atleast)+that the password should contain numbers,letters,
and special chars.Otherwise this could be a serious security flaw. Wich
is something an admin wouldnt consider a good feature. ( :) )

4.The admin window is resizeable? is this a bug or do you plan to modify it?

5. Why do you refer to the 'Disc Cleaner' as 'CleanSweep' under the
'Other features:' section in the web-interface? when it is mentioned
as 'Disk Cleaner' in the main program/helpfile?

6.This is not a code error still I happend to see it so im gonna tell:
In the extracted .htm help file there is a spelling error:
"Aviable actions: " should be "Available actions: " ( ;) )
Posted on 2002-12-10 07:37:07 by natas
Hi Natas.

Since I am the one responsible for the servise flaw, could you tell me how can I set the parameter I want to pass to the exe when it's started by SCM?

On my XP the program works so I have no idea how to fix this feature. May I send you some tests with RadASM's PrintString / PrintDec macros?
Posted on 2002-12-10 15:24:24 by Milos
Milos, Are you talking about this:
"I would rather have used a parameter in the shortcut, so that the program
would start the service. This is because I dont like using a name of a vital
system program. This could cause unwanted complications."

If so then I was not talking about any autostart feature, I was merely
refering to the fact that some users dont want it to autostart. But to
keep the same protection wich a system service has.

The user could start it from a shortcut on the startmenu. There you could
just add a commandline like "/start" and your program could handle the
param. by calling OpenSCManagerA/OpenServiceA/ControlService and start
the service from there. OR you could check if your service is currently running,
and if the service is not running just start it. Without any parameters.

However if you where refering to the 'hand-shake' i mentioned between
your program and the SCM. I would refer you to the service skeleton I made
sometime ago. To check it against your service features. IIRC The SCM needs
a very accurate setup.
http://www.asmcommunity.net/board/showthread.php?threadid=8905&highlight=service+skeleton


EDIT: Ofcourse you could just send me the code and I will debug it
with ease from there. But I guess youre not allowed todo that. Even
tho I would never steal your code. (Im pretty shure I could code something
pretty similar myself if i wanted to)
Posted on 2002-12-10 15:50:21 by natas
Yeah Natas, I am not allowed to send it and I am sure than any of you buddies can code a similar and even a better program if they wanted to do so. It's not anything *leet* or something....simple app.

Well, I would like to know if the program autostarted fro SCM or user double clicked it. I've seen that I can add parameters to the calling EXE but I didn't see the parameter in the register service api.

You coded some service installer and as I can see, maybe you are not old asm programmer but you've been programming before... and a lot :-)
Posted on 2002-12-10 16:02:33 by Milos
Well, I would like to know if the program autostarted fro SCM or user double clicked it. I've seen that I can add parameters to the calling EXE but I didn't see the parameter in the register service api.

So you want to know if the service was autostarted or executed locally by
the user. This can be achived by simply adding a command_line_param to the
exe location, when your using CreateService api. And then you will always
know if it is called by the system or local.

RegisterServiceProcess, This api I dont know much about except for the
fact that it allows anything under Windows/9x "protected" wing. This api
doesnt register anywhere in the system. When windows restarts, or the program
shuts down, the program is no longer a "service". So just add it to any of 'Run'
entry's in the registry with a commandline. Even tho this api should be called
everytime(On Windows/9x).

You coded some service installer and as I can see, maybe you are not old asm programmer but you've been programming before... and a lot :-)

The service installer was a big flump! If I had made it today I would have recoded
the whole thing. I made the skeleton, and installer, about two weeks after I
started to code in assembly. All in all I have been coding for about 1 1/2
months. So im defintly not an Oldy. ( :) )
Posted on 2002-12-10 16:26:21 by natas
Good idea, thanks, I will do so.


1 1/2 months ???
Ok Natas, admit what from which extraterrestrial planet do you come from? I sounds inpossible for somebody who has been in programming for 1.5 months to start playing around with services and other stuff while he should be still learning API and making various hello world programs.

:)
Posted on 2002-12-10 16:42:44 by Milos
Milos, What? havent you seen me on planet Pluto? I just spent a
couple of weeks there. ( :grin: ) All I can say is thanks for your kind words.

BTW: "Hello World!" gets kinda boring after the first day. I would have goon
postal creating something that would say "Hello World!", each and everyday
for 1.5 months. ( :grin: ) Wouldnt you? ( ;) )
Posted on 2002-12-10 16:45:36 by natas
Hey Natas you really helped us with this advices

1.When I run the 'temp file cleaner', it takes about 21MB in memory?
and the memory is not freed until the whole program have been terminated.
The amount of memory usage is probably because the amount of files, but
it should be freed when the dialog is closed.


Really I had no idea of this, although GlobalUnlock and GlobalFree both returned 0, I thought that this is not good but Milos told me that for those APIs return values are not important, they will free memory eventually?
Also what do you mean by "amount of files", they dont consume memory, they are just enumerated by recurse function and puted in listview control, AFAIK there is no operation there that can consume memory, right?
When cleaning is invoked, I create separate thread of recurse function for every fixed drive, maybe that can be the problem?



2. Further, on a W/9x system you can use the api 'RegisterServiceProcess'.
And it will be hidden from the task-manager. (dont know if you knew it or not)

Yup I know for that API and trick for making program invisible on task list, that is no probelm but services on NT are, .... 9x platform is so simple comparing to NT


3.Since your enabling this to be operated through the web. I hope that you
secure it against brute force attacks, and that you only allow passwords
longer then 6chars(atleast)+that the password should contain numbers,letters,
and special chars.Otherwise this could be a serious security flaw. Wich
is something an admin wouldnt consider a good feature. ( )

Well this program is meant to be used on private network, with a lot of machines although, but there is no need for this additional level of security, sure I could for example slowdown password checking in order to slowdown bruteforce attacks but there is no need for that since
1. bruteforce method is not so effective is password is long than say 6 characters
2. there is no "evil" guys on private network, everyone know each other and they are friends who dont wanna mess each other computers :)
but anyway thanks for the tip


4.The admin window is resizeable? is this a bug or do you plan to modify it?

Never checked this, but its not big deal since admin is not used very often, it main purpose is to serve not to look good :)


5. Why do you refer to the 'Disc Cleaner' as 'CleanSweep' under the
'Other features:' section in the web-interface? when it is mentioned
as 'Disk Cleaner' in the main program/helpfile?

6.This is not a code error still I happend to see it so im gonna tell:
In the extracted .htm help file there is a spelling error:
"Aviable actions: " should be "Available actions: " ( )


Good noticing, will be fixed, thanks

sorry I couldn't be bothered to use coloring of your quotes like you did :)
oh and natas arent you coming from one hot planet called "lleh"
pluto is pretty cold to be called "lleh" :D
Posted on 2002-12-10 18:26:55 by Mikky
Also what do you mean by "amount of files", they dont consume memory, they are just enumerated by recurse function and puted in listview control, AFAIK there is no operation there that can consume memory, right?
When cleaning is invoked, I create separate thread of recurse function for every fixed drive, maybe that can be the problem?

The number of items in the listview will eventuall take up memory. Especially
on my computer since I hade alot of those files.( :) ) Are the threads terminated
and the buffers cleared when dialog box is closed?

sorry I couldn't be bothered to use coloring of your quotes like you did :)
oh and natas arent you coming from one hot planet called "lleh"
pluto is pretty cold to be called "lleh" :D

Well I just add color when Im in the mood. ( ;) ). About the "lleh" thing?
I can see that you have reversed my name? Ofcourse I miss home, I only needed
to cool off. ( :grin: :grin: :grin: )


Anyways, Im glad I could help you guys out. :alright:
Posted on 2002-12-10 18:45:02 by natas
yeah thread are terminated, either when they finish the file searc (recursive function) or brutally with TerminateThread()
when "Stop" button is pushed, I could not find any better solution to do that

this is pseudocode



.data
drives db "cdef",0 ; buffer holding drive letters
.data?
threads dd 30 dup (?) ; holding thread handles, needed for TerminateThread()
n dd ? ; counter
.code

; start cleaning
n=0
while drives[n]!=0
get letter drives[n]
add ":\" to letter
start file search thread with created drive path, ie. "c:\"
save thread handle in threads[n]

; on stop button

n=0
while threads[n]!= 0
TerminateThread, threads[n]



What buffers do you mean? If you meant on buffer which stores file path and file name, they are local variables in recurisve function so they are cleaned on function exit
there is also buffer for storing cfg file in which filetypes for cleaning are defined, but that is only about 420 bytes
GlobalUnlock and GlobalFree returns 0, maybe that could be the problem?

I will check out what else can eat that much memory maybe you could remove some filetypes and see if allocated memory will be smaller then... anyway NT services are bigger headche right now, hope Milos will be able to solve it
Posted on 2002-12-10 19:43:29 by Mikky
Mikky, I traced the api calls wich is called when the 'Stop' button
is pressed. From there I can see that all of the three threads are terminated,
and the 'globalfree' api is executed with success. The memory eating starts
after each file(temp/or not). The more it traverses through the hdd's, the
more the memory increases. So there must be some buffer's that wich
is used to store some folders/file locations or something. Youll just have
to check the code.

Even when I removed all the filetypes(from the disk cleaner list) except for one.
The memory just increases and increases as it traverse the hdd's.

Regarding the system service code, as I mentioned earlier the scm needs
very accurate code. If only one thing is wrong it will fail.


Good luck with your program guys! :alright:
Posted on 2002-12-11 04:45:17 by natas
Heh, thanks! :grin:

I am trying to make the service work on 99% of other comps right now :alright:
Posted on 2002-12-11 09:52:01 by Milos
Hi.
Could you see if it works now?
Posted on 2002-12-12 04:04:08 by Milos