summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2012-12-04 15:53:57 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2012-12-04 16:10:01 +0100
commit5f50ccabc018fd75fd61f0a643cc85e1ea3807dc (patch)
treedb327fba99dbe0189b7f8523e09320ea8dafe6c1
parent7afc9fe8a319fd96e6285602fcd4d589a844c8e7 (diff)
downloadpjctl-5f50ccabc018fd75fd61f0a643cc85e1ea3807dc.zip
pjctl-5f50ccabc018fd75fd61f0a643cc85e1ea3807dc.tar.gz
pjctl-5f50ccabc018fd75fd61f0a643cc85e1ea3807dc.tar.bz2
Support for building on windows with CygwinHEADmaster
Also install MakeMsi generator files.
-rw-r--r--Makefile.cygwin7
-rw-r--r--src/pjctl.c10
-rw-r--r--win/pjctl.mm41
-rw-r--r--win/pjctl.ver24
4 files changed, 82 insertions, 0 deletions
diff --git a/Makefile.cygwin b/Makefile.cygwin
new file mode 100644
index 0000000..968f6d0
--- /dev/null
+++ b/Makefile.cygwin
@@ -0,0 +1,7 @@
+all: win/pjctl win/pjctl-no-console
+
+win/pjctl: src/pjctl.c
+ gcc -o $@ $< -DNO_CRYPTO
+
+win/pjctl-no-console: src/pjctl.c
+ gcc -o $@ $< -DNO_CRYPTO -mwindows
diff --git a/src/pjctl.c b/src/pjctl.c
index 9297f79..d93f791 100644
--- a/src/pjctl.c
+++ b/src/pjctl.c
@@ -33,7 +33,9 @@
#include <unistd.h>
#include <netdb.h>
+#ifndef NO_CRYPTO
#include <openssl/md5.h>
+#endif
enum pjlink_packet_offsets {
PJLINK_HEADER = 0,
@@ -67,8 +69,10 @@ struct pjctl {
int fd;
char *password;
+#ifndef NO_CRYPTO
int need_hash;
char hash[32+1]; /* 0-terminated hex as ascii encoded 16 byte hash */
+#endif
};
#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
@@ -125,6 +129,7 @@ handle_pjlink_error(char *param)
return 0;
}
+#ifndef NO_CRYPTO
static void
init_hash(struct pjctl *pjctl, const char *salt)
{
@@ -145,6 +150,7 @@ init_hash(struct pjctl *pjctl, const char *salt)
md[12], md[13], md[14], md[15]);
pjctl->need_hash = 1;
}
+#endif
static int
send_next_cmd(struct pjctl *pjctl)
@@ -164,6 +170,7 @@ send_next_cmd(struct pjctl *pjctl)
memset(&msg, 0, sizeof msg);
msg.msg_iov = iov;
+#ifndef NO_CRYPTO
if (pjctl->need_hash) {
pjctl->state = PJCTL_AWAIT_RESPONSE_OR_AUTH_ERR;
@@ -171,6 +178,7 @@ send_next_cmd(struct pjctl *pjctl)
iov[msg.msg_iovlen].iov_len = 32;
msg.msg_iovlen++;
}
+#endif
cmd = pjctl->queue.prev;
iov[msg.msg_iovlen].iov_base = cmd->command;
@@ -189,6 +197,7 @@ static int
handle_setup(struct pjctl *pjctl, char *data, int len)
{
switch (data[PJLINK_PARAMETER]) {
+#ifndef NO_CRYPTO
case '1':
if (pjctl->password == NULL) {
fprintf(stderr,
@@ -199,6 +208,7 @@ handle_setup(struct pjctl *pjctl, char *data, int len)
goto err;
init_hash(pjctl, &data[PJLINK_PARAMETER+2]);
break;
+#endif
case '0':
/* No authentication */
break;
diff --git a/win/pjctl.mm b/win/pjctl.mm
new file mode 100644
index 0000000..4272d68
--- /dev/null
+++ b/win/pjctl.mm
@@ -0,0 +1,41 @@
+;----------------------------------------------------------------------------
+; MODULE NAME: pjctl.mm
+;
+; $Author: USER "Benjamin Franzke" $
+; $Revision: 1 $
+; $Date: 04 Dec 2012 15.15:00 $
+;
+;----------------------------------------------------------------------------
+
+
+;--- Include MAKEMSI support (with my customisations and MSI branding) ------
+;#define VER_FILENAME.VER TryMe.Ver ;;I only want one VER file for all samples! (this line not actually required in "tryme.mm")
+
+#define? DEPT_ARP_URL_PUBLISHER http://git.bnfr.net/pjctl
+#define? DEPT_ARP_URL_TECHNICAL_SUPPORT benjaminfranzke@googlemail.com
+#define? DEPT_NAME Benjamin Franzke
+#define? DEPT_ADDRESS ;;
+#define? COMPANY_CONTACT_NAME <$DEPT_NAME>
+#define? COMPANY_CONTACT_NAME_PHONE ;;No phone
+#define? COMPANY_SUMMARY_SCHEMA 110 ;;Minimum v1.1 Installer
+
+#define? UISAMPLE_LEFTSIDE_TEXT_FONT_COLOR &H7F0000 ;;Medium Blue in BGR (believe it or not...)
+#(
+ #define? UISAMPLE_LEFTSIDE_TEXT
+ Developed by <$DEPT_NAME>.
+#)
+
+#include "ME.MMH"
+;#define? COMMONFRAMEWORK_ZIP_SOURCE_FOR_BACKUP N ;;No "insurance" until I bother to install "info zip"...
+;#include "DEPT.MMH"
+
+;--- Want to debug (not common) ---------------------------------------------
+;#debug on
+;#Option DebugLevel=^NONE, +OpSys^
+
+
+;--- Define default location where file should install and add files --------
+<$DirectoryTree Key="INSTALLDIR" Dir="c:\program files\pjctl\" CHANGE="\" PrimaryFolder="Y">
+<$Files "pjctl-no-console.exe" DestDir="INSTALLDIR">
+<$Files "pjctl.exe" DestDir="INSTALLDIR">
+<$Files "C:\cygwin\bin\cygwin1.dll" DestDir="INSTALLDIR"> \ No newline at end of file
diff --git a/win/pjctl.ver b/win/pjctl.ver
new file mode 100644
index 0000000..f038528
--- /dev/null
+++ b/win/pjctl.ver
@@ -0,0 +1,24 @@
+;----------------------------------------------------------------------------
+;
+; MODULE NAME: pjctl.ver
+;
+; $Author: USER "Benjamin Franzke" $
+; $Revision: 1 $
+; $Date: 10 Oct 2007 17:25:32 $
+;
+; DESCRIPTION: pjctl msi.
+;
+;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+; ProductName = pjctl (PJLink Projector Control)
+; DESCRIPTION = Control a PJLink Projector
+; Installed = WINDOWS_ALL
+; Guid.UpgradeCode = {B20CBBBC-B192-474D-B4C9-616FC9238F2B}
+; MsiName = pjctl
+;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+
+;############################################################################
+VERSION : 1.0.0
+DATE : 25 Feb 2003
+CHANGES : First cut.
+