diff --git a/xCAT-server/share/xcat/netboot/windows/getnextserver.cpp b/xCAT-server/share/xcat/netboot/windows/getnextserver.cpp new file mode 100755 index 000000000..b479b9d46 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/windows/getnextserver.cpp @@ -0,0 +1,23 @@ +/* Another Windows C file. Build is much like the other, install MS SDK, + * then run in the 'CMD shell' under SDK folder: + * cl getnextserver.cpp advapi32.lib + */ +#include +#include +#include + +int main(int argc, char* argv[]) { + const char* subkey = "System\\CurrentControlSet\\Control\\PXE"; + HKEY key=0; + DWORD pxedatasize; + LPBYTE pxedata; + DWORD regType; + if (RegOpenKey(HKEY_LOCAL_MACHINE,subkey,&key) == ERROR_SUCCESS) { + // Ok, so we have found PXE, we can get next-server, woo + RegQueryValueEx(key,"BootServerReply",0,®Type,NULL, &pxedatasize); + pxedata=(LPBYTE)malloc(pxedatasize); + RegQueryValueEx(key,"BootServerReply",0,®Type,pxedata, &pxedatasize); + printf("%d.%d.%d.%d\n",pxedata[0x14],pxedata[0x15],pxedata[0x16],pxedata[0x17]); + } +} + diff --git a/xCAT-server/share/xcat/netboot/windows/getnextserver.exe b/xCAT-server/share/xcat/netboot/windows/getnextserver.exe new file mode 100755 index 000000000..d5f9d57f9 Binary files /dev/null and b/xCAT-server/share/xcat/netboot/windows/getnextserver.exe differ