flat assembler
Message board for the users of flat assembler.

Index > Windows > Help me save my hair! CreateProcess

Author
Thread Post new topic Reply to topic
Intrinsic



Joined: 03 Feb 2004
Posts: 13
Intrinsic 22 Feb 2004, 03:10
All it ever gives me is "Error: Invalid size of operand"

If i take out [FileName]/[CmdLine] and replace it with a NULL(s) the error goes away.
I've gone through any code i can find with CreateProcess but i just can't see what i'm doing wrong. I've been reading(yes i've searched these boards and google/iczelion's) and trying etc for half a day almost and it's now 3am so i though i'd post before i went to sleep and see if the fairy brings me anything in the morning. I am pretty new to Win32 mainly working with DOS so any help is appreciated. Chances are it's prolly something really simple knowing my luck and i just missed it :)

All i'm aiming todo is execute game.exe with some parameters but it's cause me more of a headache than i expected :)

Example snippet:
Code:
.
        invoke  CreateProcess,[FileName],[CmdLine],NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL,NULL,StartupInfo,PInfo

...

FileName        db      "game.exe",0         
CmdLine        db      "blah blah blah",0
    


So, any help appreciated, known working code that i can just modify a dream :)


Thanks in advance,
Intirnsic
Post 22 Feb 2004, 03:10
View user's profile Send private message Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1150
Location: Russian Federation
comrade 22 Feb 2004, 03:25
take off square brackets [] from FileName and CmdLine

_________________
comrade (comrade64@live.com; http://comrade.ownz.com/)
Post 22 Feb 2004, 03:25
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
Intrinsic



Joined: 03 Feb 2004
Posts: 13
Intrinsic 22 Feb 2004, 04:03
Well, it compiles now thanks( i thought i had tried that already but obviously not :). But crashes so i gotta fix that now :)

So when "push FileName" happens it puts the address onto the stack so i don't need the [ ] correct?

Thanks Comrade
Post 22 Feb 2004, 04:03
View user's profile Send private message Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1150
Location: Russian Federation
comrade 22 Feb 2004, 04:25
Yes, push FileName puts address of FileName on stack (equivalent to using OFFSET in MASM).
[FileName] is to get value of FileName, you would use that is FileName did not contain actual string, but contained pointer to that string

_________________
comrade (comrade64@live.com; http://comrade.ownz.com/)
Post 22 Feb 2004, 04:25
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
Intrinsic



Joined: 03 Feb 2004
Posts: 13
Intrinsic 22 Feb 2004, 15:58
Thanks Comrade, i assumed it would work like mov si, [Buffer] for example but different with pushes i guess :) i had only ever pushed registers before.
Post 22 Feb 2004, 15:58
View user's profile Send private message Reply with quote
Intrinsic



Joined: 03 Feb 2004
Posts: 13
Intrinsic 23 Feb 2004, 03:33
Well, WinExec suited what i wanted todo more so used that instead in the end :) and it's 10 billion times easier.
Post 23 Feb 2004, 03:33
View user's profile Send private message Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1150
Location: Russian Federation
comrade 23 Feb 2004, 04:02
WinExec is obsolete... If you are making a trainer, CreateProcess() already give you hProcess in PROCESSINFO structure.

_________________
comrade (comrade64@live.com; http://comrade.ownz.com/)
Post 23 Feb 2004, 04:02
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
Intrinsic



Joined: 03 Feb 2004
Posts: 13
Intrinsic 23 Feb 2004, 04:26
No not a trainer, just a launcher for a game that refused to work with CreateProcess, but WinExec worked 1st time. This is a game that can only be launched by a dll of a certain name so i created a fake one that bypasses the patch server so you can point it at different server.
Ie, the way it was being done was to rename cmd.exe to login.dll then you would call the real dll with login.dll /C game.dll [parameters]
But this wasn't much use to Win98 users, and as the original launcher was written in VB it required a load of OCXs to resolve IP addresses etc. So I set out to create one that would work for Win98 users and didn't require VBloat components etc.
So, atm it calls it fine now and you launch the game and logon to the server, but it still gives me "login.dll has encountered a problem and needs to close" so i need to get rid of that.

Edit: i will add that the problem message disappears after i exit the game, but it's still annoying anyways :)
Post 23 Feb 2004, 04:26
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
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
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.