static bool macho_dump_32(char *img, size_t size, lambchop_logger *logger) { char *ptr = img; struct mach_header *hdr; hdr = (struct mach_header*)ptr; ptr += sizeof(struct mach_header); lambchop_debug(logger, "cputype = %s\n", cputype(hdr->cputype)); lambchop_debug(logger, "cpusubtype = 0x%x\n", hdr->cpusubtype); lambchop_debug(logger, "filetype = %s\n", filetype(hdr->filetype)); lambchop_debug(logger, "ncmds = %d\n", hdr->ncmds); lambchop_debug(logger, "sizeofcmds = %d\n", hdr->sizeofcmds); lambchop_debug(logger, "flags = 0x%x\n", hdr->flags); return macho_dump(img, hdr->ncmds, ptr, true, logger); }
unsigned long os_unique() { if (cputype() >= 5) // if cpuid instruction supported { __asm { mov EAX,1 cpuid test EDX,0x20 // is rdtsc supported? jz L1 // no rdtsc } } else { L1: time(NULL); } return _EAX; }