Changeset 3552 for trunk


Ignore:
Timestamp:
Aug 26, 2007, 4:15:22 AM (18 years ago)
Author:
bird
Message:

kDbgDump can open itself now, not bad.

Location:
trunk/kStuff
Files:
3 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/kStuff/Config.kmk

    r3538 r3552  
    4040TEMPLATE_kStuff_TOOL.win.amd64   = VCC80AMD64
    4141
    42 TEMPLATE_kStuff_SDKS.win         = WINPSDK
     42TEMPLATE_kStuff_SDKS.win.x86     = WINPSDK W2K3DDKX86
     43TEMPLATE_kStuff_SDKS.win.amd64   = WINPSDK W2K3DDKAMD64
    4344
    4445TEMPLATE_kStuff_DEFS.freebsd     = KS_OS_FREEBSD
     
    6970TEMPLATE_kStuff_CXXFLAGS.os2    += -O3
    7071TEMPLATE_kStuff_CXXFLAGS.win    += -O2xtg -Oi -Ob2
     72else
     73TEMPLATE_kStuff_CXXFLAGS.win    += -Od
    7174endif
    7275
     
    8487        $(PATH_TOOL_VCC70_LIB)/msvcrt.lib \
    8588        $(PATH_TOOL_VCC70_LIB)/msvcprt.lib \
    86         $(PATH_TOOL_VCC70_LIB)/oldnames.lib
     89        $(PATH_TOOL_VCC70_LIB)/oldnames.lib \
     90        $(PATH_SDK_W2K3DDKX86_LIB)/ntdll.lib
    8791
    8892TEMPLATE_kStuffEXE = kStuff Executable Template
  • trunk/kStuff/include/k/kHlpAlloc.h

    r3550 r3552  
    2828#define ___k_kHlpAlloc_h___
    2929
    30 #include <k/kDefs.h>
     30#include <k/kHlpDefs.h>
    3131#include <k/kTypes.h>
    3232
     
    5050#endif
    5151
    52 void *  kHlpAlloc(KSIZE cb);
    53 void *  kHlpAllocZ(KSIZE cb);
    54 void *  kHlpDup(const void *pv, KSIZE cb);
    55 const char *kHlpStrDup(const char *psz);
    56 void *  kHlpRealloc(void *pv, KSIZE cb);
    57 void    kHlpFree(void *pv);
     52KHLP_DECL(void *)   kHlpAlloc(KSIZE cb);
     53KHLP_DECL(void *)   kHlpAllocZ(KSIZE cb);
     54KHLP_DECL(void *)   kHlpDup(const void *pv, KSIZE cb);
     55KHLP_DECL(char *)   kHlpStrDup(const char *psz);
     56KHLP_DECL(void *)   kHlpRealloc(void *pv, KSIZE cb);
     57KHLP_DECL(void)     kHlpFree(void *pv);
    5858
    59 int     kHlpPageAlloc(void **ppv, KSIZE cb, KPROT enmProt, KBOOL fFixed);
    60 int     kHlpPageProtect(void *pv, KSIZE cb, KPROT enmProt);
    61 int     kHlpPageFree(void *pv, KSIZE cb);
     59KHLP_DECL(int)      kHlpPageAlloc(void **ppv, KSIZE cb, KPROT enmProt, KBOOL fFixed);
     60KHLP_DECL(int)      kHlpPageProtect(void *pv, KSIZE cb, KPROT enmProt);
     61KHLP_DECL(int)      kHlpPageFree(void *pv, KSIZE cb);
    6262
    6363#ifdef __cplusplus
  • trunk/kStuff/include/k/kHlpString.h

    r3550 r3552  
    2727#ifndef ___k_kHlpString_h___
    2828#define ___k_kHlpString_h___
     29
     30#include <k/kDefs.h>
     31#include <k/kTypes.h>
    2932
    3033#if 0 /* optimize / fix this later */
  • trunk/kStuff/kDbg/Makefile.kmk

    r3551 r3552  
    6262        $(TARGET_kDbgStatic) \
    6363        $(subst kDbg,kLdr,$(TARGET_kDbgStatic)) \
    64         $(subst kDbg,kRdr,$(TARGET_kDbgStatic))
     64        $(subst kDbg,kRdr,$(TARGET_kDbgStatic)) \
     65        $(subst kDbg,kHlpCRT,$(TARGET_kDbgStatic))
    6566
    6667# Generate the rules
  • trunk/kStuff/kDbg/kDbgModWinDbgHelp.cpp

    r3550 r3552  
    299299            if (VerQueryValue(pvBuf, "\\", (void **)&pFileInfo, &cbValue))
    300300            {
     301                /** @todo somehow reject 64-bit .dlls when in 32-bit mode... dwFileOS is completely useless. */
    301302                if (    *pu32FileVersionMS < pFileInfo->dwFileVersionMS
    302303                    ||  (   *pu32FileVersionMS == pFileInfo->dwFileVersionMS
     
    443444    /* primitive locking - make some useful API for this kind of spinning! */
    444445    static volatile long s_lLock = 0;
    445     while (!InterlockedCompareExchange(&s_lLock, 1, 0))
     446    while (InterlockedCompareExchange(&s_lLock, 1, 0))
    446447        while (s_lLock)
    447448            Sleep(1);
     
    586587    /* read the file header and the image size in the optional header.. */
    587588    IMAGE_FILE_HEADER FHdr;
    588     rc = kRdrRead(pRdr, &FHdr, sizeof(FHdr), K_OFFSETOF(IMAGE_NT_HEADERS32, FileHeader));
     589    rc = kRdrRead(pRdr, &FHdr, sizeof(FHdr), offHdr + K_OFFSETOF(IMAGE_NT_HEADERS32, FileHeader));
    589590    kDbgAssertRCReturn(rc, rc);
    590591
  • trunk/kStuff/kDbg/kDbgModule.cpp

    r3550 r3552  
    199199        {
    200200            int rc2 = g_aBuiltIns[i]->pfnOpen(ppDbgMod, pRdr, fCloseRdr, off, cb, pLdrMod);
    201             if (!rc)
     201            if (!rc2)
    202202                return 0;
    203203            if (rc2 != KDBG_ERR_UNKOWN_FORMAT && rc == KDBG_ERR_UNKOWN_FORMAT)
     
    209209        {
    210210            int rc2 = g_aBuiltIns[i]->pfnOpen(ppDbgMod, pRdr, fCloseRdr, off, cb, pLdrMod);
    211             if (!rc)
     211            if (!rc2)
    212212                return 0;
    213213            if (rc2 != KDBG_ERR_UNKOWN_FORMAT && rc == KDBG_ERR_UNKOWN_FORMAT)
  • trunk/kStuff/kRdr/kRdrBuffered.cpp

    r3550 r3552  
    233233    KFOFF cbLeft = pThis->cbFile - off;
    234234    KSIZE cbRead = pThis->cbBuf;
    235     if (cbRead - 1 > cbLeft)
     235    if (cbRead - 1 >= cbLeft)
    236236    {
    237237        cbRead--;
  • trunk/kStuff/kRdr/kRdrFile.cpp

    r3546 r3552  
    4747# include <ntstatus.h>
    4848
     49# ifdef __cplusplus
     50  extern "C" {
     51# endif
     52
    4953  /** @todo find a non-conflicting header with NTSTATUS, NTAPI, ++ */
    5054  typedef LONG NTSTATUS;
     
    151155      IN ULONG FreeType
    152156  );
     157
     158# ifdef __cplusplus
     159  }
     160# endif
    153161
    154162#else
Note: See TracChangeset for help on using the changeset viewer.