<commit_before>// Copyright 2016 Keybase Inc. All rights reserved.
// Use of this source code is governed by a BSD
// license that can be found in the LICENSE file.

#if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__BORLANDC__)

#include "bridge.h"

static BOOL __stdcall (*kbfsLibdokanPtr_RemoveMountPoint)(LPCWSTR MountPoint);
static HANDLE __stdcall (*kbfsLibdokanPtr_OpenRequestorToken)(PDOKAN_FILE_INFO DokanFileInfo);
static int __stdcall (*kbfsLibdokanPtr_Main)(PDOKAN_OPTIONS DokanOptions, PDOKAN_OPERATIONS DokanOperations);

DWORD kbfsLibdokanLoadLibrary(LPCWSTR location) {
	DWORD flags = LOAD_LIBRARY_SEARCH_SYSTEM32;
	for(int i=0; location[i]; i++)
		if(location[i]== L'/' || location[i]==L'\\') {
			flags = 0;
			break;
		}
  HMODULE mod = LoadLibraryExW(location, NULL, flags);
  if(mod == NULL)
    return GetLastError();
  kbfsLibdokanPtr_RemoveMountPoint = (void*)GetProcAddress(mod, "DokanRemoveMountPoint");
  if(kbfsLibdokanPtr_RemoveMountPoint == NULL)
    return GetLastError();
  kbfsLibdokanPtr_OpenRequestorToken = (void*)GetProcAddress(mod, "DokanOpenRequestorToken");
  if(kbfsLibdokanPtr_OpenRequestorToken == NULL)
    return GetLastError();
  kbfsLibdokanPtr_Main = (void*)GetProcAddress(mod, "DokanMain");
  if(kbfsLibdokanPtr_Main == NULL)
    return GetLastError();
  return 0;
}


extern NTSTATUS kbfsLibdokanCreateFile(LPCWSTR FileName,
					 PDOKAN_IO_SECURITY_CONTEXT psec,
					 ACCESS_MASK DesiredAccess,<commit_msg>dokan: Work on systems without LOAD_LIBRARY_SEARCH_SYSTEM32 defined<commit_after>// Copyright 2016 Keybase Inc. All rights reserved.
// Use of this source code is governed by a BSD
// license that can be found in the LICENSE file.

#if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__BORLANDC__)

#include "bridge.h"

static BOOL __stdcall (*kbfsLibdokanPtr_RemoveMountPoint)(LPCWSTR MountPoint);
static HANDLE __stdcall (*kbfsLibdokanPtr_OpenRequestorToken)(PDOKAN_FILE_INFO DokanFileInfo);
static int __stdcall (*kbfsLibdokanPtr_Main)(PDOKAN_OPTIONS DokanOptions, PDOKAN_OPERATIONS DokanOperations);

DWORD kbfsLibdokanLoadLibrary(LPCWSTR location) {
  // 0x800 is LOAD_LIBRARY_SEARCH_SYSTEM32 but that is not defined on build machines.
  DWORD flags = 0x800;
  for(int i=0; location[i]; i++)
    if(location[i]== L'/' || location[i]==L'\\') {
      flags = 0;
      break;
    }
  HMODULE mod = LoadLibraryExW(location, NULL, flags);
  if(mod == NULL)
    return GetLastError();
  kbfsLibdokanPtr_RemoveMountPoint = (void*)GetProcAddress(mod, "DokanRemoveMountPoint");
  if(kbfsLibdokanPtr_RemoveMountPoint == NULL)
    return GetLastError();
  kbfsLibdokanPtr_OpenRequestorToken = (void*)GetProcAddress(mod, "DokanOpenRequestorToken");
  if(kbfsLibdokanPtr_OpenRequestorToken == NULL)
    return GetLastError();
  kbfsLibdokanPtr_Main = (void*)GetProcAddress(mod, "DokanMain");
  if(kbfsLibdokanPtr_Main == NULL)
    return GetLastError();
  return 0;
}


extern NTSTATUS kbfsLibdokanCreateFile(LPCWSTR FileName,
					 PDOKAN_IO_SECURITY_CONTEXT psec,
					 ACCESS_MASK DesiredAccess,
{'fraction_non_alphanumeric': 0.10449187639375597, 'fraction_numerical': 0.012742911755336095, 'mean_word_length': 6.040358744394619, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1821039', 'n_tokens_mistral': 1185, 'n_tokens_neox': 1120, 'n_words': 232}