Inheritance: OperationArgs
Esempio n. 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);
            }
        }
Esempio n. 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();
            }
        }
Esempio n. 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();
            }
        }
Esempio n. 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);
            }
        }