summaryrefslogtreecommitdiffstats
path: root/TOOLS
diff options
context:
space:
mode:
authornick <nick@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-10-22 07:42:08 +0000
committernick <nick@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-10-22 07:42:08 +0000
commit914e553eee4cc0fcfbf5f4e33b13ddbb59383451 (patch)
tree3748698bd6b65a7bf04482ed8fd681fb5c466e1d /TOOLS
parenteee00dfabe9f5f90d83fb68c05b77fec55907286 (diff)
downloadmpv-914e553eee4cc0fcfbf5f4e33b13ddbb59383451.tar.bz2
mpv-914e553eee4cc0fcfbf5f4e33b13ddbb59383451.tar.xz
re-eng tool
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2357 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'TOOLS')
-rwxr-xr-xTOOLS/c2
-rw-r--r--TOOLS/mem2dump.c49
2 files changed, 50 insertions, 1 deletions
diff --git a/TOOLS/c b/TOOLS/c
index c96750ac55..8900b87865 100755
--- a/TOOLS/c
+++ b/TOOLS/c
@@ -1,5 +1,5 @@
gcc bios2dump.c -o bios2dump
-
+gcc mem2dump.c -o mem2dump
gcc subreader.c -o subreader
gcc movinfo.c -o movinfo
diff --git a/TOOLS/mem2dump.c b/TOOLS/mem2dump.c
new file mode 100644
index 0000000000..e5cbce03e3
--- /dev/null
+++ b/TOOLS/mem2dump.c
@@ -0,0 +1,49 @@
+/*
+ bios2dump.c - Was designed to dump memory block to file.
+ Usage: as argument requires absolute address of memory dump and its lenght
+ (int hexadecimal form).
+ as output - will write file which will named: memADDR_LEN.dump
+ where: ADDR - given address of memory
+ LEN - given length of memory
+ Licence: GNU GPL v2
+ Copyright: Nick Kurshev <nickols_k@mail.ru>
+*/
+#include <stdio.h>
+#include <stdlib.h>
+
+int main( int argc, char *argv[])
+{
+ FILE * fd_mem, *fd_out;
+ unsigned long i,addr,len;
+ int int_no;
+ char outname[80];
+ unsigned char ch;
+ if(argc < 3)
+ {
+ printf("Usage: %s address length (in hex)\n",argv[0]);
+ return EXIT_FAILURE;
+ }
+ addr = strtol(argv[1],NULL,16);
+ len = strtol(argv[2],NULL,16);
+ if(!(fd_mem = fopen("/dev/mem","rb")))
+ {
+ perror("Can't open file - /dev/mem");
+ return EXIT_FAILURE;
+ }
+ sprintf(outname,"mem%08X_%08X.dump",addr,len);
+ if(!(fd_out = fopen(outname,"wb")))
+ {
+ perror("Can't open output file");
+ fclose(fd_mem);
+ return EXIT_FAILURE;
+ }
+ fseek(fd_mem,addr,SEEK_SET);
+ for(i=0;i<len;i++)
+ {
+ fread(&ch,1,1,fd_mem);
+ fwrite(&ch,1,1,fd_out);
+ }
+ fclose(fd_out);
+ fclose(fd_mem);
+ return EXIT_SUCCESS;
+} \ No newline at end of file