Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. CreateIPForwardEntry() returning ERROR_INVALID_PARAMETER... please help!!

CreateIPForwardEntry() returning ERROR_INVALID_PARAMETER... please help!!

Scheduled Pinned Locked Moved C#
databasehelpquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    b_girl
    wrote on last edited by
    #1

    Hello, I am currently needing to use CreateIPForwardEntry() to add an entry into the routing table. I have created a PMIB_IPFORWARDROW structure and I know that I've assigned something incorrectly but am not sure what it is. Can someone please take a look at this to see if you notice anything incorrect? I have a feeling it might be dwForwardMask - which I want to be 255.255.0.0 Thanks.. [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct PMIB_IPFORWARDROW { public UInt32 dwForwardDest; public UInt32 dwForwardMask; public UInt32 dwForwardPolicy; public UInt32 dwForwardNextHop; public UInt32 dwForwardIfIndex; public UInt32 dwForwardType; public UInt32 dwForwardProto; public UInt32 dwForwardAge; public UInt32 dwForwardNextHopAS; public UInt32 dwForwardMetric1; public UInt32 dwForwardMetric2; public UInt32 dwForwardMetric3; public UInt32 dwForwardMetric4; public UInt32 dwForwardMetric5; } ... UInt32 uintO1, uintO2, uintO3, uintO4, dwForwardDest, dwForwardNextHop; uintO1 = Convert.ToUInt32("10"); uintO2 = Convert.ToUInt32("30"); uintO3 = Convert.ToUInt32("0"); uintO4 = Convert.ToUInt32("0"); dwForwardDest = (uintO1 << 24) + (uintO2 << 16) + (uintO3 << 8) + uintO4; uintO3 = Convert.ToUInt32("79"); uintO4 = Convert.ToUInt32("5"); dwForwardNextHop = (uintO1 << 24) + (uintO2 << 16) + (uintO3 << 8) + uintO4; PMIB_IPFORWARDROW pmibip = new PMIB_IPFORWARDROW(); pmibip.dwForwardDest = dwForwardDest; unchecked { pmibip.dwForwardMask = (UInt32)((255 << 24) + (255 << 16) + (0 << 8) + 0); //pmibip.dwForwardMask = 24; //pmibip.dwForwardMask = (uint)0x00255255; } pmibip.dwForwardPolicy = Convert.ToUInt32("0"); pmibip.dwForwardIfIndex = dwForwardNextHop; //index of adaptor when doing route print displays as being same as gateway pmibip.dwForwardNextHop = dwForwardNextHop; pmibip.dwForwardType = 4; pmibip.dwForwardProto = PROTO_IP_NETMGMT; pmibip.dwForwardAge = 43200; //12 hours

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups