Пример #1
0
 public void LoadString()
 {
     using (var handle = ModuleDesktopMethods.LoadLibrary(GetNativeTestLibraryLocation(),
                                                          LoadLibraryFlags.LOAD_LIBRARY_AS_IMAGE_RESOURCE | LoadLibraryFlags.LOAD_LIBRARY_AS_DATAFILE))
     {
         string resource = ResourceDesktopMethods.LoadString(handle, 101);
         resource.Should().Be("Test");
     }
 }
Пример #2
0
        public void LoadStringFromLongPath()
        {
            using (var cleaner = new TestFileCleaner())
            {
                string longPath = @"\\?\" + PathGenerator.CreatePathOfLength(cleaner.TempFolder, 500);
                FileHelper.CreateDirectoryRecursive(longPath);
                string longPathLibrary = Paths.Combine(longPath, "LoadStringFromLongPath.dll");
                FileMethods.CopyFile(GetNativeTestLibraryLocation(), longPathLibrary);

                using (var handle = ModuleDesktopMethods.LoadLibrary(longPathLibrary,
                                                                     LoadLibraryFlags.LOAD_LIBRARY_AS_IMAGE_RESOURCE | LoadLibraryFlags.LOAD_LIBRARY_AS_DATAFILE))
                {
                    string resource = ResourceDesktopMethods.LoadString(handle, 101);
                    resource.Should().Be("Test");
                }
            }
        }