diff --git a/contrib/MSR Driver/Kernel/TmpRdr.c b/drivers/x86/windows/msr/Kernel/TmpRdr.c similarity index 100% rename from contrib/MSR Driver/Kernel/TmpRdr.c rename to drivers/x86/windows/msr/Kernel/TmpRdr.c diff --git a/contrib/MSR Driver/Kernel/TmpRdr.vcproj b/drivers/x86/windows/msr/Kernel/TmpRdr.vcproj similarity index 100% rename from contrib/MSR Driver/Kernel/TmpRdr.vcproj rename to drivers/x86/windows/msr/Kernel/TmpRdr.vcproj diff --git a/contrib/MSR Driver/Kernel/resource.h b/drivers/x86/windows/msr/Kernel/resource.h similarity index 100% rename from contrib/MSR Driver/Kernel/resource.h rename to drivers/x86/windows/msr/Kernel/resource.h diff --git a/contrib/MSR Driver/Kernel/tmprdr.rc b/drivers/x86/windows/msr/Kernel/tmprdr.rc similarity index 100% rename from contrib/MSR Driver/Kernel/tmprdr.rc rename to drivers/x86/windows/msr/Kernel/tmprdr.rc diff --git a/contrib/MSR Driver/TmpRdr.sys b/drivers/x86/windows/msr/TmpRdr.sys similarity index 100% rename from contrib/MSR Driver/TmpRdr.sys rename to drivers/x86/windows/msr/TmpRdr.sys diff --git a/contrib/MSR Driver/TmpRdr64.sys b/drivers/x86/windows/msr/TmpRdr64.sys similarity index 100% rename from contrib/MSR Driver/TmpRdr64.sys rename to drivers/x86/windows/msr/TmpRdr64.sys diff --git a/libcpuid/msrdriver.c b/libcpuid/msrdriver.c index f67db89..e8c3da1 100644 --- a/libcpuid/msrdriver.c +++ b/libcpuid/msrdriver.c @@ -30,7 +30,7 @@ * @Date 2009-09-29 * * The driver is courtesy of Nick 'Bombera' Gabareff, and its source is actually - * available, see the contrib/ dir. + * available, see the drivers/x86/windows/msr/ dir. * * However, for simplicity, here we just include the images of the compiled .SYS * files. diff --git a/libcpuid/embed_drivers.cpp b/utils/embed_windows_drivers.cpp similarity index 81% rename from libcpuid/embed_drivers.cpp rename to utils/embed_windows_drivers.cpp index 5fa2152..5b8aeff 100644 --- a/libcpuid/embed_drivers.cpp +++ b/utils/embed_windows_drivers.cpp @@ -7,18 +7,15 @@ #include using namespace std; -const char* drivers_root = "..\\contrib\\MSR Driver\\"; -const char* sourcefile = "msrdriver.c"; - char* images[2]; int sizes[2]; const char* filenames[] = { "TmpRdr.sys", "TmpRdr64.sys" }; vector source; -bool read_image(const char* filename, char*& image, int& isize) +bool read_image(const char* drivers_root, const char* filename, char*& image, int& isize) { char fn[512]; - sprintf(fn, "%s%s", drivers_root, filename); + sprintf(fn, "%s\\%s", drivers_root, filename); FILE* f = fopen(fn, "rb"); if (!f) return false; fseek(f, 0, SEEK_END); @@ -57,10 +54,17 @@ void print_image(FILE* f, const char* arch, const char* image, int size) fprintf(f, "\n};\n"); } -int main(void) +int main(int argc, char** argv) { + if (argc < 3) { + printf("%s DRIVER_ROOT_FOLDER SOURCE_FILE\n", argv[0]); + return 1; + } + const char* drivers_root = argv[1]; + const char* sourcefile = argv[2]; + for (int i = 0; i < 2; i++) - if (!read_image(filenames[i], images[i], sizes[i])) { + if (!read_image(drivers_root, filenames[i], images[i], sizes[i])) { printf("Cannot read image `%s' from `%s'!\n", filenames[i], drivers_root); return -1; }