Changeset 313 in Main for trunk


Ignore:
Timestamp:
Oct 14, 2024, 8:22:06 AM (5 weeks ago)
Author:
Nishi
Message:

dll does not work somehow

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Module/mod_cgi.c

    r215 r313  
    55#include <cm_string.h>
    66
    7 int mod_init(struct tw_config* config, struct tw_tool* tools) {
     7int MODULE_DECL mod_init(struct tw_config* config, struct tw_tool* tools) {
    88        tools->log("CGI", "Initializing CGI module");
    99        tools->add_version("CGI/1.1");
     
    1111}
    1212
    13 int mod_config(struct tw_tool* tools, char** argv, int argc) {
     13int MODULE_DECL mod_config(struct tw_tool* tools, char** argv, int argc) {
    1414        if(cm_strcaseequ(argv[0], "AllowCGI")) {
    1515                return TW_CONFIG_PARSED;
     
    1818}
    1919
    20 int mod_request(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res) {
     20int MODULE_DECL mod_request(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res) {
    2121        res->status = 403;
    2222        return TW_MODULE_STOP;
  • trunk/Module/mod_example.c

    r215 r313  
    44#include <tw_module.h>
    55
    6 int mod_init(struct tw_config* config, struct tw_tool* tools) {
     6int MODULE_DECL mod_init(struct tw_config* config, struct tw_tool* tools) {
    77        tools->log("Example", "This is an example module");
    88        tools->add_version("Example/0.0");
     
    1010}
    1111
    12 int mod_config(struct tw_tool* tools, char** argv, int argc) { return TW_CONFIG_PARSED; }
     12int MODULE_DECL mod_config(struct tw_tool* tools, char** argv, int argc) { return TW_CONFIG_PARSED; }
    1313
    14 int mod_request(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res) { return TW_MODULE_ERROR(403); }
     14int MODULE_DECL mod_request(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res) { return TW_MODULE_ERROR(403); }
  • trunk/Module/mod_proxy.c

    r215 r313  
    55#include <cm_string.h>
    66
    7 int mod_init(struct tw_config* config, struct tw_tool* tools) {
     7int MODULE_DECL mod_init(struct tw_config* config, struct tw_tool* tools) {
    88        tools->log("CGI", "Initializing Proxy module");
    99        tools->add_version("Proxy/1.0");
     
    1111}
    1212
    13 int mod_config(struct tw_tool* tools, char** argv, int argc) { return TW_CONFIG_NOTME; }
     13int MODULE_DECL mod_config(struct tw_tool* tools, char** argv, int argc) { return TW_CONFIG_NOTME; }
    1414
    15 int mod_request(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res) { return TW_MODULE_PASS; }
     15int MODULE_DECL mod_request(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res) { return TW_MODULE_PASS; }
  • trunk/README

    r309 r313  
    4545Minix                    Working
    4646UnixWare                 Working on 7.1.1
     47OS/2                     Mostly working, module is broken. Help required!
    4748PlayStation Portable     Working, missing module support
    4849                         TODO: Get multi-threading working (maybe)
  • trunk/README.tmpl

    r309 r313  
    4545Minix                    Working
    4646UnixWare                 Working on 7.1.1
     47OS/2                     Mostly working, module is broken. Help required!
    4748PlayStation Portable     Working, missing module support
    4849                         TODO: Get multi-threading working (maybe)
  • trunk/Server/module.c

    r312 r313  
    3030#ifdef __OS2__
    3131#define INCL_DOSMODULEMGR
     32#define INCL_DOSERRORS
    3233#include <os2.h>
    3334#else
     
    4344        void* lib;
    4445        char tmp[512];
    45         unsigned long l;
     46#ifdef __OS2__
     47        HMODULE mod;
     48#endif
    4649        chdir(config.server_root);
    4750#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
    4851#ifdef __OS2__
    49         lib = NULL;
    50         l = (unsigned long)lib;
    51         DosLoadModule(tmp, 512, path, &l);
     52        if(DosLoadModule(tmp, 512, path, &mod) != NO_ERROR){
     53                return NULL;
     54        }
     55        lib = (void*)mod;
    5256#else
    5357        lib = LoadLibraryA(path);
     
    6872#ifdef __OS2__
    6973        void* ret;
    70         DosQueryProcAddr((unsigned long)mod, 0, sym, (PFN*)&ret);
     74        APIRET rc;
     75        if((rc = DosQueryProcAddr((HMODULE)mod, 0, sym, (PFN*)&ret)) != NO_ERROR){
     76                cm_log("Module", "OS/2 error %d", (int)rc);
     77                return NULL;
     78        }
    7179        return ret;
    7280#else
     
    8189        tw_mod_init_t mod_init = (tw_mod_init_t)tw_module_symbol(mod, "mod_init");
    8290        if(mod_init == NULL) {
    83                 cm_log("Module", "Could not init a module");
     91                cm_log("Module", "Could not find a init call");
    8492                return 1;
    8593        } else {
  • trunk/Server/tw_module.h

    r156 r313  
    1010#include "tw_config.h"
    1111#include "tw_http.h"
     12
     13#if defined(__OS2__)
     14#define INCL_DOSMODULEMGR
     15#define INCL_DOSERRORS
     16#include <os2.h>
     17#define MODULE_DECL APIENTRY
     18#else
     19#define MODULE_DECL
     20#endif
    1221
    1322struct tw_tool {
     
    3847#define TW_CONFIG_ERROR _TW_CONFIG_ERROR
    3948
    40 typedef int (*tw_mod_init_t)(struct tw_config* config, struct tw_tool* tools);
    41 typedef int (*tw_mod_request_t)(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res);
    42 typedef int (*tw_mod_config_t)(struct tw_tool* tools, char** argv, int argc);
     49typedef int (MODULE_DECL *tw_mod_init_t)(struct tw_config* config, struct tw_tool* tools);
     50typedef int (MODULE_DECL *tw_mod_request_t)(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res);
     51typedef int (MODULE_DECL *tw_mod_config_t)(struct tw_tool* tools, char** argv, int argc);
    4352
    4453#ifdef SOURCE
Note: See TracChangeset for help on using the changeset viewer.