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
  1. Home
  2. General Programming
  3. COM
  4. CoInitializeSecurity fails in Framework4.0/Win7 but works in Framework3.5/Win7 or in 4.0/WinXp

CoInitializeSecurity fails in Framework4.0/Win7 but works in Framework3.5/Win7 or in 4.0/WinXp

Scheduled Pinned Locked Moved COM
csharphelpvisual-studiohostingdebugging
1 Posts 1 Posters 4 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.
  • S Offline
    S Offline
    Shirarkey
    wrote on last edited by
    #1

    Dear All,I got RPC_E_TOO_LATE(0x80010119) error when call CoInitializeSecurity in VB2010/Framework4.0/win7(x86). But same code works in VB2010/Framework3.5/win7(x86) or in VB2010/Framework4.0/WinXp(x86). The code is below. ' Needed for co-initialize feature (to prevent "Permission Denied" issues) ' When debugging in .NET, turn off the "Enable the Visual Studio hosting process". ' The setting is in Project->Properties->Debug->Enable the Visual Studio hosting process. Imports System.Runtime.InteropServices Module Module1 Const RPC_C_AUTHN_LEVEL_NONE As Integer = 1 Const RPC_C_IMP_LEVEL_ANONYMOUS As Integer = 1 Const EOAC_NONE As Integer = 0 Declare Function CoInitializeSecurity Lib "ole32.dll" ( _ pVoid As IntPtr, cAuthSvc As Int32, asAuthSvc As IntPtr, pReserved1 As IntPtr, _ dwAuthnLevel As UInt32, dwImpLevel As UInt32, _ pAuthList As IntPtr, dwCapabilities As UInt32, pReserved3 As IntPtr) As Integer Sub Main() 'set threading apartment System.Threading.Thread.CurrentThread.SetApartmentState(Threading.ApartmentState.STA) Dim hr As Integer = CoInitializeSecurity( _ IntPtr.Zero, -1, IntPtr.Zero, IntPtr.Zero, _ RPC_C_AUTHN_LEVEL_NONE, RPC_C_IMP_LEVEL_ANONYMOUS, _ IntPtr.Zero, EOAC_NONE, IntPtr.Zero) MsgBox("CoInitializeSecurity returns: 0x" & (Hex(hr))) End Sub End Module I don't know how can i resolve this. Please help me for this. Thanks in advance.

    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