Can't exec() a program that uses mem alloc?
From: Iain Staffell (staffell_at_blueyonder.co.uk)
Date: 12/05/03
- Next message: Mike Morton: "Re: [PHP] Apache 2 + PHP"
- Previous message: Marek Kilimajer: "Re: [PHP] count()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: php-general@lists.php.net Date: Fri, 5 Dec 2003 18:08:11 -0000
I am trying tooth and nail to create a method of copying a string of text to
the server's clipboard via php.
I have found a couple of short pieces of code to do exactly that in C, so
compiled the program and in a command prompt it works like a charm - in my
case it reads the contents of a text file and copies that to the clipboard.
I then try using a php script to execute that file using shell_exec(),
exec() and system() to no luck, every time the command:
$outpt = shell_exec("clipboard.exe") or die ("failed to execute");Would just
print out the die message.
I set about writing my own C program to copy the contents of the text file
first to the screen, and then to a char array which could then be passed to
the clipboard.
All of these self made programs could be executed by shell_exec() - so I
thought I was finally onto a winner. However it seems that I can't just pass
a char array to SetClipboardData - it has to be a block of Globally Movable
memory, which sadly I don't understand.
Is there any reason why PHP shell_exec() or other execution commands are
unable to run a program that tampers with memory? I can't say I understand..
The other question would be - how could I modify either of the exe files to
work with PHP?
Thankyou for your time and knowledge :)
clipper.php <-- php code for shell_exec commands. change which line is
commented to test the second method
clipboard.cpp <-- clipboard executable found from google, works in command
prompt but 'fails to execute' with PHP
clipper.cpp <-- clipboard executable I wrote, which doesn't actually work,
but can be executed with PHP
- Next message: Mike Morton: "Re: [PHP] Apache 2 + PHP"
- Previous message: Marek Kilimajer: "Re: [PHP] count()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|