#include <cm_string.h>
-int mod_init(struct tw_config* config, struct tw_tool* tools) {
+int MODULE_DECL mod_init(struct tw_config* config, struct tw_tool* tools) {
tools->log("CGI", "Initializing CGI module");
tools->add_version("CGI/1.1");
return 0;
}
-int mod_config(struct tw_tool* tools, char** argv, int argc) {
+int MODULE_DECL mod_config(struct tw_tool* tools, char** argv, int argc) {
if(cm_strcaseequ(argv[0], "AllowCGI")) {
return TW_CONFIG_PARSED;
}
return TW_CONFIG_NOTME;
}
-int mod_request(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res) {
+int MODULE_DECL mod_request(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res) {
res->status = 403;
return TW_MODULE_STOP;
}
#include <tw_module.h>
-int mod_init(struct tw_config* config, struct tw_tool* tools) {
+int MODULE_DECL mod_init(struct tw_config* config, struct tw_tool* tools) {
tools->log("Example", "This is an example module");
tools->add_version("Example/0.0");
return 0;
}
-int mod_config(struct tw_tool* tools, char** argv, int argc) { return TW_CONFIG_PARSED; }
+int MODULE_DECL mod_config(struct tw_tool* tools, char** argv, int argc) { return TW_CONFIG_PARSED; }
-int mod_request(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res) { return TW_MODULE_ERROR(403); }
+int MODULE_DECL mod_request(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res) { return TW_MODULE_ERROR(403); }
#include <cm_string.h>
-int mod_init(struct tw_config* config, struct tw_tool* tools) {
+int MODULE_DECL mod_init(struct tw_config* config, struct tw_tool* tools) {
tools->log("CGI", "Initializing Proxy module");
tools->add_version("Proxy/1.0");
return 0;
}
-int mod_config(struct tw_tool* tools, char** argv, int argc) { return TW_CONFIG_NOTME; }
+int MODULE_DECL mod_config(struct tw_tool* tools, char** argv, int argc) { return TW_CONFIG_NOTME; }
-int mod_request(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res) { return TW_MODULE_PASS; }
+int MODULE_DECL mod_request(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res) { return TW_MODULE_PASS; }
Haiku Working
Minix Working
UnixWare Working on 7.1.1
+OS/2 Mostly working, module is broken. Help required!
PlayStation Portable Working, missing module support
TODO: Get multi-threading working (maybe)
PlayStation 2 Not working
Haiku Working
Minix Working
UnixWare Working on 7.1.1
+OS/2 Mostly working, module is broken. Help required!
PlayStation Portable Working, missing module support
TODO: Get multi-threading working (maybe)
PlayStation 2 Not working
#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
#ifdef __OS2__
#define INCL_DOSMODULEMGR
+#define INCL_DOSERRORS
#include <os2.h>
#else
#include <windows.h>
char* p = getcwd(NULL, 0);
void* lib;
char tmp[512];
- unsigned long l;
+#ifdef __OS2__
+ HMODULE mod;
+#endif
chdir(config.server_root);
#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
#ifdef __OS2__
- lib = NULL;
- l = (unsigned long)lib;
- DosLoadModule(tmp, 512, path, &l);
+ if(DosLoadModule(tmp, 512, path, &mod) != NO_ERROR){
+ return NULL;
+ }
+ lib = (void*)mod;
#else
lib = LoadLibraryA(path);
#endif
#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
#ifdef __OS2__
void* ret;
- DosQueryProcAddr((unsigned long)mod, 0, sym, (PFN*)&ret);
+ APIRET rc;
+ if((rc = DosQueryProcAddr((HMODULE)mod, 0, sym, (PFN*)&ret)) != NO_ERROR){
+ cm_log("Module", "OS/2 error %d", (int)rc);
+ return NULL;
+ }
return ret;
#else
return GetProcAddress(mod, sym);
int tw_module_init(void* mod) {
tw_mod_init_t mod_init = (tw_mod_init_t)tw_module_symbol(mod, "mod_init");
if(mod_init == NULL) {
- cm_log("Module", "Could not init a module");
+ cm_log("Module", "Could not find a init call");
return 1;
} else {
struct tw_tool tools;
#include "tw_config.h"
#include "tw_http.h"
+#if defined(__OS2__)
+#define INCL_DOSMODULEMGR
+#define INCL_DOSERRORS
+#include <os2.h>
+#define MODULE_DECL APIENTRY
+#else
+#define MODULE_DECL
+#endif
+
struct tw_tool {
void (*log)(const char* name, const char* log, ...);
void (*add_version)(const char* string);
#define TW_CONFIG_NOTME _TW_CONFIG_NOTME
#define TW_CONFIG_ERROR _TW_CONFIG_ERROR
-typedef int (*tw_mod_init_t)(struct tw_config* config, struct tw_tool* tools);
-typedef int (*tw_mod_request_t)(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res);
-typedef int (*tw_mod_config_t)(struct tw_tool* tools, char** argv, int argc);
+typedef int (MODULE_DECL *tw_mod_init_t)(struct tw_config* config, struct tw_tool* tools);
+typedef int (MODULE_DECL *tw_mod_request_t)(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res);
+typedef int (MODULE_DECL *tw_mod_config_t)(struct tw_tool* tools, char** argv, int argc);
#ifdef SOURCE
void* tw_module_load(const char* path);