static void debug_out(char *s) { startblit(); WriteConsole(consf, s, strlen(s), NULL, NULL); endblit(); rpclog("%s", s); }
void InitMMC(void) { rpclog("InitMMC()\n"); // Setup base MMC path saferealpath(BaseMMCPath,MMCPath); strcpy(BaseMMCPath,MMCPath); // Load EEPROM snprintf(EEPath,PATHSIZE,"%s/%s",BaseMMCPath,EEFILENAME); LoadEE(); configByte = eeprom[EE_SYSFLAGS]; // Initialise AtoMMC code. at_initprocessor(); rpclog("InitMMC():Done\n"); }
void loaddisc(int drive, char *fn) { int c = 0; char *p; FILE *f; setejecttext(drive, ""); if (!fn) return; p = get_extension(fn); if (!p) return; setejecttext(drive, fn); rpclog("Loading :%i %s %s\n", drive, fn, p); while (loaders[c].ext) { if (!strcasecmp(p, loaders[c].ext)) { driveloaders[drive] = c; loaders[c].load(drive, fn); return; } c++; } // printf("Couldn't load %s %s\n",fn,p); /*No extension match, so guess based on image size*/ f = fopen(fn, "rb"); if (!f) return; fseek(f, -1, SEEK_END); c = ftell(f) + 1; fclose(f); rpclog("Size %i\n", c); if (c <= (200 * 1024)) /*200k DFS - 80*1*10*256*/ { driveloaders[drive] = 0; loaders[0].load(drive, fn); return; } if (c <= (400 * 1024)) /*400k DFS - 80*2*10*256*/ { driveloaders[drive] = 1; loaders[1].load(drive, fn); return; } }
void error(const char *format, ...) { char buf[4096]; va_list ap; va_start(ap, format); vsprintf(buf, format, ap); va_end(ap); rpclog("ERROR: %s\n", buf); MessageBox(NULL, buf, "RPCEmu error", MB_OK); }
void fatal(const char *format, ...) { char buf[4096]; va_list ap; va_start(ap, format); vsprintf(buf, format, ap); va_end(ap); rpclog("FATAL: %s\n", buf); MessageBox(NULL, buf, "RPCEmu error", MB_OK); exit(EXIT_FAILURE); }
int network_plt_init(void) { tunfd = tun_alloc(); /* After attempting to configure the network we no longer need root privileges, so drop them and refuse to carry on if we can't */ /* At the moment we only support extended privilege gain via the setuid on the binary or running rpcemu with the sudo command, this should check for both of them */ if (getuid() == 0 || geteuid() == 0) { /* Running as root */ const char *user = config.username; uid_t uid = 0; gid_t gid = 0; /* Use configured username if available, otherwise see if we are running from a sudo command */ if (user == NULL) { user = getenv("SUDO_USER"); } if (user == NULL) { fatal("No username available to return to non privileged mode, " "refusing to continue running as root"); } if (!nametouidgid(user, &uid, &gid)) { fatal("Could not find username '%s' on the system, or error", user); } if (dropprivileges(uid, gid) < 0) { fatal("Error dropping privileges: %s", strerror(errno)); } rpclog("Networking: Dropping runtime privileges back to '%s'\n", user); } if (tunfd != -1) { return 1; } else { return 0; } }
void reset8271() { fdccallback = callback8271; fdcdata = data8271; fdcspindown = spindown8271; fdcfinishread = finishread8271; fdcnotfound = notfound8271; fdcdatacrcerror = datacrcerror8271; fdcheadercrcerror = headercrcerror8271; fdcwriteprotect = writeprotect8271; fdcgetdata = getdata8271; i8271.paramnum = i8271.paramreq = 0; i8271.status = 0; rpclog("Reset 8271\n"); fdctime = 0; i8271.curtrack[0] = i8271.curtrack[1] = 0; i8271.command = 0xFF; i8271.realtrack[0] = i8271.realtrack[1] = 0; // motorspin=45000; }
/* Transmit data errbuf - pointer to buffer to return error string mbufs - pointer to mbuf chain containing data to send dest - pointer to detination MAC address src - pointer to source MAC address, or 0 to use default returns errbuf on error, else zero */ uint32_t network_plt_tx(uint32_t errbuf, uint32_t mbufs, uint32_t dest, uint32_t src, uint32_t frametype) { unsigned char *buf = buffer; struct mbuf txb; int packetlength; int ret; int i; if (tap_handle == NULL) { strcpyfromhost(errbuf, "RPCEmu: Networking not available"); return errbuf; } /* Ethernet packet is 6 bytes destination MAC address 6 bytes source MAC address 2 bytes frame type (Ethernet II) or length (IEEE 802.3) up to 1500 bytes payload */ memcpytohost(buf, dest, 6); buf += 6; if (src) { memcpytohost(buf, src, 6); } else { /* Make up a MAC address. As this is only going on the TAP device and not a real ethernet then it doesn't need to be unique, just different to the MAC on the other end of the tunnel. */ for (i = 0; i < 6; i++) { buf[i] = network_hwaddr[i]; } } buf += 6; *buf++ = (frametype>>8) & 0xFF; *buf++ = frametype & 0xFF; #if defined RPCLOG rpclog("===== SEND HEADER =====\n"); rpclog("dst_addr: %02x:%02x:%02x:%02x:%02x:%02x\n", buffer[0], buffer[1], buffer[2], buffer[3], buffer[4], buffer[5]); rpclog("src_addr: %02x:%02x:%02x:%02x:%02x:%02x\n", buffer[6], buffer[7], buffer[8], buffer[9], buffer[10], buffer[11]); rpclog("frame_type: %d\n", frametype); #endif packetlength = HEADERLEN; /* Copy the mbuf chain as the payload */ while (mbufs) { memcpytohost(&txb, mbufs, sizeof(struct mbuf)); packetlength += txb.m_len; if (packetlength > sizeof(buffer)) { strcpyfromhost(errbuf, "RPCEmu: Packet too large to send"); return errbuf; } memcpytohost(buf, mbufs + txb.m_off, txb.m_len); buf += txb.m_len; mbufs = txb.m_next; } #if defined RPCLOG rpclog("send %d bytes\n", packetlength); if (packetlength > 0) { char dump[2048 * 3]; int offset = 0; int i; for (i = 0; i < packetlength; i++) { offset += sprintf(dump + offset, "%02x ", buffer[i]); } rpclog("data: %s\n", dump); } #endif ret = tap_send(tap_handle, buffer, packetlength); if (ret == -1) { strcpyfromhost(errbuf, strerror(errno)); return errbuf; } return 0; }
uint32_t network_plt_rx(uint32_t errbuf, uint32_t mbuf, uint32_t rxhdr, uint32_t *dataavail) { struct mbuf rxb; struct rx_hdr hdr; int packetlength; *dataavail = 0; if (tap_handle == NULL) { strcpyfromhost(errbuf, "RPCEmu: Networking not available"); return errbuf; } memset(&hdr, 0, sizeof(hdr)); packetlength = tap_receive(tap_handle, buffer, sizeof(buffer)); #if defined RPCLOG rpclog("received %d bytes\n", packetlength); if (packetlength > 0) { char dump[2048 * 3]; int offset = 0; int i; for (i = 0; i < packetlength; i++) { offset += sprintf(dump + offset, "%02x ", buffer[i]); } rpclog("data: %s\n", dump); } #endif if (mbuf && packetlength > HEADERLEN) { unsigned char *payload = buffer + HEADERLEN; /* Fill in recieved header structure */ memcpy(hdr.rx_dst_addr, buffer + 0, 6); memcpy(hdr.rx_src_addr, buffer + 6, 6); hdr.rx_frame_type = (buffer[12] << 8) | buffer[13]; hdr.rx_error_level = 0; memcpyfromhost(rxhdr, &hdr, sizeof(hdr)); #if defined RPCLOG rpclog("===== HEADER =====\n"); rpclog("dst_addr: %02x:%02x:%02x:%02x:%02x:%02x\n", buffer[0], buffer[1], buffer[2], buffer[3], buffer[4], buffer[5]); rpclog("src_addr: %02x:%02x:%02x:%02x:%02x:%02x\n", buffer[6], buffer[7], buffer[8], buffer[9], buffer[10], buffer[11]); rpclog("frame_type: %d\n", hdr.rx_frame_type); #endif packetlength -= HEADERLEN; memcpytohost(&rxb, mbuf, sizeof(rxb)); if (packetlength > rxb.m_inilen) { strcpyfromhost(errbuf, "RPCEmu: Mbuf too small for received packet"); return errbuf; } else { /* Copy payload in to the mbuf */ rxb.m_off = rxb.m_inioff; memcpyfromhost(mbuf + rxb.m_off, payload, packetlength); rxb.m_len = packetlength; memcpyfromhost(mbuf, &rxb, sizeof(rxb)); *dataavail = 1; } #if defined RPCLOG rpclog("============\n"); #endif } return 0; }
void debugger_do() { int c, d, e, f; int params; uint8_t temp; char outs[256]; char ins[256]; if (!opcode) { sprintf(outs, "BRK %04X! %04X %04X\n", pc, oldpc, oldoldpc); debug_out(outs); } if (!opcode) debug = 1; for (c = 0; c < 8; c++) { if (breakpoints[c] == pc) { debug = 1; sprintf(outs, " Break at %04X\n", pc); debug_out(outs); } } if (!debug) return; // if (!opcode) printf("BRK at %04X\n",pc); if (debugstep) { debugstep--; if (debugstep) return; } indebug = 1; while (1) { d = debug_disaddr; debug_disaddr = pc; debug_disassemble(); debug_disaddr = d; sprintf(outs, " >"); debug_out(outs); #ifdef WIN32 c = ReadConsoleA(cinf, ins, 255, (LPDWORD)&d, NULL); ins[d] = 0; #else d = (int)fgets(ins, 255, stdin); #endif d = 0; while (ins[d] != 32 && ins[d] != 0xA && ins[d] != 0xD && ins[d] != 0) d++; while (ins[d] == 32) d++; if (ins[d] == 0xA || ins[d] == 0xD || ins[d] == 0) params = 0; else params = 1; if (ins[0] == 0xA || ins[0] == 0xD) ins[0] = debug_lastcommand; //debug_out("Processing!\n"); switch (ins[0]) { case 'c': case 'C': debug = 0; indebug = 0; return; case 'm': case 'M': if (params) sscanf(&ins[d], "%X", (unsigned int *)&debug_memaddr); for (c = 0; c < 16; c++) { sprintf(outs, " %04X : ", debug_memaddr); debug_out(outs); for (d = 0; d < 16; d++) { sprintf(outs, "%02X ", debug_readmem(debug_memaddr + d)); debug_out(outs); } debug_out(" "); for (d = 0; d < 16; d++) { temp = debug_readmem(debug_memaddr + d); if (temp < 32) sprintf(outs, "."); else sprintf(outs, "%c", temp); debug_out(outs); } debug_memaddr += 16; debug_out("\n"); } break; case 'd': case 'D': if (params) sscanf(&ins[d], "%X", (unsigned int *)&debug_disaddr); for (c = 0; c < 12; c++) { debug_out(" "); debug_disassemble(); debug_out("\n"); } break; case 'r': case 'R': if (params) { if (!strncasecmp(&ins[d], "sysvia", 6)) { sprintf(outs, " System VIA registers :\n"); debug_out(outs); sprintf(outs, " ORA %02X ORB %02X IRA %02X IRB %02X\n", sysvia.ora, sysvia.orb, sysvia.ira, sysvia.irb); debug_out(outs); sprintf(outs, " DDRA %02X DDRB %02X ACR %02X PCR %02X\n", sysvia.ddra, sysvia.ddrb, sysvia.acr, sysvia.pcr); debug_out(outs); sprintf(outs, " Timer 1 latch %04X count %04X\n", sysvia.t1l / 2, (sysvia.t1c / 2) & 0xFFFF); debug_out(outs); sprintf(outs, " Timer 2 latch %04X count %04X\n", sysvia.t2l / 2, (sysvia.t2c / 2) & 0xFFFF); debug_out(outs); sprintf(outs, " IER %02X IFR %02X\n", sysvia.ier, sysvia.ifr); debug_out(outs); } if (!strncasecmp(&ins[d], "uservia", 7)) { sprintf(outs, " User VIA registers :\n"); debug_out(outs); sprintf(outs, " ORA %02X ORB %02X IRA %02X IRB %02X\n", uservia.ora, uservia.orb, uservia.ira, uservia.irb); debug_out(outs); sprintf(outs, " DDRA %02X DDRB %02X ACR %02X PCR %02X\n", uservia.ddra, uservia.ddrb, uservia.acr, uservia.pcr); debug_out(outs); sprintf(outs, " Timer 1 latch %04X count %04X\n", uservia.t1l / 2, (uservia.t1c / 2) & 0xFFFF); debug_out(outs); sprintf(outs, " Timer 2 latch %04X count %04X\n", uservia.t2l / 2, (uservia.t2c / 2) & 0xFFFF); debug_out(outs); sprintf(outs, " IER %02X IFR %02X\n", uservia.ier, uservia.ifr); debug_out(outs); } if (!strncasecmp(&ins[d], "crtc", 4)) { sprintf(outs, " CRTC registers :\n"); debug_out(outs); sprintf(outs, " Index=%i\n", crtc_i); debug_out(outs); sprintf(outs, " R0 =%02X R1 =%02X R2 =%02X R3 =%02X R4 =%02X R5 =%02X R6 =%02X R7 =%02X R8 =%02X\n", crtc[0], crtc[1], crtc[2], crtc[3], crtc[4], crtc[5], crtc[6], crtc[7], crtc[8]); debug_out(outs); sprintf(outs, " R9 =%02X R10=%02X R11=%02X R12=%02X R13=%02X R14=%02X R15=%02X R16=%02X R17=%02X\n", crtc[9], crtc[10], crtc[11], crtc[12], crtc[13], crtc[14], crtc[15], crtc[16], crtc[17]); debug_out(outs); sprintf(outs, " VC=%i SC=%i HC=%i MA=%04X\n", vc, sc, hc, ma); debug_out(outs); } if (!strncasecmp(&ins[d],"vidproc",7)) { sprintf(outs, " VIDPROC registers :\n"); debug_out(outs); sprintf(outs, " Control=%02X\n", ula_ctrl); debug_out(outs); sprintf(outs, " Palette entries :\n"); debug_out(outs); sprintf(outs, " 0=%01X 1=%01X 2=%01X 3=%01X 4=%01X 5=%01X 6=%01X 7=%01X\n", ula_palbak[0], ula_palbak[1], ula_palbak[2], ula_palbak[3], ula_palbak[4], ula_palbak[5], ula_palbak[6], ula_palbak[7]); debug_out(outs); sprintf(outs, " 8=%01X 9=%01X 10=%01X 11=%01X 12=%01X 13=%01X 14=%01X 15=%01X\n", ula_palbak[8], ula_palbak[9], ula_palbak[10], ula_palbak[11], ula_palbak[12], ula_palbak[13], ula_palbak[14], ula_palbak[15]); debug_out(outs); } if (!strncasecmp(&ins[d],"sound",5)) { sprintf(outs, " Sound registers :\n"); debug_out(outs); sprintf(outs, " Voice 0 frequency = %04X volume = %i control = %02X\n", sn_latch[0] >> 6, sn_vol[0], sn_noise); debug_out(outs); sprintf(outs, " Voice 1 frequency = %04X volume = %i\n", sn_latch[1] >> 6, sn_vol[1]); debug_out(outs); sprintf(outs, " Voice 2 frequency = %04X volume = %i\n", sn_latch[2] >> 6, sn_vol[2]); debug_out(outs); sprintf(outs, " Voice 3 frequency = %04X volume = %i\n", sn_latch[3] >> 6, sn_vol[3]); debug_out(outs); } } else { sprintf(outs, " 6502 registers :\n"); debug_out(outs); sprintf(outs, " A=%02X X=%02X Y=%02X S=01%02X PC=%04X\n", a, x, y, s, pc); debug_out(outs); sprintf(outs, " Status : %c%c%c%c%c%c\n", (p.n) ? 'N' : ' ', (p.v) ? 'V' : ' ', (p.d) ? 'D' : ' ', (p.i) ? 'I' : ' ', (p.z) ? 'Z' : ' ', (p.c) ? 'C' : ' '); debug_out(outs); } break; case 's': case 'S': if (params) sscanf(&ins[d], "%i", &debugstep); else debugstep = 1; debug_lastcommand = ins[0]; indebug = 0; return; case 'b': case 'B': if (!strncasecmp(ins, "breakr", 6)) { if (!params) break; for (c = 0; c < 8; c++) { if (breakpoints[c] == -1) { sscanf(&ins[d], "%X", &breakr[c]); sprintf(outs, " Read breakpoint %i set to %04X\n", c, breakr[c]); debug_out(outs); break; } } } else if (!strncasecmp(ins, "breakw", 6)) { if (!params) break; for (c = 0; c < 8; c++) { if (breakpoints[c] == -1) { sscanf(&ins[d], "%X", &breakw[c]); sprintf(outs, " Write breakpoint %i set to %04X\n", c, breakw[c]); debug_out(outs); break; } } } else if (!strncasecmp(ins, "break", 5)) { if (!params) break; for (c = 0; c < 8; c++) { if (breakpoints[c] == -1) { sscanf(&ins[d], "%X", &breakpoints[c]); sprintf(outs, " Breakpoint %i set to %04X\n", c, breakpoints[c]); debug_out(outs); break; } } } if (!strncasecmp(ins, "blist", 5)) { for (c = 0; c < 8; c++) { if (breakpoints[c] != -1) { sprintf(outs, " Breakpoint %i : %04X\n", c, breakpoints[c]); debug_out(outs); } } for (c = 0; c < 8; c++) { if (breakr[c] != -1) { sprintf(outs, " Read breakpoint %i : %04X\n", c, breakr[c]); debug_out(outs); } } for (c = 0; c < 8; c++) { if (breakw[c] != -1) { sprintf(outs, " Write breakpoint %i : %04X\n", c, breakw[c]); debug_out(outs); } } } if (!strncasecmp(ins, "bclearr", 7)) { if (!params) break; sscanf(&ins[d], "%X", &e); for (c = 0; c < 8; c++) { if (breakr[c] == e) breakr[c] = -1; if (c == e) breakr[c] = -1; } } else if (!strncasecmp(ins, "bclearw", 7)) { if (!params) break; sscanf(&ins[d], "%X", &e); for (c = 0; c < 8; c++) { if (breakw[c] == e) breakw[c] = -1; if (c == e) breakw[c] = -1; } } else if (!strncasecmp(ins, "bclear", 6)) { if (!params) break; sscanf(&ins[d], "%X", &e); for (c = 0; c < 8; c++) { if (breakpoints[c] == e) breakpoints[c] = -1; if (c == e) breakpoints[c] = -1; } } break; case 'w': case 'W': if (!strncasecmp(ins, "watchr", 6)) { if (!params) break; for (c = 0; c < 8; c++) { if (watchr[c] == -1) { sscanf(&ins[d], "%X", &watchr[c]); sprintf(outs, " Read watchpoint %i set to %04X\n", c, watchr[c]); debug_out(outs); break; } } break; } if (!strncasecmp(ins, "watchw", 6)) { if (!params) break; for (c = 0; c < 8; c++) { if (watchw[c] == -1) { sscanf(&ins[d], "%X", &watchw[c]); sprintf(outs, " Write watchpoint %i set to %04X\n", c, watchw[c]); debug_out(outs); break; } } break; } if (!strncasecmp(ins, "wlist", 5)) { for (c = 0; c < 8; c++) { if (watchr[c] != -1) { sprintf(outs, " Read watchpoint %i : %04X\n", c, watchr[c]); debug_out(outs); } } for (c = 0; c < 8; c++) { if (watchw[c] != -1) { sprintf(outs, " Write watchpoint %i : %04X\n", c, watchw[c]); debug_out(outs); } } } if (!strncasecmp(ins, "wclearr", 7)) { if (!params) break; sscanf(&ins[d], "%X", &e); for (c = 0; c < 8; c++) { if (watchr[c] == e) watchr[c] = -1; if (c == e) watchr[c] = -1; } } else if (!strncasecmp(ins, "wclearw", 7)) { if (!params) break; sscanf(&ins[d], "%X", &e); for (c = 0; c < 8; c++) { if (watchw[c] == e) watchw[c] = -1; if (c == e) watchw[c] = -1; } } else if (!strncasecmp(ins, "writem", 6)) { if (!params) break; sscanf(&ins[d], "%X %X", &e, &f); rpclog("WriteM %04X %04X\n", e, f); writemem(e, f); } break; case 'q': case 'Q': setquit(); while (1); break; case 'h': case 'H': case '?': sprintf(outs, "\n Debugger commands :\n\n"); debug_out(outs); sprintf(outs, " bclear n - clear breakpoint n or breakpoint at n\n"); debug_out(outs); sprintf(outs, " bclearr n - clear read breakpoint n or read breakpoint at n\n"); debug_out(outs); sprintf(outs, " bclearw n - clear write breakpoint n or write breakpoint at n\n"); debug_out(outs); sprintf(outs, " blist - list current breakpoints\n"); debug_out(outs); sprintf(outs, " break n - set a breakpoint at n\n"); debug_out(outs); sprintf(outs, " breakr n - break on reads from address n\n"); debug_out(outs); sprintf(outs, " breakw n - break on writes to address n\n"); debug_out(outs); sprintf(outs, " c - continue running indefinitely\n"); debug_out(outs); sprintf(outs, " d [n] - disassemble from address n\n"); debug_out(outs); sprintf(outs, " m [n] - memory dump from address n\n"); debug_out(outs); sprintf(outs, " q - force emulator exit\n"); debug_out(outs); sprintf(outs, " r - print 6502 registers\n"); debug_out(outs); sprintf(outs, " r sysvia - print System VIA registers\n"); debug_out(outs); sprintf(outs, " r uservia - print User VIA registers\n"); debug_out(outs); sprintf(outs, " r crtc - print CRTC registers\n"); debug_out(outs); sprintf(outs, " r vidproc - print VIDPROC registers\n"); debug_out(outs); sprintf(outs, " r sound - print Sound registers\n"); debug_out(outs); sprintf(outs, " s [n] - step n instructions (or 1 if no parameter)\n\n"); debug_out(outs); sprintf(outs, " watchr n - watch reads from address n\n"); debug_out(outs); sprintf(outs, " watchw n - watch writes to address n\n"); debug_out(outs); sprintf(outs, " wclearr n - clear read watchpoint n or read watchpoint at n\n"); debug_out(outs); sprintf(outs, " wclearw n - clear write watchpoint n or write watchpoint at n\n"); debug_out(outs); sprintf(outs, " writem a v - write to memory, a = address, v = value\n"); debug_out(outs); break; }
Context::Context(Server* pServer) : mServer(pServer), mLog(rpclog(), "RPC") { mTimer.start(); }
/** * Dialog procedure to handle events on the networking window * * @param hdlg Handle to current program instance * @param message Event type this dialog has just received * @param wParam message specific data * @param lParam message specific data * @return */ static BOOL CALLBACK networkdlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { char default_bridgename[] = "rpcemu"; switch (message) { case WM_INITDIALOG: /* Network Type */ if (config.network_type == NetworkType_EthernetBridging) { SendMessage(GetDlgItem(hdlg, RadioButton_Off), BM_SETCHECK, 0, 0); SendMessage(GetDlgItem(hdlg, RadioButton_EthernetBridging), BM_SETCHECK, 1, 0); /* Make sure Bridgename is visible */ EnableWindow(GetDlgItem(hdlg, Edit_BridgeName), 1); EnableWindow(GetDlgItem(hdlg, Text_BridgeName), 1); } else { SendMessage(GetDlgItem(hdlg, RadioButton_EthernetBridging), BM_SETCHECK, 0, 0); SendMessage(GetDlgItem(hdlg, RadioButton_Off), BM_SETCHECK, 1, 0); /* Disable bridgename */ EnableWindow(GetDlgItem(hdlg, Edit_BridgeName), 0); EnableWindow(GetDlgItem(hdlg, Text_BridgeName), 0); } /* Bridge name */ SendMessage(GetDlgItem(hdlg, Edit_BridgeName), WM_SETTEXT, 0, config.bridgename ? (LPARAM) config.bridgename : (LPARAM) default_bridgename); return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: { NetworkType selected_network_type = NetworkType_Off; char gui_bridgename[50] = ""; /* User has clicked on the OK button of the config dialog, apply their changes */ if (SendMessage(GetDlgItem(hdlg, RadioButton_Off), BM_GETCHECK, 0, 0) == BST_CHECKED) { selected_network_type = NetworkType_Off; } else if (SendMessage(GetDlgItem(hdlg, RadioButton_EthernetBridging), BM_GETCHECK, 0, 0) == BST_CHECKED) { selected_network_type = NetworkType_EthernetBridging; } else { rpclog("Unknown network type returned from GUI, defaulting to off"); selected_network_type = NetworkType_Off; } GetWindowText(GetDlgItem(hdlg, Edit_BridgeName), (LPSTR) &gui_bridgename, 50); /* Pass on the values to the core, to see if we need to reboot */ if (network_config_changed(selected_network_type, gui_bridgename, NULL)) { resetrpc(); } EndDialog(hdlg, 0); return TRUE; } case IDCANCEL: EndDialog(hdlg, 0); return TRUE; case RadioButton_EthernetBridging: SendMessage(GetDlgItem(hdlg, RadioButton_Off), BM_SETCHECK, 0, 0); SendMessage(GetDlgItem(hdlg, RadioButton_EthernetBridging), BM_SETCHECK, 1, 0); /* Make sure Bridgename is visible */ EnableWindow(GetDlgItem(hdlg, Edit_BridgeName), 1); EnableWindow(GetDlgItem(hdlg, Text_BridgeName), 1); return TRUE; case RadioButton_Off: SendMessage(GetDlgItem(hdlg, RadioButton_EthernetBridging), BM_SETCHECK, 0, 0); SendMessage(GetDlgItem(hdlg, RadioButton_Off), BM_SETCHECK, 1, 0); /* Disable bridgename */ EnableWindow(GetDlgItem(hdlg, Edit_BridgeName), 0); EnableWindow(GetDlgItem(hdlg, Text_BridgeName), 0); return TRUE; } } return FALSE; }
/** * Log details about the current Operating System version. * * Called during program start-up. */ void rpcemu_log_os(void) { typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD); OSVERSIONINFOEX osvi; SYSTEM_INFO si; PGNSI pGNSI; rpclog("OS: Microsoft Windows\n"); memset(&osvi, 0, sizeof(osvi)); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); if (!GetVersionEx((OSVERSIONINFO *) &osvi)) { rpclog("OS: Failed GetVersionEx()\n"); return; } pGNSI = (PGNSI) GetProcAddress(GetModuleHandle("kernel32.dll"), "GetNativeSystemInfo"); if (pGNSI != NULL) { pGNSI(&si); } else { GetSystemInfo(&si); } rpclog("OS: PlatformId = %ld\n", osvi.dwPlatformId); rpclog("OS: MajorVersion = %ld\n", osvi.dwMajorVersion); rpclog("OS: MinorVersion = %ld\n", osvi.dwMinorVersion); /* If earlier than Windows 2000, log no more detail */ if (osvi.dwPlatformId != VER_PLATFORM_WIN32_NT || osvi.dwMajorVersion < 5) { return; } rpclog("OS: ProductType = %d\n", osvi.wProductType); rpclog("OS: SuiteMask = 0x%x\n", osvi.wSuiteMask); rpclog("OS: ServicePackMajor = %d\n", osvi.wServicePackMajor); rpclog("OS: ServicePackMinor = %d\n", osvi.wServicePackMinor); rpclog("OS: ProcessorArchitecture = %d\n", si.wProcessorArchitecture); rpclog("OS: SystemMetricsServerR2 = %d\n", GetSystemMetrics(SM_SERVERR2)); if (osvi.dwMajorVersion >= 6) { PGPI pGPI; DWORD dwType; pGPI = (PGPI) GetProcAddress(GetModuleHandle("kernel32.dll"), "GetProductInfo"); pGPI(osvi.dwMajorVersion, osvi.dwMinorVersion, 0, 0, &dwType); rpclog("OS: ProductInfoType = %ld\n", dwType); } }