mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-31 03:12:30 +00:00 
			
		
		
		
	git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10668 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
		
			
				
	
	
		
			24 lines
		
	
	
		
			816 B
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			816 B
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
| /* 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 <windows.h>
 | |
| #include <stdio.h>
 | |
| #include <malloc.h>
 | |
| 
 | |
| 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]);
 | |
| 	}
 | |
| }
 | |
| 
 |