상속: OperationArgs
예제 #1
0
        private static void ValidateInjectArgs(InjectArgs args)
        {
            ValidateOperationArgs(args);

            // embedding resource file should exist
            if (!File.Exists(args.ResourcePath))
            {
                var message = string.Format(Localization.ValidateArgsResourceFile, args.ResourcePath);
                throw new IOException(message);
            }
        }
예제 #2
0
        private static void WriteInjectOutput(InjectArgs args)
        {
            // load resource data
            var resourceData = ReadResource(args.ResourcePath);

            // try to copy pe
            TryCopySource(args.SourcePath, args.OutputPath);

            // update pe
            var updateHandle = BeginUpdateResource(args.OutputPath);

            using (var updateDisposable = new PInvoke.DisposableHandle(updateHandle,
                                                                       h => PInvoke.DiscardUpdateResource(updateHandle)))
            {
                UpdateResource(updateHandle, args.ResourceType,
                               args.ResourceName, resourceData, args.OutputPath);

                CompleteUpdateResource(updateHandle, args.OutputPath);

                updateDisposable.SuppressDispose();
            }
        }
예제 #3
0
        private static void WriteInjectOutput(InjectArgs args)
        {
            // load resource data
            var resourceData = ReadResource(args.ResourcePath);

            // try to copy pe
            TryCopySource(args.SourcePath, args.OutputPath);

            // update pe
            var updateHandle = BeginUpdateResource(args.OutputPath);

            using (var updateDisposable = new PInvoke.DisposableHandle(updateHandle,
                h => PInvoke.DiscardUpdateResource(updateHandle)))
            {
                UpdateResource(updateHandle, args.ResourceType,
                    args.ResourceName, resourceData, args.OutputPath);

                CompleteUpdateResource(updateHandle, args.OutputPath);

                updateDisposable.SuppressDispose();
            }
        }
예제 #4
0
        private static void ValidateInjectArgs(InjectArgs args)
        {
            ValidateOperationArgs(args);

            // embedding resource file should exist
            if (!File.Exists(args.ResourcePath))
            {
                var message = string.Format(Localization.ValidateArgsResourceFile, args.ResourcePath);
                throw new IOException(message);
            }
        }