Source file src/internal/syscall/windows/sysdll/sysdll.go

     1  // Copyright 2016 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build windows
     6  
     7  // Package sysdll is an internal leaf package that records and reports
     8  // which Windows DLL names are used by Go itself. These DLLs are then
     9  // only loaded from the System32 directory. See Issue 14959.
    10  package sysdll
    11  
    12  // IsSystemDLL reports whether the named dll key (a base name, like
    13  // "foo.dll") is a system DLL which should only be loaded from the
    14  // Windows SYSTEM32 directory.
    15  //
    16  // Filenames are case sensitive, but that doesn't matter because
    17  // the case registered with Add is also the same case used with
    18  // LoadDLL later.
    19  //
    20  // It has no associated mutex and should only be mutated serially
    21  // (currently: during init), and not concurrent with DLL loading.
    22  var IsSystemDLL = map[string]bool{}
    23  
    24  // Add notes that dll is a system32 DLL which should only be loaded
    25  // from the Windows SYSTEM32 directory. It returns its argument back,
    26  // for ease of use in generated code.
    27  func Add(dll string) string {
    28  	IsSystemDLL[dll] = true
    29  	return dll
    30  }
    31  

View as plain text