| 463 | U32 ipAddress(); |
| 464 | |
| 465 | U32 KNetLinkObject::sendto(KThread* thread, const KFileDescriptorPtr& fd, U32 message, U32 length, U32 sendtoFlags, U32 dest_addr, U32 dest_len) { |
| 466 | |
| 467 | if (length >= 16) { |
| 468 | //U32 len = thread->memory->readd(message); |
| 469 | U16 type = thread->memory->readw(message + 4); |
| 470 | //U16 flags = thread->memory->readw(message + 6); |
| 471 | U32 seq = thread->memory->readd(message + 8); |
| 472 | //U32 pid = thread->memory->readd(message + 12); |
| 473 | |
| 474 | // start in Wine 7 (with Tiny Core Linux), this function will crash if I don't return something. I'm not sure if what I'm returning is correct, but it stops the crash |
| 475 | // |
| 476 | // dlls\nsiproxy.sys\ndis.c |
| 477 | // static unsigned int update_if_table( void ) |
| 478 | // { |
| 479 | // struct if_nameindex* indices = if_nameindex(), * entry; |
| 480 | // unsigned int append_count = 0; |
| 481 | // |
| 482 | // for (entry = indices; entry->if_index; entry++) |
| 483 | if (type == 0x12) { // RTM_GETLINK |
| 484 | //U8 ifa_family = thread->memory->readb(message + 12); |
| 485 | |
| 486 | BOXEDWINE_CRITICAL_SECTION_WITH_CONDITION(lockCond); |
| 487 | |
| 488 | boxed_nlmsghdr hdr; |
| 489 | boxed_ifinfomsg msg; |
| 490 | hdr.nlmsg_len = sizeof(hdr) + sizeof(msg) + 16; |
| 491 | hdr.nlmsg_type = 16; // RTM_NEWLINK |
| 492 | hdr.nlmsg_flags = 0x301; // NLM_F_REQUEST | NLM_F_DUMP |
| 493 | hdr.nlmsg_seq = seq; |
| 494 | hdr.nlmsg_pid = afBound->nl_pid; |
| 495 | msg.ifi_family = 0; |
| 496 | msg.ifi_type = 1; |
| 497 | msg.ifi_index = 1; |
| 498 | msg.ifi_flags = 0; |
| 499 | msg.ifi_change = 0xffffffff; |
| 500 | |
| 501 | recvBuffer.insert(recvBuffer.end(), (U8*)&hdr, ((U8*)&hdr) + sizeof(hdr)); |
| 502 | recvBuffer.insert(recvBuffer.end(), (U8*)&msg, ((U8*)&msg) + sizeof(msg)); |
| 503 | |
| 504 | append((U16)8); |
| 505 | append((U16)1); // IFLA_ADDRESS |
| 506 | append((U32)0x0100007f); |
| 507 | |
| 508 | append((U16)7); |
| 509 | append((U16)3); // IFLA_IFNAME |
| 510 | append("lo"); |
| 511 | append((U8)0); // pad |
| 512 | |
| 513 | boxed_nlmsghdr hdr2; |
| 514 | boxed_ifinfomsg msg2; |
| 515 | hdr2.nlmsg_len = sizeof(hdr2) + sizeof(msg2) + 28; |
| 516 | hdr2.nlmsg_type = type; |
| 517 | hdr2.nlmsg_flags = 0x301; // NLM_F_REQUEST | NLM_F_DUMP |
| 518 | hdr2.nlmsg_seq = seq; |
| 519 | hdr2.nlmsg_pid = afBound->nl_pid; |
| 520 | msg2.ifi_family = 0; |
| 521 | msg2.ifi_type = 1; |
| 522 | msg2.ifi_index = 2; |