     // pin the image to memory
     _image_to_upload = image;
 
+#ifdef _MSC_VER
+    VirtualLock(LPVOID(_image_to_upload), (getWidth() * getHeight()));
+#else
     mlock( _image_to_upload, getWidth() * getHeight() );
+#endif
 
     POP_CUDA_MEMCPY_2D_ASYNC( _d_plane.data,
                               getPitch(),

{
    // unpin the image
    if( _image_to_upload != 0 ) {
        munlock( _image_to_upload, getWidth() * getHeight() );
        _image_to_upload = 0;
    }
}

#include <fstream>
#include <string.h>
#include <cctag/cuda/cctag_cuda_runtime.h>
#ifdef _MSC_VER
#include <windows.h>
#else
#include <sys/mman.h>
#endif
#include "debug_macros.hpp"
#include "pinned_counters.h"

