There's no painless way to do this, but it needs to be done --

the only reason any of the Windows code was in CPP files was
because the MS compiler doesn't support C99.  Switch to using
MinGW, and that problem goes away, so we can rename the files back.
This commit is contained in:
bushing 2009-12-22 12:42:54 +00:00
parent a146075d74
commit a99c6a1921
11 changed files with 3129 additions and 3145 deletions

View file

@ -1,10 +1,10 @@
#COMMON_FLAGS = -m32
LDLIBS = -L/usr/local/lib -lusb -lreadline -lpthread
LDLIBS = -L/opt/local/lib -L/usr/local/lib -lusb -lreadline -lpthread
LDFLAGS = $(COMMON_FLAGS)
CFLAGS = -I. -I/opt/local/include -Wall -Wno-unused-function $(COMMON_FLAGS)
CXXFLAGS = $(shell pkg-config --cflags QtCore QtGui 2>/dev/null) -Wall
QTLDLIBS = $(shell pkg-config --libs QtCore QtGui 2>/dev/null)
#CXXFLAGS = $(shell pkg-config --cflags QtCore QtGui 2>/dev/null) -Wall -arch i386 -D_
#QTLDLIBS = $(shell pkg-config --libs QtCore QtGui 2>/dev/null) -arch i386
ifneq ($(QTLDLIBS),)
QTGUI = proxgui.o proxguiqt.o proxguiqt.moc.o
@ -23,7 +23,7 @@ all-static: snooper cli flasher
proxmark3: LDLIBS+=$(QTLDLIBS)
proxmark3: proxmark3.o gui.o command.o usb.o $(QTGUI)
command.o: command.cpp translate.h
command.o: command.c
snooper: snooper.o gui.o command.o usb.o guidummy.o

11
client/Makefile.mingw Normal file
View file

@ -0,0 +1,11 @@
CC=c:\mingw\bin\gcc
LIBS = -lgdi32 -lsetupapi
all: proxmark3
proxmark3: prox.c wingui.c command.c
$(CC) $(CFLAGS) $(DEFINES) -o prox.exe prox.c wingui.c command.c $(LIBS)
clean:
del prox.exe

View file

@ -1,33 +0,0 @@
CC=cl
BASE_DIR ?= "..\..\devkitWIN"
BASE_DEFS = /D_WIN32_WINNT=0x501 /DISOLATION_AWARE_ENABLED /D_WIN32_IE=0x600 /DWIN32_LEAN_AND_MEAN /DWIN32 /D_MT /D_CRT_SECURE_NO_WARNINGS
BASE_CFLAGS = /W3 /nologo /Zi /MT /Fdobj/vc90.pdb
LIB = $(BASE_DIR)\lib
DEFINES = $(BASE_DEFS)
INCLUDES = /I$(BASE_DIR)\include
CFLAGS = $(BASE_CFLAGS) $(INCLUDES)
OBJDIR = obj
OBJS = $(OBJDIR)\prox.obj \
$(OBJDIR)\gui.obj \
$(OBJDIR)\command.obj
LIBS = $(LIB)\user32.lib $(LIB)\gdi32.lib $(LIB)\setupapi.lib $(LIB)\libcmt.lib $(LIB)\oldnames.lib $(LIB)\kernel32.lib
all: proxmark3
proxmark3:
$(CC) $(CFLAGS) $(DEFINES) -c -Foobj/prox.obj prox.cpp
$(CC) $(CFLAGS) $(DEFINES) -c -Foobj/gui.obj gui.cpp
$(CC) $(CFLAGS) $(DEFINES) -c -Foobj/command.obj command.cpp
$(CC) $(CFLAGS) $(DEFINES) -Fe$(OBJDIR)/prox.exe $(OBJS) $(LIBS)
copy obj\prox.exe .
clean:
del /q obj\*.obj
del /q obj\*.ilk
del /q obj\*.exe
del /q obj\*.pdb
del prox.exe

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -20,7 +20,7 @@ Environment:
#define __HIDPI_H__
#include <pshpack4.h>
typedef LONG NTSTATUS;
// Please include "hidsdi.h" to use the user space (dll / parser)
// Please include "hidpddi.h" to use the kernel space parser

View file

@ -29,7 +29,7 @@ Environment:
//#include <win32.h>
//#include <basetyps.h>
typedef LONG NTSTATUS;
//typedef LONG NTSTATUS;
#include "hidusage.h"
#include "hidpi.h"

View file

@ -3,10 +3,11 @@
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
extern "C" {
#include "include/hidsdi.h"
//extern "C" {
#include "include/hidusage.h"
#include "include/hidpi.h"
}
#include "include/hidsdi.h"
//}
#include "prox.h"
@ -147,7 +148,7 @@ static BOOL UsbConnect(void)
return FALSE;
}
BOOL ReceiveCommandPoll(UsbCommand *c)
bool ReceiveCommandPoll(UsbCommand *c)
{
static BOOL ReadInProgress = FALSE;
static OVERLAPPED Ov;
@ -187,7 +188,7 @@ void ReceiveCommand(UsbCommand *c)
}
}
void SendCommand(UsbCommand *c, BOOL wantAck)
void SendCommand(UsbCommand *c, bool wantAck)
{
BYTE buf[65];
buf[0] = 0;

View file

@ -1,5 +1,5 @@
WORD update_crc16( WORD crc, BYTE c ) {
WORD i, v, tcrc = 0;
unsigned short update_crc16( unsigned short crc, unsigned char c ) {
unsigned short i, v, tcrc = 0;
v = (crc ^ c) & 0xff;
for (i = 0; i < 8; i++) {

View file

@ -15,8 +15,8 @@ static unsigned short UpdateCrc14443(unsigned char ch, unsigned short *lpwCrc)
return (*lpwCrc);
}
static void ComputeCrc14443(int CrcType, BYTE *Data, int Length,
BYTE *TransmitFirst, BYTE *TransmitSecond)
static void ComputeCrc14443(int CrcType, unsigned char *Data, int Length,
unsigned char *TransmitFirst, unsigned char *TransmitSecond)
{
unsigned char chBlock;
unsigned short wCrc=CrcType;
@ -29,7 +29,7 @@ static void ComputeCrc14443(int CrcType, BYTE *Data, int Length,
if (CrcType == CRC_14443_B)
wCrc = ~wCrc; /* ISO/IEC 13239 (formerly ISO/IEC 3309) */
*TransmitFirst = (BYTE) (wCrc & 0xFF);
*TransmitSecond = (BYTE) ((wCrc >> 8) & 0xFF);
*TransmitFirst = (unsigned char) (wCrc & 0xFF);
*TransmitSecond = (unsigned char) ((wCrc >> 8) & 0xFF);
return;
}