예제 #1
0
파일: action.c 프로젝트: CivilPol/sdcboot
#define UNZIP_INTERNAL
#include "unzip.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#ifndef  WIN32
#include <dos.h>
#endif
#include "wingui\wizunzip.h"

#define cchFilesMax 4096
char rgszFiles[cchFilesMax]; /* Moved out of action to allow for larger number
                                of files to be selected. */
unsigned long dSpaceToUse;

char __based(__segname("STRINGS_TEXT")) szNoMemory[] =
            "Insufficient memory for this operation!";

char __based(__segname("STRINGS_TEXT")) szCantChDir[] =
         "Can't change directory to %s!";

/* Get Selection Count returns a count of the selected
 * list box items. If the count is  greater than zero, it also returns
 * a pointer to a locked list in local memory of the item nos.
 * and their local memory handle.
 * A value of -1 indicates an error.
 */
int CLBItemsGet(HWND hListBox, int __far * __far *ppnSelItems, HANDLE *phnd)
{
int cSelLBItems = (int)SendMessage(hListBox, LB_GETSELCOUNT, 0, 0L);
예제 #2
0
*    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
*    NON-INFRINGEMENT. Please see the License for the specific language
*    governing rights and limitations under the License.
*
*  ========================================================================
*
* Description:  Implementation of itoa()/utoa() - convert int to string.
*
****************************************************************************/


#include "variety.h"
#include "widechar.h"
#include <stdlib.h>

extern const char __based(__segname("_CONST")) __Alphabet[];

typedef unsigned __based(__segname("_STACK")) *uint_stk_ptr;

#if defined(__WATCOMC__)
unsigned __udiv( unsigned, uint_stk_ptr );
#if defined(__386__) && defined(__SMALL_DATA__)
    #pragma aux __udiv = \
        "xor edx,edx" \
        "div dword ptr [ebx]" \
        "mov [ebx],eax" \
        parm caller [eax] [ebx] \
        modify exact [eax edx] \
        value [edx];
#elif defined( __386__ ) && defined(__BIG_DATA__)
    #pragma aux __udiv = \
예제 #3
0
 * it is:  - fault occurs
 *         - WDEBUG.386 gets it first, looks at it, sees if the fault took
 *           place on a use32 stack
 *         - if it was NOT on a use32 stack, then the next handler is
 *           invoked.  We get control through IntHandler eventually.
 *         - if it was on a use32 stack,  then we save all the 32-bit
 *           registers into a specified spot in WINT32.DLL and switch context
 *           to a specified routine (in WINT32.DLL)
 *         - the specified routine then does a breakpoint, which then
 *           causes us to end up in IntHandler.
 */

// nyi - put in header or something!
#define SIG_OFF         0
#define SIG_SIZE        4
extern const unsigned short __based(__segname("_CONST")) win386sig[];
extern const unsigned short __based(__segname("_CONST")) win386sig2[];

extern WORD     __far NewAX;
extern WORD     __far NewCS;
extern WORD     __far NewIP;
extern WORD     __far NewFLAGS;
extern WORD     __far OldretCS;
extern WORD     __far OldretIP;
extern WORD     __far Oldintnumber;
extern WORD     __far Oldhandle;

extern WORD     __far NewSS;
extern DWORD    __far NewESP;

extern WORD     __far RetHow;
예제 #4
0
#include <stdlib.h>
#include <string.h>
#include <direct.h>
#include <ctype.h>
#include <dos.h>
#include "wdebug.h"
#include "stdwin.h"
#include "winacc.h"
#include "getcsip.h"

#define SIG_OFF         0
#define SIG_SIZE        4

#define TINY_ERROR(x)  ((signed long)x < 0)

const unsigned short __based(__segname("_CONST")) win386sig[] = { 0xDEAD,0xBEEF };
const unsigned short __based(__segname("_CONST")) win386sig2[] = { 0xBEEF,0xDEAD };

BOOL WasStarted;

typedef struct {
    WORD        mustbe2;
    WORD        cmdshow;
} word_struct;

typedef struct
{
    WORD        wEnvSeg;
    LPSTR       lpCmdLine;
    word_struct *cmdshow;
    DWORD       reserved;
예제 #5
0
extern void             InitVectors(void);
extern void             FiniVectors(void);
extern void             TrapTypeInit(void);
extern void             ClrIntVecs(void);
extern void             SetIntVecs(void);
extern void             DoRemInt(trap_cpu_regs *, unsigned);
extern char             Have87Emu(void);
extern void             Null87Emu( void );
extern void             Read87EmuState( void __far * );
extern void             Write87EmuState( void __far * );
extern unsigned         StringToFullPath( char * );
extern int              __far NoOvlsHdlr( int, void * );
extern bool             CheckOvl( addr32_ptr );
extern int              NullOvlHdlr(void);

extern word             __based(__segname("_CODE")) SegmentChain;

static tiny_handle_t    EXEhandle;
static tiny_ftime_t     EXETime;
static tiny_fdate_t     EXEDate;
#define ReadEXE( x )    TinyRead( EXEhandle, &x, sizeof(x) )
#define WriteEXE( x )   TinyWrite( EXEhandle, &x, sizeof(x) )
#define SeekEXEset( x ) TinySeek( EXEhandle, x, TIO_SEEK_START )
static dword            NEOffset;
static word             NumSegments;
static dword            SegTable;
static dword            StartByte;
static opcode_type      saved_opcode;
static addr48_ptr       BadBreak;
static bool             GotABadBreak;
static int              ExceptNum;
예제 #6
0
*  ========================================================================
*
* Description:  Implementation of itoa()/utoa() - convert int to string.
*
****************************************************************************/


#include "variety.h"
#include "widechar.h"
#include <stdlib.h>
#include "_xtoa.h"


#define TO_WIDE(c)  ((CHAR_TYPE)(c))

typedef unsigned __based(__segname("_STACK")) *uint_stk_ptr;

#if defined(__WATCOMC__)
unsigned __udiv( unsigned, uint_stk_ptr );
#if defined(__386__) && defined(__SMALL_DATA__)
    #pragma aux __udiv = \
            "xor    edx,edx"            \
            "div    dword ptr [ebx]"    \
            "mov    [ebx],eax"          \
        __parm __caller     [__eax] [__ebx] \
        __value             [__edx] \
        __modify __exact    [__eax __edx]
#elif defined( __386__ ) && defined(__BIG_DATA__)
    #pragma aux __udiv = \
            "xor    edx,edx"            \
            "div    dword ptr ss:[ebx]" \
예제 #7
0
/* does NOT use C runtime */

#include <i86.h>
#include <conio.h>
#include <stdint.h>

#include <hw/dos/drvhead.h>
#include <hw/dos/drvreq.h>
#include <hw/dos/drvvar.h>

/* NTS: must declare this __based on _CODE so that it doesn't end up in _CONST.
 *      we want this string to be discarded along with INIT function after init.
 *      _CONST is not discarded after INIT. */
static const char __based( __segname("_CODE") ) hello_world[] = "Hello!\r\nThis is an example device driver that acts as a basic character device.\r\nYou can read and write me through the HELLO$ character device.\r\nHave fun!\r\n\r\n";

void INIT_func(void) {
// NTS: Watcom C is missing an optimization opportunity here, so define instead
#define initreq ((struct dosdrv_request_init_t far*)dosdrv_req_ptr)

    __asm {
        push    ax
        push    si

        ; NTS: We can refer to it without reloading DS because we tied everything to DGROUP in this project
        mov     si,offset hello_world

l1:     lodsb
        or      al,al
        jz      le
        mov     ah,0x0E
예제 #8
0
template <class T>
    void zap( T __based(__segname("ASDF")) *p, T __based(__segname("ASDF")) *x )
    {
	*p = *x;
    }

void foo( char volatile __based(void) *p )
{
    zap( p, p );	// T should not bind
}
예제 #9
0
// WCC386P self.c -ox -d1 generates poor quality code for 4[eax] fetch
// ditto for WCCP (Anthony)
typedef struct S S;
struct S {
    S __based(__self) *next;
    S __based(__self) *prev;
    int x;
};

__segment s;
S __based(s) * __based(__segname("CODE")) p;

void zap( int y )
{
    p->next->prev->x = y;
}
예제 #10
0
* Description:  WHEN YOU FIGURE OUT WHAT THIS FILE DOES, PLEASE
*               DESCRIBE IT HERE!
*
****************************************************************************/


#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "global.h"
#include "types.h"
#include "sruinter.h"
#include "ytab.h"
#include "keywords.h"

const keyword __based(__segname("_CONST")) Statements[] = {
        NULL, "end",            ST_END,         FALSE,
        NULL, "forward",        ST_FORWARD,     FALSE,
        NULL, "from",           ST_FROM,        FALSE,
        NULL, "function",       ST_FUNCTION,    FALSE,
        NULL, "global",         ST_GLOBAL,      FALSE,
        NULL, "library",        ST_LIBRARY,     FALSE,
        NULL, "on",             ST_ON,          FALSE,
        NULL, "private",        ST_PRIVATE,     FALSE,
        NULL, "protected",      ST_PROTECTED,   FALSE,
        NULL, "prototypes",     ST_PROTOTYPES,  FALSE,
        NULL, "public",         ST_PUBLIC,      FALSE,
        NULL, "ref",            ST_REF,         FALSE,
        NULL, "return",         ST_RETURN,      FALSE,
        NULL, "shared",         ST_SHARED,      FALSE,
        NULL, "subroutine",     ST_SUBROUTINE,  FALSE,
예제 #11
0
void __based(__segname("a")) b();
void __based(__segname("b")) b();

void __based(__segname("a")) a();
void __based(__segname("b")) __export a();


#if __WATCOM_REVISION__ >= 7
#define str( x ) #x
#define xstr( x ) str( x )
#define j( x, y )	x##y

char *_x12[] = {

    xstr( j(
        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\
        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\
        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\
        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\
        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\
        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\
        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
        ,
        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\
        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\
        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\
        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\
        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\
        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\
        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
예제 #12
0
    DIPImpSymAddRef,
    DIPImpSymRelease,
    DIPImpSymFreeAll,

    DIPImpWalkSymListEx,
    DIPImpLookupSymEx,
};

#if defined( __WINDOWS__ )
static HINSTANCE    ThisInst;
static HANDLE       TaskId;
#endif

#if defined( __WATCOMC__ ) && ( defined( __DOS__ ) || defined( __UNIX__ ) )
const char __based( __segname( "_CODE" ) ) Signature[4] = "DIP";
#endif

DIG_DLLEXPORT dip_imp_routines * DIGENTRY DIPLOAD( dip_status *status, dip_client_routines *client )
{
    Client = client;
#if defined( __WINDOWS__ )
    {
        FARPROC start;

        start = MakeProcInstance( (FARPROC)DIPImpStartup, ThisInst );
        *status = ((dip_status(DIGENTRY*)(void)) start)();
        FreeProcInstance( start );
    }
#else
    *status = DIPImpStartup();
예제 #13
0
};

LINK::LINK( LINK*p, unsigned v )
    : next(p), value(v)
{
}


// -------------------- DATA -------------------------

static char char_file_scope = 'q';
static char array_file_scope[] = { 'r', 's', 't', 'u', 'v' };

static void *base_ptr = array_file_scope;

static char __based( __segname( "MyArea" ) ) char_area = 'j';
static char __based( __segname( "MyArea" ) ) array_area[]
    = { 'a', 'b', 'c', 'd', 'e' };

static char __based( __segname( "_DATA" ) ) char_data = 'j';
static char __based( __segname( "_DATA" ) ) array_data[]
    = { 'a', 'b', 'c', 'd', 'e' };

static char __based( __segname( "_CODE" ) ) char_code = 'j';
static char __based( __segname( "_CODE" ) ) array_code[]
    = { 'a', 'b', 'c', 'd', 'e' };

static char __based( __segname( "_TEXT" ) ) char_text = 'j';
static char __based( __segname( "_TEXT" ) ) array_text[]
    = { 'a', 'b', 'c', 'd', 'e' };
예제 #14
0
#include "fail.h"

/* PE and ELF can't represent the necessary relocations in non-flat models */
#if defined( _M_I86 ) || defined( __386__ ) && !defined( __NT__ ) && !defined( __UNIX__ )

#define MK_FP(seg,off) (((__segment)(seg)):>((void __based(void) *)(off)))

// #pragma on (dump_init)
char __based(__segname("foo_TEXT")) bar[] = "abc";

/* Now const-fold the :> operator. */
/* NB: This doesn't work in 32-bit mode because the data initializer 
 * can't handle static initialization of 16:32 far pointers!
 */
#ifdef _M_I86
void __far *lp = MK_FP( 0x1234, 0x5678 );
#endif

int __based(__segname("foo_TEXT")) main()
{
    if( bar[0] == 'a'
     && bar[1] == 'b'
     && bar[2] == 'c' ) {
    } else {
        fail( __LINE__ );
    }
#ifdef _M_I86
    if( (unsigned long)lp != 0x12345678 ) fail( __LINE__ );
    if( lp != MK_FP( 0x1234, 0x5678 ) ) fail( __LINE__ );
#endif
예제 #15
0
파일: sound.c 프로젝트: CivilPol/sdcboot
#include <mmsystem.h>

/* WizUnZip sound control module, sound.c.
 * This module controls what sound WizUnZip makes after during or after extracting a file.
 * All users can optionally produce a beep after unzipping. Users with Windows 3.1
 * or Windows 3.0 + Multimedia extensions can play wave files.
 * WizUnZip uses the presence of the DLL MMSYSTEM.DLL/WIN16MM.DLL to determine
 * whether MM capability is present.  It further queries the number of wave
 * devices in the system to see if wave playing hardware is present.
 * This approach gives maximum system useability without causing Windows
 * errors such as "Can't find dynalink!"
 */

#define MAXFILTERBUF 50

static char __based(__segname("STRINGS_TEXT")) szBeepOnFinish[] = "Beep";
/* sndPlaySound is apparently an obsolete function not properly supported
   by Win32 (or perhaps by WINMM.DLL), use PlaySound instead. Of course,
   PlaySound is not supported under Windows 3.1x
*/
#ifndef WIN32
static char __based(__segname("STRINGS_TEXT")) szMMSystemDll[] = "MMSYSTEM.DLL";
static char __based(__segname("STRINGS_TEXT")) szPlaySound[] = "sndPlaySound";
#else
static char __based(__segname("STRINGS_TEXT")) szMMSystemDll[] = "WINMM.DLL";
static char __based(__segname("STRINGS_TEXT")) szPlaySound[] = "PlaySound";
#endif
static char __based(__segname("STRINGS_TEXT")) szDfltWaveFile[] = "WIZUNZIP.WAV";
static char __based(__segname("STRINGS_TEXT")) szSoundNameKey[] = "SoundName"; /* key in .INI */
static char __based(__segname("STRINGS_TEXT")) szSoundOptKey[] = "SoundOption";
static char __based(__segname("STRINGS_TEXT")) szWaveBrowseTitle[] = "Browse Sound Files";
예제 #16
0
 * PE, ELF and other executable formats. 32-bit OS/2 and DOS (using LX/LE 
 * format) is fine.
 */

#if defined(__NT__) || defined(__UNIX__)

ALWAYS_PASS

#else

/* Must be not compiled in flat model, use small (-ms) */
#if defined( __386__ ) && !defined( __SMALL__ )
#error  Must use small model, not flat
#endif

signed   long long far __based(__segname("FARAWAY")) s_store1;
signed   long long far __based(__segname("FARAWAY")) s_store2;
unsigned long long far __based(__segname("FARAWAY")) u_store1;
unsigned long long far __based(__segname("FARAWAY")) u_store2;

/*
 * Ugly hack used to prevent access via DS. Do not know how to place data
 * in separate PHYSICAL segment in flat model
 */

void clear_ds(void);
void restore_ds(void);

#pragma aux clear_ds    = "push ds" "push 0" "pop ds";
#pragma aux restore_ds  = "pop  ds";