Search found 351 matches

by Cherry
Nov 12, 2012 16:36
Forum: Windows
Topic: Shell cmd problems.
Replies: 3
Views: 1014

Re: shell cmd problems

Shell(x) is equivalent to Exec(Environ("COMSPEC"), "/c " & x) I think. So Shell("cmd") will actually do Exec(Environ("COMSPEC"), "/c cmd") which is calling "c:\windows\system32\cmd.exe /c cmd", so it's actually running two cmd instances...
by Cherry
Nov 12, 2012 16:31
Forum: Windows
Topic: Strange must be magic ;-)
Replies: 8
Views: 1159

Re: Strange must be magic ;-)

Since you didn't show the source code I can also make suggestions. The difference between running ".\mdi.exe" from a batch file and double-clicking mdi.exe in the explorer is the 0th parameter. If you put "MessageBox(NULL, Command(0), NULL, 0)" somewhere in your program, you will...
by Cherry
Oct 07, 2012 15:28
Forum: Beginners
Topic: Exepath
Replies: 6
Views: 485

Re: Exepath

Why don't you use Exec for this purpose?

Code: Select all

Exec(ExePath() & "\7za.exe", "x -oc:\unpacked\ " & Command())


Syntax is "Exec(Program, Parameters)".
by Cherry
Sep 21, 2012 5:01
Forum: General
Topic: setENVIRON variables not sticking on exit
Replies: 114
Views: 6902

Re: setENVIRON variables not sticking on exit

No, cmd.exe itself is a 64-bit process on a 64-bit machine, you cannot change this from your side. Your .exe files are always "installed as an 32-bit app" since FBC cannot produce 64-bit code anyway (yet).
by Cherry
Sep 03, 2012 22:25
Forum: General
Topic: setENVIRON variables not sticking on exit
Replies: 114
Views: 6902

Re: setENVIRON variables not sticking on exit

I assume that cmd.exe is running as a 64-bit process (I don't have a 64-bit environment here), in this case it won't work I am afraid. My method is using code injection on a 32-bit basis.
by Cherry
Aug 26, 2012 16:22
Forum: General
Topic: Get subsystem via #
Replies: 3
Views: 208

Re: Get subsystem via #

If you are using window, you could use "If GetConsoleWindow() Then" to find out whether a console window of your program exists. You should then store a flag in a shared variable and only check for the window on startup, in order to avoid calling the GetConsoleWIndow function every time yo...
by Cherry
Aug 20, 2012 20:40
Forum: Windows
Topic: [SOLVED] Alternatives to build GUI apps?
Replies: 3
Views: 836

Re: Alternatives to build GUI apps?

You can use FbEdit as IDE. FbEdit has an integrated dialog designer. You would still use WinAPI, but you can design the dialog by point and click. :)
by Cherry
Aug 12, 2012 1:12
Forum: General
Topic: Squares
Replies: 6586
Views: 372966

Re: Squares

Yeah, the point is that it works even though it shouldn't. In your case there is no problem, though, because the variable is only a simple integer and always initialized with either 0 or 1. But in the cases I showed, it leads to uninitialized variables or crashes (in the case of the uninitialized va...
by Cherry
Aug 11, 2012 23:47
Forum: General
Topic: Squares
Replies: 6586
Views: 372966

Re: Squares

if sgn(y)=1 or sgn(y)=0 then var k=0 else k=1 This is a very interesting line. In fact, what's interesting for me is the part "then var k=0 else k=1" - actually it shouldn't compile, but it does! If you split it into multiple lines, it doesn't compile, as expected, since "k" is ...
by Cherry
Aug 11, 2012 14:26
Forum: General
Topic: Squares
Replies: 6586
Views: 372966

Re: Squares

Print Sgn(Abs(CInt(&h80000000))) Sleep What is the output of this program going to look like? "1", one would probably think. You are wrong, it's "-1". But mind you, this is not a bug. It's merely a result of how signed integers work. The absolute value of a number with only ...
by Cherry
Jul 27, 2012 1:43
Forum: Projects
Topic: Another CrackMe program
Replies: 0
Views: 401

Another CrackMe program

Today I discovered this program by AndT: http://www.freebasic.net/forum/viewtopic.php?f=7&t=17488 I have made something similar. However, it's a bit more tricky. It's also a hacking game. Goal here is to crash the server (get to the "FATAL EXCEPTION" output). Rules: 1) Reading the code...
by Cherry
Jul 27, 2012 1:00
Forum: Tips and Tricks
Topic: Who can hack this? (Don't modify the code :p)
Replies: 6
Views: 2778

Re: Who can hack this? (Don't modify the code :p)

1) Press 1 to log in 2) Log in as Default, password CriticalDamage 3) Press 3 to open the console 4) Enter "copy restriction.System" to get restriction level 10 (man, THAT'S what I call a "local privilege escalation security hole"!!!) 5) Enter "change login.Default" and...
by Cherry
Jul 27, 2012 0:22
Forum: General
Topic: setENVIRON variables not sticking on exit
Replies: 114
Views: 6902

Re: setENVIRON variables not sticking on exit

Yes we know that NULL is defined as 0. I was asking why asking for the pointer to an empty string would return a null pointer and not a pointer to a null byte, as these two are different (and also handled different by some API functions, as explained before). Example: FindWindow("tooltips_class...
by Cherry
Jul 25, 2012 13:40
Forum: General
Topic: setENVIRON variables not sticking on exit
Replies: 114
Views: 6902

Re: setENVIRON variables not sticking on exit

By the way, why returns StrPtr("") (or @"") NULL at all? Actually, it should return a pointer to a NULL byte (like @Type<UByte>(0) does)- I had problems in several cases where API function would behave differently if passed NULL as opposed to an empty string (e.g. FindWindow), so...
by Cherry
Jul 24, 2012 13:27
Forum: General
Topic: setENVIRON variables not sticking on exit
Replies: 114
Views: 6902

Re: setENVIRON variables not sticking on exit

ZString Ptr means its a pointer to a zero-terminated string. If you pass a normal String, I think FreeBasic puts an implicit StrPtr(...) around it so it works, but it also allows you to pass NULL. StrPtr("") returns NULL so that's why "" does the same as NULL here. If you want to...

Go to advanced search