]> cvs.zerfleddert.de Git - proxmark3-svn/commitdiff
rework of GetFromBigBuf() (#597)
authorpwpiwi <pwpiwi@users.noreply.github.com>
Tue, 8 May 2018 05:54:49 +0000 (07:54 +0200)
committerGitHub <noreply@github.com>
Tue, 8 May 2018 05:54:49 +0000 (07:54 +0200)
* this should fix crashes reported in issue #497
* don't allow receiver thread to write directly into arbitrary main thread's memory
* instead use cmdBuffer[] for CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K as well
* add timeout and warning options to GetFromBigBuf(), same as in WaitForResponseTimeoutW()
* move GetFromBigBuf() from data.c to comms.c
* remove data.c and data.h

27 files changed:
client/Makefile
client/cmddata.c
client/cmdhf.c
client/cmdhf14a.c
client/cmdhf14b.c
client/cmdhf15.c
client/cmdhficlass.c
client/cmdhflegic.c
client/cmdhflist.c
client/cmdhfmfu.c
client/cmdhw.c
client/cmdlf.c
client/cmdlfcotag.c
client/cmdlfem4x.c
client/cmdlfhitag.c
client/cmdlfio.c
client/cmdlft55xx.c
client/cmdlfti.c
client/cmdmain.c
client/cmdscript.c
client/comms.c
client/comms.h
client/data.c [deleted file]
client/data.h [deleted file]
client/mifarehost.h
client/util.c
client/util.h

index 883f3b6f04353191f0a4c108752c436c942490f6..d4ac33b296658c037935f4c265786946ca8b601d 100644 (file)
@@ -105,7 +105,6 @@ CMDSRCS =   crapto1/crapto1.c\
                        crc64.c \
                        iso14443crc.c \
                        iso15693tools.c \
-                       data.c \
                        graph.c \
                        ui.c \
                        cmddata.c \
index 9bfe58f9652fe3ca41a2ceed16e3645aeb95d58a..471665b75cc3cfa1edb7431ccdabf6802b664426 100644 (file)
@@ -12,7 +12,6 @@
 #include <string.h>   // also included in util.h
 #include <inttypes.h>
 #include <limits.h>   // for CmdNorm INT_MIN && INT_MAX
-#include "data.h"     // also included in util.h
 #include "cmddata.h"
 #include "util.h"
 #include "cmdmain.h"
@@ -591,8 +590,7 @@ int CmdBitsamples(const char *Cmd)
        int cnt = 0;
        uint8_t got[12288];
 
-       GetFromBigBuf(got,sizeof(got),0);
-       WaitForResponse(CMD_ACK,NULL);
+       GetFromBigBuf(got, sizeof(got), 0 , NULL, -1, false);
 
                for (int j = 0; j < sizeof(got); j++) {
                        for (int k = 0; k < 8; k++) {
@@ -1131,8 +1129,7 @@ int CmdHexsamples(const char *Cmd)
                return 0;
        }
 
-       GetFromBigBuf(got,requested,offset);
-       WaitForResponse(CMD_ACK,NULL);
+       GetFromBigBuf(got, requested, offset, NULL, -1, false);
 
        i = 0;
        for (j = 0; j < requested; j++) {
@@ -1200,10 +1197,9 @@ int getSamples(int n, bool silent)
                n = sizeof(got);
 
        if (!silent) PrintAndLog("Reading %d bytes from device memory\n", n);
-       GetFromBigBuf(got,n,0);
-       if (!silent) PrintAndLog("Data fetched");
        UsbCommand response;
-       WaitForResponse(CMD_ACK, &response);
+       GetFromBigBuf(got, n, 0, &response, -1, false);
+       if (!silent) PrintAndLog("Data fetched");
        uint8_t bits_per_sample = 8;
 
        //Old devices without this feature would send 0 at arg[0]
index 82313ae0cae0da63341566c68055f117426f02c5..4a672255278a74d70062795c64dbc774d9af52d2 100644 (file)
@@ -14,7 +14,6 @@
 #include <string.h>
 #include "proxmark3.h"
 #include "util.h"
-#include "data.h"
 #include "ui.h"
 #include "iso14443crc.h"
 #include "parity.h"
@@ -497,8 +496,7 @@ int CmdHFList(const char *Cmd)
                trace = malloc(USB_CMD_DATA_SIZE);
                // Query for the size of the trace
                UsbCommand response;
-               GetFromBigBuf(trace, USB_CMD_DATA_SIZE, 0);
-               WaitForResponse(CMD_ACK, &response);
+               GetFromBigBuf(trace, USB_CMD_DATA_SIZE, 0, &response, -1, false);
                traceLen = response.arg[2];
                if (traceLen > USB_CMD_DATA_SIZE) {
                        uint8_t *p = realloc(trace, traceLen);
@@ -508,8 +506,7 @@ int CmdHFList(const char *Cmd)
                                return 2;
                        }
                        trace = p;
-                       GetFromBigBuf(trace, traceLen, 0);
-                       WaitForResponse(CMD_ACK, NULL);
+                       GetFromBigBuf(trace, traceLen, 0, NULL, -1, false);
                }
        }
 
index 480923d663a91f3de77531b67f2b5ddac4fcb2b9..4684ae290cca2989142c4112cabd516ed2b3dafb 100644 (file)
@@ -20,7 +20,6 @@
 #include "util.h"
 #include "util_posix.h"
 #include "iso14443crc.h"
-#include "data.h"
 #include "proxmark3.h"
 #include "ui.h"
 #include "cmdparser.h"
index 36932cbd31d887f252afc29852a883706ef2e9c7..bae40c09133d70460ebc564675586289cab6eab7 100644 (file)
@@ -15,7 +15,6 @@
 #include <stdint.h>
 #include "iso14443crc.h"
 #include "proxmark3.h"
-#include "data.h"
 #include "graph.h"
 #include "util.h"
 #include "ui.h"
index 8ddbea89bbab5cf8034ead823a6f6a2ea9c10f34..570a042035c9dfb978021e91c2c7f98416c3b9ce 100644 (file)
@@ -28,7 +28,6 @@
 #include <stdint.h>
 
 #include "proxmark3.h"
-#include "data.h"
 #include "graph.h"
 #include "ui.h"
 #include "util.h"
index d42f7eef6badf6d3d53dd21de7d81ec1f50e2e3b..e99c328592e9375846ca2d3b1fe0699f3405fb12 100644 (file)
@@ -16,7 +16,6 @@
 #include <sys/stat.h>
 #include <ctype.h>
 #include "iso14443crc.h" // Can also be used for iClass, using 0xE012 as CRC-type
-#include "data.h"
 #include "proxmark3.h"
 #include "ui.h"
 #include "cmdparser.h"
@@ -750,8 +749,7 @@ int CmdHFiClassReader_Dump(const char *Cmd) {
                blocksRead = (sizeof(tag_data)/8) - blockno;
        }
        // response ok - now get bigbuf content of the dump
-       GetFromBigBuf(tag_data+(blockno*8), blocksRead*8, startindex);
-       WaitForResponse(CMD_ACK,NULL);
+       GetFromBigBuf(tag_data+(blockno*8), blocksRead*8, startindex, NULL, -1, false);
        size_t gotBytes = blocksRead*8 + blockno*8;
 
        // try AA2
@@ -793,8 +791,7 @@ int CmdHFiClassReader_Dump(const char *Cmd) {
                                blocksRead = (sizeof(tag_data) - gotBytes)/8;
                        }
                        // get dumped data from bigbuf
-                       GetFromBigBuf(tag_data+gotBytes, blocksRead*8, startindex);
-                       WaitForResponse(CMD_ACK,NULL);
+                       GetFromBigBuf(tag_data+gotBytes, blocksRead*8, startindex, NULL, -1, false);
 
                        gotBytes += blocksRead*8;                       
                } else { //field is still on - turn it off...
index c9f3485e10c16aa192218518b5618c680689f758..9c9613aea3dd8b72b07d856892bc54ca4e7e2c97 100644 (file)
@@ -12,7 +12,6 @@
 #include <string.h>
 #include <inttypes.h>
 #include "proxmark3.h"
-#include "data.h"
 #include "ui.h"
 #include "cmdparser.h"
 #include "cmdhflegic.h"
@@ -64,8 +63,7 @@ int CmdLegicDecode(const char *Cmd)
   char token_type[4];
   
   // copy data from proxmark into buffer
-   GetFromBigBuf(data_buf,sizeof(data_buf),0);
-   WaitForResponse(CMD_ACK,NULL);
+   GetFromBigBuf(data_buf, sizeof(data_buf), 0, NULL, -1, false);
     
   // Output CDF System area (9 bytes) plus remaining header area (12 bytes)
   
@@ -294,8 +292,7 @@ int CmdLegicSave(const char *Cmd)
     return -1;
   }
 
