Software: Apache/2.2.3 (CentOS). PHP/5.1.6 uname -a: Linux mx-ll-110-164-51-230.static.3bb.co.th 2.6.18-194.el5PAE #1 SMP Fri Apr 2 15:37:44 uid=48(apache) gid=48(apache) groups=48(apache) Safe-mode: OFF (not secure) /usr/share/doc/ghostscript-8.15/ drwxr-xr-x |
Viewing file: DLL.htm (25 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) | How to use the Ghostscript Dynamic Link Library (DLL)Table of contents
For other information, see the Ghostscript overview. WARNING: The API described in this document is obsolete and will be removed in the future. The current Ghostscript Interpreter API is described in API.htm. What is the Ghostscript DLL?For the OS/2, Win16 and Win32 platforms, Ghostscript is built as a dynamic link library (DLL), and to provide the interface described in the usage documentation, a smaller independent executable (.EXE) loads this DLL, which provides all the interaction with the windowing system, including image windows and, if necessary, a text window. This document describes the DLL interface, which consists of eight main functions, seven platform-independent ones provided by the DLL and one, the callback function, provided by the caller. The DLL provides some other platform-specific functions for display devices. The DLL's name and characteristics differ among the three platforms:
The source for the executable is in dp*.* (OS/2) and dw*.* (Windows). See these source files for examples of how to use the DLL. Platform-independent DLL functionsThe seven functions provided by the DLL are
gsdll_revision()This function returns the revision numbers and strings of the Ghostscript DLL; you should call it before gsdll_init() to make sure that the correct version of the Ghostscript DLL has been loaded. For examplechar *product; char *copyright; long revision; long revisiondate; gsdll_revision(&product, ©right, &revision, &revisiondate); gsdll_init()gsdll_init() must be called after loading the DLL and before executing any Ghostscript commands. The arguments are the address of the callback function, a parent window handle, the count of arguments and an array of pointers to the arguments. For examplechar *argv[5]; argv[0] = "gswin.exe"; argv[1] = "-Ic:\\gs;c:\gs\\fonts"; argv[2] = "-dNOPAUSE", argv[3] = "-sDEVICE=djet500", argv[4] = NULL; argc = 4; code = gsdll_init(gsdll_callback, hwnd, argc, argv); gsdll_execute_begin()This must be called after gsdll_init() and before gsdll_execute_cont(). gsdll_execute_cont()After successfully calling gsdll_init() and gsdll_execute_begin(), commands may be given to Ghostscript with gsdll_execute_cont(). Examples are:gsdll_execute_cont() does not flush stdio, so if you want to see output from Ghostscript you must do this explicitly as shown in the example above.char *command = "1 2 add == flush\n"; code = gsdll_execute_cont(command, strlen(command)); command = "qu" code = gsdll_execute_cont(command, strlen(command)); command = "it\n" code = gsdll_execute_cont(command, strlen(command)); gsdll_execute_end()If gsdll_execute_cont() did not return an error, then gsdll_execute_end() must be called after gsdll_execute_cont() and before gsdll_exit(). gsdll_exit()Call gsdll_exit() to terminate the Ghostscript DLL. It must be called if a fatal error has occurred; see the return value of gsdll_execute_cont(). After calling gsdll_exit(), there are two options: gsdll_lock_device()Since the caller may be multithreaded, a lock is needed to control access to the display device, and gsdll_lock_device() provides that locking.int gsdll_lock_device(unsigned char *device, int flag); /* Lock the device if flag = TRUE */ /* Unlock the device if flag = FALSE */ /* device is a pointer to Ghostscript os2dll or mswindll device */ /* from GSDLL_DEVICE message. */ /* Return value is the lock count. */ Callback functionAs an argument to gsdll_init() the caller must provide a callback function which the DLL invokes for stdio and to notify the caller about device events. The function provided by the caller has this prototype:int gsdll_callback(int message, char *str, unsigned long count); Ghostscript DLL device for OS/2The os2dll device is provided in the Ghostscript DLL for use by the caller. No drawing facilities are provided by the DLL because the DLL may be loaded by a text-only (non-PM) application. The caller is notified via the gsdll_callback() when a new os2dll device is opened or closed (GSDLL_DEVICE), when the window should be redrawn (GSDLL_SYNC or GSDLL_PAGE) or when the bitmap size changes (GSDLL_SIZE). Note that more than one os2dll device may be opened. gsdll_get_bitmap()gsdll_get_bitmap() returns a pointer to a bitmap in BMP format. The os2dll device draws into this bitmap.unsigned long gsdll_get_bitmap(unsigned char *device, unsigned char **pbitmap); /* return in pbitmap the address of the bitmap */ /* device is a pointer to Ghostscript os2dll device from GSDLL_DEVICE message */ Example DLL usage for OS/2The example here shows a minimal usage of the Ghostscript DLL under OS/2. The sample callback function above is needed. #define INCL_DOS #include <os2.h> #include <stdio.h> #include "gsdll.h" PFN_gsdll_init pgsdll_init; PFN_gsdll_execute_begin pgsdll_execute_begin; PFN_gsdll_execute_cont pgsdll_execute_cont; PFN_gsdll_execute_end pgsdll_execute_end; PFN_gsdll_exit pgsdll_exit; HMODULE hmodule_gsdll; char buf[256]; int main(int argc, char *argv[]) { int code; APIRET rc; if (!DosLoadModule(buf, sizeof(buf), "GSDLL2", &hmodule_gsdll)) { fprintf(stderr, "Loaded GSDLL2\n"); DosQueryProcAddr(hmodule_gsdll, 0, "gsdll_init", (PFN *)(&pgsdll_init)); DosQueryProcAddr(hmodule_gsdll, 0, "gsdll_execute_begin", (PFN *)(&pgsdll_execute_begin)); DosQueryProcAddr(hmodule_gsdll, 0, "gsdll_execute_cont", (PFN *)(&pgsdll_execute_cont)); DosQueryProcAddr(hmodule_gsdll, 0, "gsdll_execute_end", (PFN *)(&pgsdll_execute_end)); DosQueryProcAddr(hmodule_gsdll, 0, "gsdll_exit", (PFN *)(&pgsdll_exit)); } else { fprintf(stderr, "Can't load GSDLL2\n"); } code = (*pgsdll_init)(gsdll_callback, NULL, argc, argv); fprintf(stdout,"gsdll_init returns %d\n", code); code = (*pgsdll_execute_begin)(); if (code==0) { while (fgets(buf, sizeof(buf), stdin)) { code = (*pgsdll_execute_cont)(buf, strlen(buf)); fprintf(stdout,"gsdll_execute returns %d\n", code); if (code < 0) break; } if (!code) code = (*pgsdll_execute_end)(); code = (*pgsdll_exit)(); fprintf(stdout,"gsdll_exit returns %d\n", code); } rc = DosFreeModule(hmodule_gsdll); fprintf(stdout,"DosFreeModule returns %d\n", rc); return 0; } Ghostscript DLL device for MS WindowsThe mswindll device is provided in the Ghostscript DLL for use by the caller. The caller is notified via the gsdll_callback() when a new mswindll device is opened or closed (GSDLL_DEVICE), when the window should be redrawn (GSDLL_SYNC or GSDLL_PAGE) or when the bitmap size changes (GSDLL_SIZE). Note that more than one mswindll device may be opened. Four DLL functions are available to use the mswindll device. gsdll_copy_dib()Copy the mswindll bitmap to the clipboard.HGLOBAL GSDLLAPI gsdll_copy_dib(unsigned char *device); /* make a copy of the device bitmap and return shared memory handle to it */ /* device is a pointer to Ghostscript device from GSDLL_DEVICE message */ gsdll_copy_palette()Copy the mswindll palette to the clipboard.HPALETTE GSDLLAPI gsdll_copy_palette(unsigned char *device); /* make a copy of the device palette and return a handle to it */ /* device is a pointer to Ghostscript device from GSDLL_DEVICE message */ gsdll_draw()Display output from the mswindll device. The caller should create a window and call gsdll_draw() in response to the WM_PAINT message. The device context hdc must be for a device because SetDIBitsToDevice() is used.void GSDLLAPI gsdll_draw(unsigned char *device, HDC hdc, LPRECT dest, LPRECT src); /* copy the rectangle src from the device bitmap */ /* to the rectangle dest on the device given by hdc */ /* hdc must be a device context for a device (NOT a bitmap) */ /* device is a pointer to Ghostscript device from GSDLL_DEVICE message */ gsdll_get_bitmap_row()Get a BMP header, a palette, and a pointer to a row in the bitmap. This function exists to allow the bitmap to be copied to a file or structured storage without the overhead of having two copies of the bitmap in memory at the same time. Ghostscript DLL Device for 16-bit MS WindowsThis platform has the most problems of the three. Support for it may be dropped in future. The Win16 DLL GSDLL16.DLL is a large-memory model DLL with far static data. Due to the limitations of 16-bit MS Windows, the DLL can be used by only one program at a time. However, GSDLL16 is marked as having SINGLE SHARED data segments, allowing multiple applications to load it with no error indication. (The DLL wouldn't load at all if MULTIPLE NONSHARED was used). Nonetheless, it cannot be used by more than one application at a time, so applications loading GSDLL16 should check the return value of gsdll_init(): if this value is non-zero, then GSDLL16 is already in use by another application and should not be used: GSDLL16 should be unloaded immediately using FreeLibrary(), or the calling program should quit without attempting to use the library.. The segmented architecture of the Intel 80286 causes the usual amount of grief when using GSDLL16. Because the callback is called from the DLL, which is using a different data segment, the callback must be declared as _far _export: int _far _export gsdll_callback(int message, char *str, unsigned long count); Instead of giving gsdll_init() the address of gsdll_callback(), it should instead be given the address of a thunk created by MakeProcInstance. This thunk changes the data segment back to that used by the caller: FARPROC lpfnCallback; lpfnCallback = (FARPROC)MakeProcInstance((FARPROC)gsdll_callback, hInstance); code = (*pgsdll_init)((GSDLL_CALLBACK)lpfnCallback, NULL, argc, argv); if (!code) { fprintf(stderr, "GSDLL16 is already in use\n"); return -1; } Copyright © 1996, 1997, 1998 Aladdin Enterprises. All rights reserved. This software is provided AS-IS with no warranty, either express or implied. This software is distributed under license and may not be copied, modified or distributed except as expressly authorized under the terms of the license contained in the file LICENSE in this distribution. For more information about licensing, please refer to http://www.ghostscript.com/licensing/. For information on commercial licensing, go to http://www.artifex.com/licensing/ or contact Artifex Software, Inc., 101 Lucas Valley Road #110, San Rafael, CA 94903, U.S.A., +1(415)492-9861. Ghostscript version 8.15, 22 September 2004 |
:: Command execute :: | |
:: Shadow's tricks :D :: | |
Useful Commands
|
:: Preddy's tricks :D :: | |
Php Safe-Mode Bypass (Read Files)
|
--[ c999shell v. 1.0 pre-release build #16 Modded by Shadow & Preddy | RootShell Security Group | r57 c99 shell | Generation time: 0.0245 ]-- |