Commit 4f716e2b authored by valenok's avatar valenok

fixed win32 build

parent 7ad045bc
......@@ -13,7 +13,6 @@ all:
# -DNO_CGI - disable CGI support (-5kb)
# -DNO_SSL - disable SSL functionality (-2kb)
# -DCONFIG_FILE=\"file\" - use `file' as the default config file
# -DNO_SSI - disable SSI support (-4kb)
# -DHAVE_STRTOUI64 - use system strtoui64() function for strtoull()
......@@ -54,19 +53,20 @@ solaris:
# Assuming that studio is installed in d:\vc6, change VC variable below to
# the correct path on your system. Run "d:\vc6\bin\nmake windows"
VC= d:\vc2010\vc
#VC= d:\vc6
SDK= d:\sdk\v7.1
VC= q:\vc6
OUT= c:\out
#WINDBG= /Zi /DDEBUG /Od /DDEBUG
WINDBG= /DNDEBUG /Os
WINFLAGS= /MT /TC /nologo /W4 $(WINDBG) /I $(VC)/include \
/I $(SDK)\include /link /incremental:no /libpath:$(VC)\lib \
/libpath:$(SDK)/lib ws2_32.lib
WINDBG= /DNDEBUG #/Os
CLFLAGS= /MD /TC /nologo /W4 /c $(WINDBG) /I $(VC)/include
LINKFLAGS= /incremental:no /libpath:$(VC)\lib ws2_32.lib
windows:
$(VC)\bin\cl.exe mongoose.c $(WINFLAGS) \
/DLL /DEF:win32\dll.def /out:_$(PROG).dll
$(VC)\bin\cl.exe mongoose.c main.c $(WINFLAGS) /out:$(PROG).exe
$(VC)\bin\cl main.c $(CLFLAGS) /Fo$(OUT)\main.obj
$(VC)\bin\cl mongoose.c $(CLFLAGS) /Fo$(OUT)\mongoose.obj
$(VC)\bin\link $(OUT)\mongoose.obj $(LINKFLAGS) \
/DLL /DEF:win32\dll.def /out:$(OUT)\_$(PROG).dll
$(VC)\bin\link $(OUT)\main.obj $(OUT)\mongoose.obj $(LINKFLAGS) \
/out:$(OUT)\$(PROG).exe
# Build for Windows under MinGW
#MINGWDBG= -DDEBUG -O0
......
......@@ -66,10 +66,10 @@ typedef long off_t;
#define strerror(x) _ultoa(x, (char *) _alloca(sizeof(x) *3 ), 10)
#endif // _WIN32_WCE
#define EPOCH_DIFF 0x019DB1DED53E8000ULL // 116444736000000000 nsecs
#define RATE_DIFF 10000000 // 100 nsecs
#define MAKEUQUAD(lo, hi) ((uint64_t)(((uint32_t)(lo)) | \
((uint64_t)((uint32_t)(hi))) << 32))
#define RATE_DIFF 10000000 // 100 nsecs
#define EPOCH_DIFF MAKEUQUAD(0xd53e8000, 0x019db1de)
#define SYS2UNIX_TIME(lo, hi) \
(time_t) ((MAKEUQUAD((lo), (hi)) - EPOCH_DIFF) / RATE_DIFF)
......@@ -651,6 +651,10 @@ static int pthread_cond_signal(pthread_cond_t *cv) {
return SetEvent(*cv) == 0 ? -1 : 0;
}
static int pthread_cond_broadcast(pthread_cond_t *cv) {
return PulseEvent(*cv) == 0 ? -1 : 0;
}
static int pthread_cond_destroy(pthread_cond_t *cv) {
return CloseHandle(*cv) == 0 ? -1 : 0;
}
......@@ -916,16 +920,17 @@ static int start_thread(struct mg_context *ctx, mg_thread_func_t func,
return hThread == NULL ? -1 : 0;
}
#if 0
static HANDLE dlopen(const char *dll_name, int flags) {
wchar_t wbuf[PATH_MAX];
flags = 0; // Unused
to_unicode(dll_name, wbuf, ARRAY_SIZE(wbuf));
return LoadLibraryW(wbuf);
}
#endif
#if !defined(NO_CGI)
#define SIGKILL 0
static int kill(pid_t pid, int sig_num) {
(void) TerminateProcess(pid, sig_num);
(void) CloseHandle(pid);
......@@ -958,7 +963,7 @@ static pid_t spawn_process(struct mg_connection *conn, const char *prog,
&si.hStdOutput, 0, MG_TRUE, DUPLICATE_SAME_ACCESS);
// If CGI file is a script, try to read the interpreter line
interp = conn->ctx->options[OPT_CGI_INTERPRETER];
interp = conn->ctx->config->cgi_interpreter;
if (interp == NULL) {
line[2] = '\0';
(void) mg_snprintf(conn, cmdline, sizeof(cmdline), "%s%c%s",
......@@ -2325,8 +2330,9 @@ static void handle_file_request(struct mg_connection *conn, const char *path,
conn->request_info.status_code, msg, date, lm, etag,
mime_vec.len, mime_vec.ptr, cl, range);
if (strcmp(conn->request_info.request_method, "HEAD") != 0)
if (strcmp(conn->request_info.request_method, "HEAD") != 0) {
send_file_data(conn, fp, cl);
}
(void) fclose(fp);
}
......
......@@ -2,15 +2,13 @@ LIBRARY
EXPORTS
mg_start
mg_stop
mg_get_option
mg_set_option
mg_set_callback
mg_read
mg_write
mg_printf
mg_get_header
mg_get_var
mg_get_qsvar
mg_get_cookie
mg_version
mg_show_usage_string
mg_modify_passwords_file
mg_md5
mg_get_cookie
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment