Jump to content

vektorboson

Member
  • Content Count

    1009
  • Joined

  • Last visited

  • Medals

Everything posted by vektorboson

  1. @Kegeyts Hope you release your version soon, with sourcecode of course  Is there any possibilty to "pump" keystrokes (aka "Putkey")?
  2. I don't know whether I'll call it anytime final; it's btw. open source, so anyone can develop it further. And yes, I am expanding it (and changed a bit). I've included a simple Isrunning-query "\:isrunning". It won't trigger a "cannot open file"-message in OFP, if the DLL is not loaded I don't know? I don't have the ressources to test it in MP, so others are in charge to make it eventually MP compatible. As for the Linux server: I've got a system call hooking module (from a Kernel module tutorial), that loads into the Kernel and intercepts every file-open-query from the Server (and any other application). But the problem is, that this module is in Kernel space and therefore will crash the whole system, if the module crashes. The other problem is, that any applications on the system will be intercepted and this can lead to undesired/unknown effects, and possible performance problems. I'd rather hope that BIS compiles the Linux-server with a dynamically binded Glibc. BIS could release two versions: One with static glibc and one with a dynamically binded glibc. But as I don't do MP, it's up to those who do MP, to ask BIS about it.
  3. Is this the 'Windows Clock' solution? Yes, it's the "\:time" command. Just look into the README, how to use it!
  4. vektorboson

    Exec Script after reloading

    I read that OFP resets the time-variable to 0 when you reload the mission. So make a script like this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ~1 @time < 1 ; reset all the stuff ... ...
  5. Allrighty, here is my version of Kegetys TestDLL (I didn't change the filenames...) Please read the README.txt. Functions reference: "\:version:" Â returns version string "\:time:" Â returns your local time "\<sometext" Â appends "sometext" to log.txt in the OFP directory "\|test.txt:sometext" appends "sometext" to test.txt in the OFP directory "\|test.txt?sometext" clears test.txt and writes "sometext" "\*hello" Â returns a string containing an array of chars Ex.: stringarray = call loadfile "\*hello" stringarray will be ["h","e","l","l","o"] testdll.zip 1. REMEMBER: Use it at your own risk. 2. Many credits to Kegetys for the initial DLL and of course DBR_ONIX for his inspiration 3. You need Dev-C++ to compile the source code. (But you don't need to compile it, as there is a precompiled DLL in the zip).
  6. Short answer: Yes. Long answer: yes. @salisan Fuse seems like a lot of overhead for what we want to do. Syscall-Hooking should suffice, as Fuse intercepts syscalls itself (at least I think so).
  7. The OFP server binary has glibc statically linked so the method you described propably does not work... Already thought something like that... Â And I'm not going to implement that kernel hook; it involves writing a kernel module that changes the syscall-table (at least in a document I found, which was for Kernel 2.0.x). Look at http://packetstormsecurity.nl/docs/hack/LKM_HACKING.html Probably you have to change something for Kernel 2.4.x or 2.6.x
  8. ... AND it isn't triggered by OFP's file access, as I already said, that OFP doesn't update the Last Access time stamp... And that .NET-class doesn't anything you could not do with the WinAPI. Kegetys injection hook is by far superior. My DLL can log/write text into files and it can create and overwrite files. It can, like Kegetys has done it, convert strings into arrays of strings, and I am looking into it being expandable through DLLs. Btw.: Has anyone tried that Linux hook? I'd be interested if it works out.
  9. Hooking test under Linux Ok, I've found how API-hooking is done under Linux. But as I don't manage to get an OFP Linux server running on my box, I ask, if someone could try it for me. Take this file: hook.c or from here: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> // hook.c #include <dlfcn.h> typedef void* (*fopenFunc)(const char* fn, const char* mode); typedef int (*openFunc)(const char *fn, int flags, void* arg); static int libraryloaded = 0; static void *handle; static fopenFunc orig_fopen; static openFunc orig_open; void initLibC() {  handle = dlopen("/lib/libc.so.6", RTLD_LAZY);  printf("loading libc\n");  if (handle)  {   orig_fopen = (fopenFunc)dlsym(handle,"fopen");   orig_open = (openFunc)dlsym(handle,"open");   libraryloaded = 1;  } } void* fopen( const char* fn, const char* mode ) {  if(!libraryloaded)   initLibC();  printf("using fopen with: %s\n", fn);  if(orig_fopen)  {   return orig_fopen(fn, mode);  }  else  {   return (void*)0;  } } int open( const char* fn, int flags, void *arg ) {  if(!libraryloaded)   initLibC();  printf("Using open with: %s\n", fn);  if(orig_open)  {   return orig_open(fn, flags, arg);  }  else  {   return 0;  } } (eventually you have to adjust the "/lib/libc.so.6") and compile it with <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> gcc -shared -fPIC hook.c -o libhook.so -ldl copy the libhook.so in your OFP-server directory (or somewhere else) let's assume the OFP-server is in /home/ofp/ and in the same directory there is the libhook.so, then open the console and type export LD_PRELOAD=/home/ofp/libhook.so (or whatever the export-command is in your shell). From the same console (IMPORTANT!) start the ofp-server. You should get some messages when OFP opens files, like "using open with bla.sqs". If not, there are two possibilities: Output goes into a file or /dev/null. Either look into the file (log???) or change the line where /dev/null occurs. The second possibilty is, that the server uses kernel calls instead of LibC-functions. This'd be bad, as we had to hook kernel calls which doesn't seem to be a trivial case... EDIT: open function signature was adjusted to fit fcntl.h
  10. Hopefully someone can confirm this. I created a log-function, I can call with i.e. loadFile "\<Log some stuff" looking in the Log-File I found, that the same string was written twice. In my other logs it seems as if OFP accesses scripts twice. One time for checking whether it exists, and another time to read it. Therefore you should define a static bool to check whether the handleCommand (or whatever function you use) was called for the first time or for the second time. Only calculate and return your stuff, when OFP calls your function the second time. Otherwise you're doing the same work twice.
  11. Make sure that in chandler.cpp is #include <stdio.h> Then in the function HandleCommand(char *command) write <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> HANDLE HandleCommand(char* command) { Â File *fp; Â fp = fopen( "path_to_your_file", "w"); Â if (fp != NULL) Â { Â Â fprintf(fp, "%s", command); Â Â fclose(fp); Â } ... ... ... } Where the dots stand there should be code for creating a file and returning it to OFP (you can use the code, Kegetys has written). You could change the code to return an empty file. The code I've shown you, uses the standard C library; you could use also the WinAPI functions, though I have little knowledge of them.
  12. Well, if there's no other possibility, you could just compile your personal glibc (unless BIS decided to link it statically). And if this doesn't work, you can intercept all Kernel calls... Nice feature of Linux being Open Source Â
  13. @DBR_ONIX It does work, you have to start OFP first, then execute the hook-exe. Then you execute the function with <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> foo = call loadFile ":bleh"; hint format["%1", foo] It should give you then an array like ["b","l","e","h"] Btw. thanks to Kegetys, I looked yesterday at the codeguru site, but with my lack of Win32-programming I didn't try that example. It's also probably the ugliest code I've seen (that's WinAPI of course  ) I got it to work with Dev-C++, if someone's interested (though it was a bitch because of the VisualC stuff). I have optimized the testdll a bit; mine version is called with "\:string"; because of the backslash, lpFileName will be  ":string" only, thus a very easy switch/case on the first character is enough. No memcpy needed. I'll use probably ':', '?' and '*' as a prefix (what other characters are unallowed in the file system?), I've got already some applications in mind. Another OFP-limitation gone (and a lot of new scripting possibilities opened!)
  14. I think it does (actually this is something done by OS, which can be hardly prevented). However the file may be cached internally, meaning it can be accessed only for the first time you use it. Even if it is cached, the time stamp should have been updated by the first read. Of course it's not your duty to update the last access time stamp, it should be the OS. This shows how hard it can be to prevent OS from modifing access time. In this case it's not the OS, but Explorer (or the file information dialog) And in this case, we just query the meta information, we don't read the file! This sounds viable to me - interesting idea. It could be quite difficult to implement it for some of us, but for someone who created DXDLL it should be a child's play. Errrm, you could just add a new scripting function to the OFP source code. This would be quite the simpliest solution me thinks  You don't need to find hacks for OFP!  --- Regarding the DLL-hook, one thing I read was, that you need to "inject" your replacement function into the OFP-process, and this means writing in OFP application memory (doesn't this trigger FADE?). And how does DXDLL work? There is a DLL, which says OFP, look, here's DirectX, use me? So, could I just make a kernel32.dll with one overridden fileread-function, or is this much much more work (lots of WinAPI and Assembler?) ?
  15. Seems as if OFP doesn't update the file access time stamp of scripts it reads @General You probably checked the last access time stamp with right click/properties? Well, Microsoft's smart programmers thought that this is actually an access, thus making the right click/properties the last access
  16. Thanks @General Barron! -- PBOs are indeed opened once at startup and only writable when OFP is closed, thus cannot be changed while the game runs. -- When I get home, I'm gonna try to write such a monitoring program myself; this could indeed open a hell lot of new applications, if this actually works. Only limitation is, that OFP then can send only one "bit" (accessing one file).
  17. It would work. You can load images/textures with setObjectTexture and with ctrlText (set images in dialogs). Those images/textures can be placed somewhere in the OFP-directory-tree and are accessible through OFP; you can even update them while running OFP! It should be possible through the WinAPI; the "File last read"-meta information should be updated when OFP accesses a script, thus you would just check if that date/time changed.
  18. vektorboson

    Campaign weapon pool

    Argh, where's my head! <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ?(_i>= count _soldiers) : goto "pool" The "-1" was false, as I'm checking at the beginning of the loop! My bad.
  19. vektorboson

    Campaign weapon pool

    I see the problem now, it's in the init.sqs: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> #EndSoldiers ?(_i >= _count): goto "pool" deletevehicle (_soldiers select _i) _i = _i + 1 goto "EndSoldiers" The problem here is, that _count is the same as SOLDIERS_ALIVE; therefore when this part is entered, _i is SOLDIERS_ALIVE-1, thus deleting only one of the dead squad mates. Change it to <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> #EndSoldiers ?(_i >= (count _soldiers) -1 ): goto "pool" deletevehicle (_soldiers select _i) _i = _i + 1 goto "EndSoldiers" Hopefully this will work then!
  20. vektorboson

    Campaign weapon pool

    You could post your init.sqs and exit.sqs; and then I'd need to know what the condition of presence (in the unit dialog in the mission editor) of your units is. Basically it is possible that you load/save the wrong status/variables or a status from a previous mission.
  21. vektorboson

    How to kill only infantry units

    They all come back, they all do. Â
  22. vektorboson

    How to kill only infantry units

    You can check whether infantry is not inside a vehicle and then kill it: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ? vehicle _unit == _unit: _unit setDammage 1.0
  23. vektorboson

    "Sorry for my bad english!"

    You can can a can. That is a correct english sentence; the first can is an auxiliary, the second can is a verb and third one is a noun. And everyone sounds exactly the same. Opposed to many others in here, I love the german language. I think it is really beautiful and very expressive. To add to the difficult/easy to learn languages: I heard that languages based only on rules are harder to learn than languages with lots of exceptions; it was some kind of how the brain works. I didn't like French in school, though Â
  24. vektorboson

    Campaign weapon pool

    You can take a look at my weaponpool tutorial; basically it takes care of saving variables and player's status and of course the weapon pool for the next mission. My Tutorial at OFPEC
  25. vektorboson

    Best Space simulation?

    I like VegaStrike! It's a free/open source space shooter, quite similar to Privateer (there's even a Privateer Mod for it!)
×