added pport module
git-svn-id: http://apu.dw.local/svnusers/JoshHoltrop/pppc/trunk@35 8131a0b2-b21c-1c47-bd6a-f003126495bd
This commit is contained in:
parent
8b2a5b71ec
commit
b858046eda
9
Makefile
9
Makefile
@ -1,15 +1,18 @@
|
|||||||
|
|
||||||
TARGET := pppc.exe
|
TARGET := pppc.exe
|
||||||
OBJS := pppc.o session_notification.o resources.o
|
OBJS := pppc.o session_notification.o resources.o pport.o
|
||||||
CXXFLAGS := -O2 -Wall
|
CXXFLAGS := -O2 -Wall
|
||||||
|
|
||||||
all: $(TARGET)
|
all: $(TARGET)
|
||||||
|
|
||||||
$(TARGET): $(OBJS)
|
$(TARGET): $(OBJS)
|
||||||
$(CXX) -o $@ $^ $(LDFLAGS)
|
$(CXX) -o $@ $(LDFLAGS) $^
|
||||||
|
|
||||||
%.o: %.rc
|
%.o: %.rc
|
||||||
windres $< $@
|
windres $< $@
|
||||||
|
|
||||||
%.o: %.cc
|
%.o: %.cc
|
||||||
$(CXX) -c -o $@ $< $(CPPFLAGS) $(CXXFLAGS)
|
$(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) $<
|
||||||
|
|
||||||
|
clean:
|
||||||
|
-$(RM) -f *.o *~ *.exe
|
||||||
|
29
pport.cc
Normal file
29
pport.cc
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include <iostream>
|
||||||
|
#include "pport.h"
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
static HANDLE ppfd = NULL;
|
||||||
|
|
||||||
|
void pport_write(unsigned char val)
|
||||||
|
{
|
||||||
|
if (ppfd == NULL)
|
||||||
|
{
|
||||||
|
ppfd = CreateFile("LPT1",
|
||||||
|
GENERIC_WRITE,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
OPEN_EXISTING,
|
||||||
|
FILE_ATTRIBUTE_NORMAL,
|
||||||
|
NULL);
|
||||||
|
if (ppfd == NULL)
|
||||||
|
{
|
||||||
|
cerr << "Couldn't open LPT1!" << endl;
|
||||||
|
exit(4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD bytes_written = 0;
|
||||||
|
WriteFile(ppfd, &val, 1, &bytes_written, NULL);
|
||||||
|
}
|
7
pport.h
Normal file
7
pport.h
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
#ifndef PPORT_H
|
||||||
|
#define PPORT_H
|
||||||
|
|
||||||
|
void pport_write(unsigned char val);
|
||||||
|
|
||||||
|
#endif
|
Loading…
x
Reference in New Issue
Block a user