-  GetFromBigBuf(got,requested,offset);
-  WaitForResponse(CMD_ACK,NULL);
+  GetFromBigBuf(got, requested, offset, NULL, -1, false);
 
   for (int j = 0; j < requested; j += 8) {
     fprintf(f, "%02x %02x %02x %02x %02x %02x %02x %02x\n",
index cf69abbaacf3b52ea965300d98783899c4fa3856..c87aa23779724bbf4206afb231dc50f304558497 100644 (file)
@@ -16,7 +16,6 @@
 #include <stdint.h>
 #include <stdbool.h>
 #include "util.h"
-#include "data.h"
 #include "ui.h"
 #include "iso14443crc.h"
 #include "parity.h"
index 63c417289567815f5cf6c3967b400780eb21222a..ac76c8dd203aac283146de253ba402f1e4edc321 100644 (file)
@@ -22,7 +22,6 @@
 #include "mifare.h"
 #include "util.h"
 #include "protocols.h"
-#include "data.h"
 
 #define MAX_UL_BLOCKS      0x0f
 #define MAX_ULC_BLOCKS     0x2b
@@ -1325,8 +1324,7 @@ int CmdHF14AMfUDump(const char *Cmd){
                PrintAndLog("Data exceeded Buffer size!");
                bufferSize = sizeof(data);
        }
-       GetFromBigBuf(data, bufferSize, startindex);
-       WaitForResponse(CMD_ACK,NULL);
+       GetFromBigBuf(data, bufferSize, startindex, NULL, -1, false);
 
        Pages = bufferSize/4;
        // Load lock bytes.
index 8f7243ada217370ebdba44d39ed033d113547fb4..4ede122f0b522a4e7f069b2b33291af05684e8a9 100644 (file)
@@ -18,7 +18,6 @@
 #include "cmdhw.h"
 #include "cmdmain.h"
 #include "cmddata.h"
-#include "data.h"
 
 /* low-level hardware control */
 
@@ -429,13 +428,10 @@ int CmdVersion(const char *Cmd)
 
 int CmdStatus(const char *Cmd)
 {
-       uint8_t speed_test_buffer[USB_CMD_DATA_SIZE];
-       sample_buf = speed_test_buffer;
-
        clearCommandBuffer();
        UsbCommand c = {CMD_STATUS};
        SendCommand(&c);
-       if (!WaitForResponseTimeout(CMD_ACK,&c,1900)) {
+       if (!WaitForResponseTimeout(CMD_ACK, &c, 1900)) {
                PrintAndLog("Status command failed. USB Speed Test timed out");
        }
        return 0;
index 51e89581b74c7c906f7fc118a9c28b59e821b17d..285d377af8fb79d07432dc31795666565c73e543 100644 (file)
@@ -22,7 +22,6 @@
 #include "graph.h"       // for graph data
 #include "cmdparser.h"   // for getting cli commands included in cmdmain.h
 #include "cmdmain.h"     // for sending cmds to device
-#include "data.h"        // for GetFromBigBuf
 #include "cmddata.h"     // for `lf search`
 #include "cmdlfawid.h"   // for awid menu
 #include "cmdlfem4x.h"   // for em4x menu
index 6d035e8c71d4e529561b46f4f482d98327964009..ca163480595dd39f2c5e35633638035d0a3d2439 100644 (file)
@@ -13,7 +13,6 @@
 #include "proxmark3.h"
 #include "ui.h"
 #include "cmddata.h"
-#include "data.h"
 #include "cmdlfcotag.h"
 #include "lfdemod.h"
 #include "usb_cmd.h"
@@ -99,10 +98,9 @@ int CmdCOTAGRead(const char *Cmd) {
                        getSamples(0, true); break;
                }
                case 1: {
-                       GetFromBigBuf(DemodBuffer, COTAG_BITS, 0);
-                       DemodBufferLen = COTAG_BITS;
                        UsbCommand response;
-                       if ( !WaitForResponseTimeout(CMD_ACK, &response, 1000) ) {
+                       DemodBufferLen = COTAG_BITS;
+                       if (!GetFromBigBuf(DemodBuffer, COTAG_BITS, 0, &response, 1000, true)) {
                                PrintAndLog("timeout while waiting for reply.");
                                return -1;
                        }
index 6d562be0ecfab320c14d5e0e14e05da8371e9287..ff2ae5b0f527d3532167f3bf15e9106859bfded7 100644 (file)
@@ -15,7 +15,6 @@
 #include "proxmark3.h"
 #include "ui.h"
 #include "util.h"
-#include "data.h"
 #include "graph.h"
 #include "cmdparser.h"
 #include "cmddata.h"
@@ -804,8 +803,7 @@ int usage_lf_em_read(void) {
 bool downloadSamplesEM() {
        // 8 bit preamble + 32 bit word response (max clock (128) * 40bits = 5120 samples)
        uint8_t got[6000];
-       GetFromBigBuf(got, sizeof(got), 0);
-       if ( !WaitForResponseTimeout(CMD_ACK, NULL, 4000) ) {
+       if (!GetFromBigBuf(got, sizeof(got), 0, NULL, 4000, true)) {
                PrintAndLog("command execution time out");
                return false;
        }
index 73c02a1409a41b0526b9fbef9bc02bfe35c8fb1e..26ba92385dbba4e904ae4d20cba0cda8af2f8fff 100644 (file)
@@ -11,7 +11,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include "data.h"
 #include "proxmark3.h"
 #include "ui.h"
 #include "cmdparser.h"
@@ -34,8 +33,7 @@ int CmdLFHitagList(const char *Cmd)
 
        // Query for the actual size of the trace
        UsbCommand response;
-       GetFromBigBuf(got, USB_CMD_DATA_SIZE, 0);
-       WaitForResponse(CMD_ACK, &response);
+       GetFromBigBuf(got, USB_CMD_DATA_SIZE, 0, &response, -1, false);
        uint16_t traceLen = response.arg[2];
        if (traceLen > USB_CMD_DATA_SIZE) {
                uint8_t *p = realloc(got, traceLen);
@@ -45,8 +43,7 @@ int CmdLFHitagList(const char *Cmd)
                        return 2;
                }
                got = p;
-               GetFromBigBuf(got, traceLen, 0);
-               WaitForResponse(CMD_ACK,NULL);
+               GetFromBigBuf(got, traceLen, 0, NULL, -1, false);
        }
        
        PrintAndLog("recorded activity (TraceLen = %d bytes):");
index 4ccd55384f247ab4fb42aec716941751e075a9b4..f2f2df06989898d6e91eee6752d82bca5aaba5f1 100644 (file)
@@ -15,7 +15,6 @@
 #include <limits.h>
 #include "cmdlfio.h"
 #include "proxmark3.h"
-#include "data.h"
 #include "graph.h"
 #include "ui.h"
 #include "cmdparser.h"
index c5a6dd3f64623ed304c2487b50ae0238dedb7602..a9fbb71ec56d4ed48cabb8e075464447bd1dda8d 100644 (file)
@@ -21,7 +21,6 @@
 #include "cmdlf.h"\r
 #include "cmdlft55xx.h"\r
 #include "util.h"\r
-#include "data.h"\r
 #include "lfdemod.h"\r
 #include "cmdhf14a.h" //for getTagInfo\r
 #include "protocols.h"\r
@@ -1355,8 +1354,7 @@ int CmdResetRead(const char *Cmd) {
        }\r
 \r
        uint8_t got[BIGBUF_SIZE-1];\r
-       GetFromBigBuf(got,sizeof(got),0);\r
-       WaitForResponse(CMD_ACK,NULL);\r
+       GetFromBigBuf(got, sizeof(got), 0, NULL, -1 , 0);\r
        setGraphBuf(got, sizeof(got));\r
        return 1;\r
 }\r
index 5dae9c0ecdd2901206743641124691dbb9d08353..7e0af94b00709b2e14cbf89de4d2cf74307e1b64 100644 (file)
@@ -8,16 +8,17 @@
 // Low frequency TI commands
 //-----------------------------------------------------------------------------
 
+#include "cmdlfti.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <inttypes.h>
 #include "crc16.h"
 #include "proxmark3.h"
-#include "data.h"
 #include "ui.h"
 #include "graph.h"
 #include "cmdparser.h"
-#include "cmdlfti.h"
+#include "util.h"
 
 static int CmdHelp(const char *Cmd);
 
index a45e343017172dd58cb4bc778f1086dfa176ffc9..c3b46145a1157ca0cb4788682c5fe11fb5d36cac 100644 (file)
@@ -17,7 +17,6 @@
 #include <string.h>
 #include "cmdparser.h"
 #include "proxmark3.h"
-#include "data.h"
 #include "usb_cmd.h"
 #include "ui.h"
 #include "cmdhf.h"
index 0d19f49697a4f47304eb4edc338a31be93ed7e9a..7b0e9000d6b66acfbff31790008d54c768f4aaa9 100644 (file)
@@ -17,7 +17,6 @@
 
 #include "proxmark3.h"
 #include "scripting.h"
-#include "data.h"
 #include "ui.h"
 #include "graph.h"
 #include "cmdparser.h"
index 97d58ef97a0abce055ac1af6a5a0fa7cfb71a305..b62f6fda47e3f94c796345e118ae052b27c323b5 100644 (file)
@@ -15,7 +15,6 @@
 #include "uart.h"
 #include "ui.h"
 #include "common.h"
-#include "data.h"
 #include "util_posix.h"
 
 // Declare globals.
@@ -173,6 +172,10 @@ int getCommand(UsbCommand* response)
 }
 
 
+//----------------------------------------------------------------------------------
+// Entry point into our code: called whenever we received a packet over USB.
+// Handle debug commands directly, store all other commands in circular buffer.
+//----------------------------------------------------------------------------------
 static void UsbCommandReceived(UsbCommand *UC)
 {
        switch(UC->cmd) {
@@ -191,13 +194,6 @@ static void UsbCommandReceived(UsbCommand *UC)
                        return;
                } break;
 
-               case CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K: {
-                       // FIXME: This does unsanitised copies into memory when we don't know
-                       // the size of the buffer.
-                       memcpy(sample_buf+(UC->arg[0]),UC->d.asBytes,UC->arg[1]);
-                       return;
-               } break;
-
                default:
                        storeCommand(UC);
                        break;
@@ -242,6 +238,58 @@ __attribute__((force_align_arg_pointer))
 }
 
 
+
+/**
+ * Data transfer from Proxmark to client. This method times out after
+ * ms_timeout milliseconds.
+ * @brief GetFromBigBuf
+ * @param dest Destination address for transfer
+ * @param bytes number of bytes to be transferred
+ * @param start_index offset into Proxmark3 BigBuf[]
+ * @param response struct to copy last command (CMD_ACK) into
+ * @param ms_timeout timeout in milliseconds
+ * @param show_warning display message after 2 seconds
+ * @return true if command was returned, otherwise false
+ */
+bool GetFromBigBuf(uint8_t *dest, int bytes, int start_index, UsbCommand *response, size_t ms_timeout, bool show_warning)
+{
+       UsbCommand c = {CMD_DOWNLOAD_RAW_ADC_SAMPLES_125K, {start_index, bytes, 0}};
+       SendCommand(&c);
+
+       uint64_t start_time = msclock();
+
+       UsbCommand resp;
+       if (response == NULL) {
+               response = &resp;
+       }
+
+       int bytes_completed = 0;
+       while(true) {
+               if (getCommand(response)) {
+                       if (response->cmd == CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K) {
+                               int copy_bytes = MIN(bytes - bytes_completed, response->arg[1]);
+                               memcpy(dest + response->arg[0], response->d.asBytes, copy_bytes);
+                               bytes_completed += copy_bytes;
+                       } else if (response->cmd == CMD_ACK) {
+                               return true;
+                       }
+               }
+
+               if (msclock() - start_time > ms_timeout) {
+                       break;
+               }
+
+               if (msclock() - start_time > 2000 && show_warning) {
+                       PrintAndLog("Waiting for a response from the proxmark...");
+                       PrintAndLog("You can cancel this operation by pressing the pm3 button");
+                       show_warning = false;
+               }
+       }
+
+       return false;
+}
+
+
 /**
  * Waits for a certain response type. This method waits for a maximum of
  * ms_timeout milliseconds for a specified response command.
@@ -249,7 +297,7 @@ __attribute__((force_align_arg_pointer))
  * @param cmd command to wait for, or CMD_UNKNOWN to take any command.
  * @param response struct to copy received command into.
  * @param ms_timeout
- * @param show_warning
+ * @param show_warning display message after 2 seconds
  * @return true if command was returned, otherwise false
  */
 bool WaitForResponseTimeoutW(uint32_t cmd, UsbCommand* response, size_t ms_timeout, bool show_warning) {
index 616f7ddbdddf15e1eb2d5f2740cf9f33a6cbd22a..111677ad78da385776d8ee1e3a12a62ee044f68a 100644 (file)
@@ -44,5 +44,6 @@ void clearCommandBuffer();
 bool WaitForResponseTimeoutW(uint32_t cmd, UsbCommand* response, size_t ms_timeout, bool show_warning);
 bool WaitForResponseTimeout(uint32_t cmd, UsbCommand* response, size_t ms_timeout);
 bool WaitForResponse(uint32_t cmd, UsbCommand* response);
+bool GetFromBigBuf(uint8_t *dest, int bytes, int start_index, UsbCommand *response, size_t ms_timeout, bool show_warning);
 
 #endif // COMMS_H_
diff --git a/client/data.c b/client/data.c
deleted file mode 100644 (file)
index 4d7d1e4..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (C) 2010 iZsh <izsh at fail0verflow.com>
-//
-// This code is licensed to you under the terms of the GNU GPL, version 2 or,
-// at your option, any later version. See the LICENSE.txt file for the text of
-// the license.
-//-----------------------------------------------------------------------------
-// Data utilities
-//-----------------------------------------------------------------------------
-
-#include <string.h>
-#include <stdint.h>
-#include "data.h"
-#include "ui.h"
-#include "proxmark3.h"
-#include "cmdmain.h"
-
-uint8_t* sample_buf;
-
-void GetFromBigBuf(uint8_t *dest, int bytes, int start_index)
-{
-  sample_buf = dest;
-  UsbCommand c = {CMD_DOWNLOAD_RAW_ADC_SAMPLES_125K, {start_index, bytes, 0}};
-  SendCommand(&c);
-}
diff --git a/client/data.h b/client/data.h
deleted file mode 100644 (file)
index 7d85e1f..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (C) 2010 iZsh <izsh at fail0verflow.com>
-//
-// This code is licensed to you under the terms of the GNU GPL, version 2 or,
-// at your option, any later version. See the LICENSE.txt file for the text of
-// the license.
-//-----------------------------------------------------------------------------
-// Data utilities
-//-----------------------------------------------------------------------------
-
-#ifndef DATA_H__
-#define DATA_H__
-
-#include <stdint.h>
-
-#define FILE_PATH_SIZE 1000
-
-extern uint8_t* sample_buf;
-#define arraylen(x) (sizeof(x)/sizeof((x)[0]))
-
-void GetFromBigBuf(uint8_t *dest, int bytes, int start_index);
-
-#endif
index 457a879fc853ea593213edd8c9d5ac86cae894ae..6a37fef1273b6ca5da7848178c115060dc5997a4 100644 (file)
@@ -13,8 +13,8 @@
 \r
 #include <stdint.h>\r
 #include <stdbool.h>\r
-#include "data.h"\r
 #include "crapto1/crapto1.h"\r
+#include "util.h"\r
 \r
 // defaults\r
 // timeout in units. (ms * 106)/10 or us*0.0106\r
index 5dc9a4556b1668708f9323138191401593c95e1c..4f84e3b5eed7b391ae31930fe35cd25f4893dbcd 100644 (file)
@@ -16,7 +16,6 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <time.h>
-#include "data.h"
 
 #ifdef _WIN32
 #include <windows.h>
index 2e64d7caf1e9b7038af326e0b113922bc21334ca..878938f46678593368414ade87518292355ac5b4 100644 (file)
 #ifndef MAX
 # define MAX(a, b) (((a) > (b)) ? (a) : (b))
 #endif
+#ifndef arraylen
+#define arraylen(x) (sizeof(x)/sizeof((x)[0]))
+#endif
 
 #define EVEN                        0
 #define ODD                         1
 
+#ifndef FILE_PATH_SIZE
+#define FILE_PATH_SIZE           2000
+#endif
+
 extern int ukbhit(void);
 
 extern void AddLogLine(char *fileName, char *extData, char *c);
Impressum, Datenschutz