0
votes

Since IE 9.0.2 update my addon is not working. I need to get an user cookie to properly handle a user related action.

#include <windows.h>
#include <wininet.h>

void MyClass::Exec(String^ a, String^ b) {
    HANDLE hCacheDir; 
    DWORD size = 4096;
    INTERNET_CACHE_ENTRY_INFO entry;
    entry.dwStructSize = size;
    hCacheDir = FindFirstUrlCacheEntry(L"cookie:my.domain.com", &entry, &size);
    if (hCacheDir) {
        String^ file = gcnew String(entry.lpszLocalFileName);
        ...
    }
}

When I try to compile this C++/CLI code, it throws a compile error:

Error 1 error LNK2028: unresolved token (0A00002E) "extern "C" void * __stdcall FindFirstUrlCacheEntryW(wchar_t const *,struct _INTERNET_CACHE_ENTRY_INFOW *,unsigned long *)" (?FindFirstUrlCacheEntryW@@$$J212YGPAXPB_WPAU_INTERNET_CACHE_ENTRY_INFOW@@PAK@Z) referenced in function "public: static void __clrcall MyClass::Exec(class System::String ^,class System::String ^)" (?Exec@Degoli@@$$FSMXP$AAVString@System@@0@Z)

I'm not very familiar with C++ stuff. I prefer C#. What can I do with it?

1

1 Answers

2
votes

You need to make sure you are linking to the appropriate lib file.

Add Wininet.lib to Project Properties | Linker | Input | Additional Dependencies