Skip to content


关于verydoc doc2any工具的参数

官方的readme.txt文件说明

C:\>doc2any.exe
Convert *.DOC, *.DOCX, *.RTF, *.TXT, *.PPT, *.PPTX, *.XLS, *.XLSX files to PDF,
PS, EPS, SVG, SWF, XPS, HPGL, PCL, TIF, PNG, JPG, BMP, GIF, TGA, PCX, EMF, WMF,
etc. formats
Usage: DOC2Any [options] <in-file> [<out-file>]
  -useoffice <int>         : Use MS Office to render DOC,DOCX,RTF,TXT,PPT,PPTX,PPTS,PPTSX,XLS,XLSX formats
    -useoffice 0: Don’t use MS Office to convert DOC,DOCX,RTF,TXT,PPT,PPTX,XLS,XLSX formats
    -useoffice 1: Use MS Office to convert DOC,DOCX,RTF,TXT,PPT,PPTX,XLS,XLSX formats
  -useprinter              : Convert DOC files to other formats via virtual printer
  -multipagetif            : Create multipage TIFF format
  -showofficeui            : Show Office Windows during conversion
  -resetofficeview         : Reset Office View type to wdPrintView
  -password <string>       : Set open password for office documents
  -checkpwd                : Check if MS Word document contains an open password
  -noretry                 : Don’t try to re-convert failed office documents
  -delay <int>             : Delay some milliseconds before conversion
  -width <int>             : Set page width to PDF file
  -height <int>            : Set page height to PDF file
  -emfheight <int>         : Split a long HTML file by height
  -pageheight <int>        : Split a long HTML page by page height, same as -emfheight
  -pageh <int>             : same as -pageheight
  -ph <int>                : same as -pageheight
  -xres <int>              : Set X resolution to image file
  -yres <int>              : Set Y resolution to image file
  -bitcount <int>          : Set color depth for image conversion
  -compression <int>       : Set compression for TIFF image
    -compression 1     : NONE compression
    -compression 2     : CCITT modified Huffman RLE
    -compression 3     : CCITT Group 3 fax encoding (1d)
    -compression 4     : CCITT Group 4 fax encoding
    -compression 5     : LZW compression
    -compression 6     : OJPEG compression
    -compression 7     : JPEG DCT compression
    -compression 32773 : PACKBITS compression
    -compression 32809 : THUNDERSCAN compression
    -compression 88880 : 204×98  G4 ClassF TIFF
    -compression 88881 : 204×196 G4 ClassF TIFF
    -compression 88882 : 204×98  G3 ClassF TIFF
    -compression 88883 : 204×196 G3 ClassF TIFF
    -compression 88884 : CCITT Group 3 fax encoding (2d)
  -rotate <int>            : Rotate pages, 90, 180, 270
  -margin <string>         : Set page margin to PDF file
    -margin 10         : Set margin to 10pt to left
    -margin 10×10      : Set margin to 10pt to left,top
    -margin 10x10x10   : Set margin to 10pt to left,top,right
    -margin 10x10x10x10: Set margin to 10pt to left,top,right,bottom
  -pagelayout <int>        : Set page layout that is used when opening the document in adobe Reader
   -pagelayout 0: Use viewer’s default settings
   -pagelayout 1: SinglePage
   -pagelayout 2: OneColumn
   -pagelayout 3: TwoColumnLeft
   -pagelayout 4: TwoColumnRight
   -pagelayout 5: TwoPageLeft
   -pagelayout 6: TwoPageRight
  -viewpagemode <int>      : Set page mode that is used when opening the document in adobe Reader
    -viewpagemode 0: No page mode is applied, default option
    -viewpagemode 1: Show outline tree
    -viewpagemode 2: Show thumbnails
    -viewpagemode 3: Open the document in full-screen mode
    -viewpagemode 4: UseOC
    -viewpagemode 5: UseAttachments
  -vieweropt <int>         : Set viewer preferences to Adobe Reader
    -vieweropt  1: HideToolBar
    -vieweropt  2: HideMenuBar
    -vieweropt  4: HideWindowUI
    -vieweropt  8: FitWindow
    -vieweropt 16: CenterWindow
    -vieweropt 32: DisplayDocTitle
    -vieweropt 64: Non-FullScreenPageMode, use -viewerval to set more options
  -viewerval <int>         : Additional values used by -vieweropt 64
    -vieweropt 64 -viewerval 1   : UseNone
    -vieweropt 64 -viewerval 2   : UseOutlines
    -vieweropt 64 -viewerval 4   : UseThumbs
    -vieweropt 64 -viewerval 1024: UseOC
  -viewerzoom <string>     : Set viewer zoom ratio to Adobe Reader
    -viewerzoom FitBH: Display pages to fit the width of its bounding box
    -viewerzoom FitH : Display pages to fit the width of page
    -viewerzoom Fit  : Display pages to fit window
    -viewerzoom FitV : Display pages to fit height of page
    -viewerzoom FitB : Display pages to fit its bounding box entirely
    -viewerzoom FitBV: Display pages to fit height of its bounding box
    -viewerzoom 25   : Display pages with magnification at 25%%
    -viewerzoom 50   : Display pages with magnification at 50%%
    -viewerzoom 1600 : Display pages with magnification at 1600%%
  -viewpage <string>       : set start page when opening it in Adobe Reader
  -view                    : View PDF file after creation
  -append <int>            : Append document to an existing PDF file
    -append 0: Overwrite if PDF file exists
    -append 1: Insert before first page if PDF file exists
    -append 2: Append to last page if PDF file exists
    -append 3: Rename filename if PDF file exists
  -producer <string>       : Set ‘producer’ to PDF file
  -creator <string>        : Set ‘creator’ to PDF file
  -subject <string>        : Set ‘subject’ to PDF file
  -title <string>          : Set ‘title’ to PDF file
  -author <string>         : Set ‘author’ to PDF file
  -keywords <string>       : Set ‘keywords’ to PDF file
  -openpwd <string>        : Set ‘open password’ to PDF file
  -ownerpwd <string>       : Set ‘owner password’ to PDF file
  -keylen <int>            : Key length (40 or 128 bit)
    -keylen 0:  40 bit RC4 encryption (Acrobat 3 or higher)
    -keylen 1: 128 bit RC4 encryption (Acrobat 5 or higher)
    -keylen 2: 128 bit RC4 encryption (Acrobat 6 or higher)
  -encryption <int>        : Restrictions
    -encryption    0: Encrypt the file only
    -encryption 3900: Deny anything
    -encryption    4: Deny printing
    -encryption    8: Deny modification of contents
    -encryption   16: Deny copying of contents
    -encryption   32: No commenting
    ===128 bit encryption only -> ignored if 40 bit encryption is used
    -encryption  256: Deny FillInFormFields
    -encryption  512: Deny ExtractObj
    -encryption 1024: Deny Assemble
    -encryption 2048: Disable high res. printing
    -encryption 4096: Do not encrypt metadata
  -unicode                 : Enable Unicode conversion
  -noempty                 : Delete empty pages from PDF file
  -killoffice <int>        : Kill or not kill MS Office instances before conversion
  -installprinter          : Install virtual printer only
  -printername <string>    : Alternate name for virtual printer on FILE: port
  -printername2 <string>   : Alternate name for virtual printer on LPT1: port
  -wtext <string>          : Watermark text on printed document
    -wtext does support following dynamic values:
    %PageCount%, %PageNumber%, %PageCountRoman%, %PageCountRoman2%,
    %PageNumberRoman%, %PageNumberRoman2%, %Author%, %Keywords%,
    %Subject%, %Title%, %Filename%, %Date%, %Time%
  -wtype <int>             : type of watermark
    0 : normal watermark
    1 : watermark on header
    2 : watermark on footer
  -wf <string>             : font name of watermark
  -wh <int>                : font size of watermark
  -wb                      : specify bold font
  -wi                      : specify an italic font
  -wu                      : specify an underlined font
  -ws                      : specify a strikeout font
  -wa <int>                : angle of watermark
  -wbox <string>           : a rectangle to output formatted text, it is only useful for "-walign" option, eg:
    -wbox "0,0,595,842"
    -wbox "0,0,612,792"
    -wbox "auto"
  -walign <int>            : set text align
    1 : left
    2 : center
    3 : right
  -wc <string>             : color of watermark,
    FF0000: Red color
    00FF00: Green color
    0000FF: Blue color
    HexNum: Other colors
  -wx <int>                : X offset of watermark
  -wy <int>                : Y offset of watermark
  -wpagebegin <int>        : first page to add the watermark
  -wpageend <int>          : last page to add the watermark
  -wpageoffset <int>       : a value to be added to page number
  -watermarkfile <string>  : a .ini file which contain information for multiple watermarks
  -svgnoclip               : remove clipping during SVG output
  -log <string>            : output log into a file
  -debug                   : Print log message on screen
  -runasuser <string>      : Run current EXE application from a user account
  -runaspwd <string>       : Password of specified user account
  -v                       : Print copyright and version info
  -h                       : Print usage information
  -help                    : Print usage information
  –help                   : Print usage information
  -?                       : Print usage information
  -$ <string>              : Input registration key
Example:

   doc2any.exe C:\in.doc C:\out.pdf
   doc2any.exe C:\in.ppt C:\out.pdf
   doc2any.exe C:\in.xls C:\out.pdf
   doc2any.exe C:\in.docx C:\out.pdf
   doc2any.exe C:\in.pptx C:\out.pdf
   doc2any.exe C:\in.xlsx C:\out.pdf
   doc2any.exe C:\*.doc C:\*.pdf
   doc2any.exe -margin 100x100x100x100 C:\in.rtf C:\out.pdf
   doc2any.exe -append 2 -width 612 -height 792 C:\*.doc C:\out.pdf
   doc2any.exe -append 2 C:\*.doc C:\out.pdf
   doc2any.exe -width 612 -height 792 C:\in.doc C:\out.pdf
   doc2any.exe -append 1 C:\in.doc C:\out.pdf
   doc2any.exe -append 2 C:\in.doc C:\out.pdf
   doc2any.exe -subject "subject" C:\in.doc C:\out.pdf
   doc2any.exe -ownerpwd 123 -keylen 2 -encryption 3900 C:\in.doc C:\out.pdf
   doc2any.exe "C:\in.doc" C:\out.gif
   doc2any.exe "C:\in.doc" C:\out.png
   doc2any.exe -useprinter -xres 300 -yres 300 -bitcount 1 -compression 4 "C:\in.doc" "C:\out.tif"
   doc2any.exe -useoffice 1 -useprinter -showofficeui "C:\in.doc" "C:\out.pdf"
   doc2any.exe -useprinter -useoffice 1 -showofficeui -delay 10000 -resetofficeview -debug "C:\in.doc" "C:\out.pdf"
   doc2any.exe -useoffice 1 -useprinter -delay 5000 "C:\in.doc" "C:\out.pdf"
   doc2any.exe -killoffice 0 -useprinter "C:\in.doc" C:\out.pdf
   doc2any.exe -multipagetif -killoffice 0 -useprinter "C:\in.doc" C:\out.tif
   doc2any.exe -multipagetif -bitcount 1 -xres 300 -yres 300 -killoffice 0 -useprinter "C:\in.doc" C:\out.tif
   doc2any.exe -useprinter -compression 88880 "C:\in.doc" C:\out.tif
   doc2any.exe -useprinter -compression 88881 "C:\in.doc" C:\out.tif
   doc2any.exe -useprinter -compression 88883 "C:\in.doc" C:\out.tif
   doc2any.exe -multipagetif -useprinter -compression 88880 "C:\in.doc" C:\out.tif
   for %F in (D:\test\*.doc) do "doc2any.exe" "%F" "%~dpnF.pdf"
   for /r D:\test %F in (*.doc) do "doc2any.exe" "%F" "%~dpnF.pdf"
   doc2any.exe -useprinter -useoffice 1 -noretry -password 123456 D:\test.docx D:\out.pdf
   doc2any.exe -viewerzoom 1600 -viewpage 10 -viewpagemode 2 -view "C:\in.doc" C:\out.pdf
   doc2any.exe -useprinter "C:\example.odt" "C:\openofficedoc.pdf"
   doc2any.exe "C:\example.odt" "C:\openofficedoc.pdf"
   doc2any.exe -installprinter -printername myprinter1 -printername2 myprinter2

Add watermarks into PDF files:

  

doc2any.exe -wtext "VeryPDF" "C:\in.doc" C:\out.pdf
   doc2any.exe -wtext "VeryPDF" -wc "0000FF" "C:\in.doc" C:\out.pdf
   doc2any.exe -wtext "VeryPDF" -wx 100 -wy 100 "C:\in.doc" C:\out.pdf
   doc2any.exe -wtext "VeryPDF" -wtype 1 "C:\in.doc" C:\out.pdf
   doc2any.exe -wtext "VeryPDF" -wtype 2 "C:\in.doc" C:\out.pdf
   doc2any.exe -wtext "VeryPDF" -wtype 0 -wa 45 "C:\in.doc" C:\out.pdf
   doc2any.exe -wtext "VeryPDF" -wf "Arial" "C:\in.doc" C:\out.pdf
   doc2any.exe -wtext "VeryPDF" -wf "Arial" -wh 20 "C:\in.doc" C:\out.pdf
   doc2any.exe -wtext "VeryPDF" -wf "Arial" -wh 20 -wb -wi -wu -ws "C:\in.doc" C:\out.pdf
   doc2any.exe -wtext "VeryPDF" -wf "Arial" -walign 3 -wh 20 -wbox "0,770,612,792" "C:\in.doc" C:\out.pdf
   doc2any.exe -wtext "Watermark %PageNumber% of %PageCount%" "C:\in.doc" C:\out.pdf
   doc2any.exe -wtext "Watermark %PageNumber% of %PageCount%" -wpagebegin 10 -wpageend 20 -wpageoffset 100 "C:\in.doc" C:\out.pdf
   doc2any.exe -wtext "Watermark %PageNumberRoman% of %PageCountRoman%" "C:\in.doc" C:\out.pdf
   doc2any.exe -wtext "Watermark %PageNumberRoman2% of %PageCountRoman2%" "C:\in.doc" C:\out.pdf
   doc2any.exe -wtext "Watermark %PageNumber% of %PageCount%" -walign 3 -wtype 1 "C:\in.doc" C:\out.pdf
   doc2any.exe -wtext "Watermark %PageNumber% of %PageCount%" -walign 2 -wtype 2 "C:\in.doc" C:\out.pdf
   doc2any.exe -wtext "%Filename% %Date% %Time% %PageNumber% of %PageCount%" "C:\in.doc" C:\out.pdf

下面是为原文件每个页面生成一个SWF文件。

You can add "%" to output filename, then you can create a SWF file for each page, for example,

doc2any.exe "C:\test.doc" "C:\out%.swf"
doc2any.exe "C:\test.ppt" "C:\slide%.swf"
Tags: doc2any, swf, toolkit, verydoc, 参数

相关文章

Posted in 生活点滴.

Tagged with , , , , .


PowerShell书籍收藏

1、PowerShell两本电子书籍

2、Professional Windows powershell Programming

image

http://www.bonashen.com/wp-content/uploads/2010/09/ProfessionalWindowsPowerShellProgramming.pdf

3、Windows powershell Cookbook,2nd

image

http://www.bonashen.com/wp-content/uploads/2010/09/Windows_PowerShell_Cookbook,2nd.pdf

4、Effective Windows powershell

image

http://www.bonashen.com/wp-content/uploads/2010/09/EffectiveWindowsPowerShell.pdf

Tags: powershell, 学习, 电子书

相关文章

Posted in 生活点滴.

Tagged with , , .


PowerShell两本电子书籍

powershell刚开始学,先前网购了一本电子工业出版社出版的《Windows powershell 2.0 应用编程最佳实践》。

后来在网上找到两本PowerShell的电子书

1.Windows PowerShell Cookbook™

image

http://www.bonashen.com/wp-content/uploads/2010/09/OReilly.Windows.PowerShell.Cookbook.Oct.2007.pdf

2.Windows PowerShell in Action

image

http://www.bonashen.com/wp-content/uploads/2010/09/Manning.Windows.PowerShell.in.Action.Feb.2007.pdf

Tags: powershell, 学习, 电子书

相关文章

Posted in 生活点滴.

Tagged with , , .


PowerShell 文件目录监视片段

摘自《Windows PowerShell 2.0应用编程最佳实践》

#pseventing 1.1
#filesystemwatcher
Add-PSSnapin pseventing 

$fsw = New-Object system.IO.FileSystemWatcher
$fsw.Path = [IO.Path]::GetTempPath()
$fsw.EnableRaisingEvents = $true 

Start-KeyHandler -CaptureCtrlC 

Connect-Event fsw changed,deleted -Verbose 

"watching $($fsw.path)"
"entering loop ... ctrl+C to exit"
$done = $false
while($events = @(Read-Event -Wait)){
   #read-event alays returns a cllection
   foreach($event in $events){
      switch($event.name){
          "ctrlc"{
            "cancelling..."
            $done = $true
            }
        "changed"{
            $event
            #$done = $true
        }
        "deleted"{
            $event
        }
      }
    }
    if($done -eq $true){
        break
    }
}    
调试结果如下图:
image 
Tags: filesystem, powershell, watcher, windows, 目录监视, 编程

相关文章

Posted in 程序.

Tagged with , , , , , .


delphi下的FileSystemWatcher,实现文件目录监控

{*******************************************************}
{                                                       }
{       FileSystemWatcher                               }
{                                                       }
{       版权所有 (C) 2007 solokey                       }
{                                                       }
{       http://blog.csdn.net/solokey                    }
{                                                       }
{*******************************************************}

unit FileSystemWatcher;

interface
uses
  Windows, Classes, SysUtils;

type
  TFileOperation = (foAdded, foRemoved, foModified, foRenamed);
  TFileDealMethod = procedure(FileOperation: TFileOperation; const FileName1,FileName2: string) of object;

  TNotifyFilter = (nfFileNameChange, nfDirNameChange, nfAttributeChange,
    nfSizeChange, nfWriteChange, nfAccessChange, nfCreationDateChange, nfSecurityChange);
  TNotifyFilters = set of TNotifyFilter;

  TNotificationBuffer =  array[0..4095] of Byte;

  PFileNotifyInformation = ^TFileNotifyInformation;
  TFileNotifyInformation = record
    NextEntryOffset: DWORD;
    Action: DWORD;
    FileNameLength: DWORD;
    FileName: array[0..0] of WideChar;
  end;

  TShellChangeThread = class(TThread)
  private
    FActived: Boolean;
    FDirectoryHandle: Cardinal;
    FCS: TRTLCriticalSection;
    FChangeEvent: TFileDealMethod;
    FDirectory: string;
    FWatchSubTree: Boolean;
    FCompletionPort: Cardinal;
    FOverlapped: TOverlapped;
    FNotifyOptionFlags: DWORD;
    FBytesWritten: DWORD;
    FNotificationBuffer: TNotificationBuffer;
  protected
    procedure Execute; override;
    procedure DoIOCompletionEvent;
    function ResetReadDirctory: Boolean;
    procedure Lock;
    procedure Unlock;
  public
    constructor Create(ChangeEvent: TFileDealMethod); virtual;
    destructor Destroy; override;
    procedure SetDirectoryOptions(Directory : String; Actived: Boolean; WatchSubTree : Boolean;
      NotifyOptionFlags : DWORD);
    property ChangeEvent : TFileDealMethod read FChangeEvent write FChangeEvent;
  end;

  TFileSystemWatcher = class(TComponent)
  private
    FActived: Boolean;
    FWatchedDir: string;
    FThread: TShellChangeThread;
    FOnChange: TFileDealMethod;
    FWatchSubTree: Boolean;
    FFilters: TNotifyFilters;
    procedure SetWatchedDir(const Value: string);
    procedure SetWatchSubTree(const Value: Boolean);
    procedure SetOnChange(const Value: TFileDealMethod);
    procedure SetFilters(const Value: TNotifyFilters);
    function  NotifyOptionFlags: DWORD;
    procedure SetActived(const Value: Boolean);
  protected
    procedure Change;
    procedure Start;
    procedure Stop;
  public
    constructor Create(AOwner : TComponent); override;
    destructor  Destroy; override;
  published
    property  Actived:Boolean  read FActived write SetActived;
    property  WatchedDir: string read FWatchedDir write SetWatchedDir;
    property  WatchSubTree: Boolean read FWatchSubTree write SetWatchSubTree;
    property  NotifyFilters: TNotifyFilters read FFilters write SetFilters;
    property  OnChange: TFileDealMethod read FOnChange write SetOnChange;
  end;

procedure  Register;

implementation

procedure  Register;
begin
  RegisterComponents('Samples', [TFileSystemWatcher]);
end;

{ TShellChangeThread }

constructor TShellChangeThread.Create(ChangeEvent: TFileDealMethod);
begin
  FreeOnTerminate := True;
  FChangeEvent := ChangeEvent;
  InitializeCriticalSection(FCS);
  FDirectoryHandle := 0;
  FCompletionPort := 0;
  inherited Create(True);
end;

destructor TShellChangeThread.Destroy;
begin
  CloseHandle(FDirectoryHandle);
  CloseHandle(FCompletionPort);
  DeleteCriticalSection(FCS);
  inherited Destroy;
end;

procedure TShellChangeThread.DoIOCompletionEvent;
var
  TempBuffer: TNotificationBuffer;
  FileOpNotification: PFileNotifyInformation;
  Offset: Longint;
  FileName1, FileName2: string;
  FileOperation: TFileOperation;
  procedure DoDirChangeEvent;
  begin
    if Assigned(ChangeEvent) and FActived then
      ChangeEvent(FileOperation, FileName1, FileName2);
  end;
  function  CompleteFileName(const FileName:string):string;
  begin
    Result := '';
    if Trim(FileName) <> '' then
      Result := FDirectory + Trim(FileName);
  end;
begin
  Lock;
  TempBuffer := FNotificationBuffer;
  FillChar(FNotificationBuffer, SizeOf(FNotificationBuffer), 0);
  Unlock;
  Pointer(FileOpNotification) := @TempBuffer[0];
  repeat
    with FileOpNotification^ do begin
      Offset := NextEntryOffset;
      FileName2 := '';
      case Action of
        FILE_ACTION_ADDED..FILE_ACTION_MODIFIED: begin
          FileName1 := CompleteFileName(WideCharToString(FileName));
          FileOperation := TFileOperation(Action - 1);
          DoDirChangeEvent;
        end;
        FILE_ACTION_RENAMED_OLD_NAME: begin
          FileName1 := CompleteFileName(WideCharToString(FileName));
          FileOperation := TFileOperation(Action - 1);
        end;
        FILE_ACTION_RENAMED_NEW_NAME: begin
          if FileOperation = foRenamed then begin
            FileName2 := CompleteFileName(WideCharToString(FileName));
            DoDirChangeEvent;
          end;
        end;
      end;
    end;
  Pointer(FileOpNotification) := Pointer(PChar(FileOpNotification) + OffSet);
  until Offset=0;
end;

procedure TShellChangeThread.Execute;
var
  numBytes: DWORD;
  CompletionKey: DWORD;
  PFOverlapped: POverlapped;
  TempDirectoryHandle: Cardinal;
  TempCompletionPort: Cardinal ;
begin

  while not Terminated do begin
    Lock;
    TempDirectoryHandle := FDirectoryHandle;
    TempCompletionPort := FCompletionPort;
    Unlock;
    if TempDirectoryHandle > 0  then begin
      PFOverlapped := @FOverlapped;
      GetQueuedCompletionStatus(TempCompletionPort, numBytes, CompletionKey, PFOverlapped, INFINITE);
      if CompletionKey = Handle then begin
        Synchronize(DoIOCompletionEvent);
        FBytesWritten := 0;
        FillChar(FNotificationBuffer, SizeOf(FNotificationBuffer), 0);
        ReadDirectoryChanges(FDirectoryHandle, @FNotificationBuffer, SizeOf(FNotificationBuffer), FWatchSubTree, FNotifyOptionFlags, @FBytesWritten, @FOverlapped, nil);
      end;
    end;
  end;
  PostQueuedCompletionStatus(TempCompletionPort, 0, 0, nil);
end;

procedure TShellChangeThread.Lock;
begin
  EnterCriticalSection(FCS);
end;

function TShellChangeThread.ResetReadDirctory: Boolean;
var
  TempHandle: Cardinal;
  TempCompletionPort: Cardinal;
begin
  Result := False;
  CloseHandle(FDirectoryHandle);
  PostQueuedCompletionStatus(FCompletionPort, 0, 0, nil);
  CloseHandle(FCompletionPort);

  TempHandle := CreateFile(PChar(FDirectory), GENERIC_READ or GENERIC_WRITE,
                            FILE_SHARE_READ or FILE_SHARE_WRITE or FILE_SHARE_DELETE,
                            nil, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS or FILE_FLAG_OVERLAPPED, 0);
  Lock;
  FDirectoryHandle := TempHandle;
  Unlock;

  if (GetLastError = ERROR_FILE_NOT_FOUND) or (GetLastError = ERROR_PATH_NOT_FOUND) then begin
    Lock;
    FDirectoryHandle := 0;
    FCompletionPort := 0;
    Unlock;
    Exit;
  end;

  TempCompletionPort := CreateIoCompletionPort(FDirectoryHandle, 0, Handle, 0);

  Lock;
  FCompletionPort := TempCompletionPort;
  Unlock;

  FBytesWritten := 0;
  FillChar(FNotificationBuffer, SizeOf(FNotificationBuffer), 0);
  Result := ReadDirectoryChanges(FDirectoryHandle, @FNotificationBuffer, SizeOf(FNotificationBuffer), FWatchSubTree, FNotifyOptionFlags, @FBytesWritten, @FOverlapped, nil);
end;

procedure TShellChangeThread.SetDirectoryOptions(Directory: String; Actived: Boolean;
  WatchSubTree: Boolean;  NotifyOptionFlags : DWORD);
begin
  FWatchSubTree := WatchSubTree;
  FNotifyOptionFlags := NotifyOptionFlags;
  FDirectory := IncludeTrailingBackslash(Directory);
  FActived := Actived;
  ResetReadDirctory;
end;

procedure TShellChangeThread.Unlock;
begin
  LeaveCriticalSection(FCS);
end;

{ TFileSystemWatcher }

procedure TFileSystemWatcher.Change;
begin
  if csDesigning in ComponentState then
    Exit;
  if Assigned(FThread) then begin
    FThread.SetDirectoryOptions(FWatchedDir, FActived, LongBool(FWatchSubTree), NotifyOptionFlags);
  end;
end;

constructor TFileSystemWatcher.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  FActived := False;
  FWatchedDir := 'C:\';
  FFilters := [nfFilenameChange, nfDirNameChange];
  FWatchSubTree := True;
  FOnChange := nil;
end;

destructor TFileSystemWatcher.Destroy;
begin
  if Assigned(FThread) then
    FThread.Terminate;
  inherited Destroy;
end;

function TFileSystemWatcher.NotifyOptionFlags: DWORD;
begin
  Result := 0;
  if nfFileNameChange in FFilters then
    Result := Result or FILE_NOTIFY_CHANGE_FILE_NAME;
  if nfDirNameChange in FFilters then
    Result := Result or FILE_NOTIFY_CHANGE_DIR_NAME;
  if nfSizeChange in FFilters then
    Result := Result or FILE_NOTIFY_CHANGE_SIZE;
  if nfAttributeChange in FFilters then
    Result := Result or FILE_NOTIFY_CHANGE_ATTRIBUTES;
  if nfWriteChange in FFilters then
    Result := Result or FILE_NOTIFY_CHANGE_LAST_WRITE;
  if nfAccessChange in FFilters then
    Result := Result or FILE_NOTIFY_CHANGE_LAST_ACCESS;
  if nfCreationDateChange in FFilters then
    Result := Result or FILE_NOTIFY_CHANGE_CREATION;
  if nfSecurityChange in FFilters then
    Result := Result or FILE_NOTIFY_CHANGE_SECURITY;
end;

procedure TFileSystemWatcher.SetActived(const Value: Boolean);
begin
  if FActived <> Value then begin
    FActived := Value;
    Change;
    if FActived then
      Start
    else
      Stop;
  end;
end;

procedure TFileSystemWatcher.SetFilters(const Value: TNotifyFilters);
begin
  if FFilters <> Value then begin
    FFilters := Value;
    Change;
  end;
end;

procedure TFileSystemWatcher.SetOnChange(const Value: TFileDealMethod);
begin
  FOnChange := Value;
  if Assigned(FOnChange) and FActived then
    Start
  else
    Stop;
  Change;
end;

procedure TFileSystemWatcher.SetWatchedDir(const Value: string);
begin
  if not SameText(FWatchedDir, Value) then begin
    FWatchedDir := Value;
    Change;
  end;
end;

procedure TFileSystemWatcher.SetWatchSubTree(const Value: Boolean);
begin
  if FWatchSubTree <> Value then begin
    FWatchSubTree := Value;
    Change;
  end;
end;

procedure TFileSystemWatcher.Start;
begin
  if csDesigning in ComponentState then
    Exit;
  if Assigned(FOnChange) then begin
    FThread := TShellChangeThread.Create(FOnChange);
    FThread.SetDirectoryOptions(FWatchedDir, FActived, LongBool(FWatchSubTree), NotifyOptionFlags);
    FThread.Resume;
  end;
end;

procedure TFileSystemWatcher.Stop;
begin
  if csDesigning in ComponentState then
    Exit;
  if Assigned(FThread) then begin
    FThread.Terminate;
    FThread := nil;
  end;
end;

end.
Tags: delphi, filesystem, watcher, 目录监视

相关文章

Posted in 程序.

Tagged with , , , .


脱壳UPX 0.89.6 – 1.02 / 1.05 – 1.24 -> Markus & Laszlo

最近看到verydoc的一套命令行转换工具,其中有一款PDF to vec(PDF文件转矢量文件),用PEiD查看是UPX 0.89.6 – 1.02 / 1.05 – 1.24 -> Markus & Laszlo壳,准备脱了他。

工具:

     PEid

     LoadPE

     WinHex

     UPX 2.03w

参照http://teach.hanzify.org/article/15-1060099200.html

第一步    PEid检测壳结果如下图

image

第二步  修改数据段

启动LoadPE工具,加载pdf2vec.exe,Sections,修改第一、第二段的名称分别为UPX0、UPX1保存。

image

第三步 修改UPX的解压版本

启动WinHex工具,打开第二步修改后的文件,移动数据区到03E0位置。如下图:

image

当前的版本是2.00,我们用UPX的高版来解压他,修改UPX的版本为2.03w。

image

保存修改的文件。

Continued…

Tags: crack, loadpe, pdf2vec, peid, upxe, verydoc, winhex, 脱壳

相关文章

Posted in 生活点滴.

Tagged with , , , , , , , .


关于船厂技术发展的路线思考

从各大厂应用tribon系统发展来看,其技术设计人员是一个倒金字塔结构。其中线型光顺、外板展开、曲面建模是塔尖,形成船体的主要领导力量,工艺人员、设计管理人员、图纸标准制定人员是塔腰,平面建模、零件建模、出图是塔基。如下图:

clip_image002

鉴于国内某造船大厂的技术发展路线,我们可以看出其技术设计发展以tribon系统的应用为切入点,走消化吸收、自我完善、自主创新、技术扩张的道路。

  1. 其中消化吸收是打基础,多采取联合设计,尽可能让联合设计队伍驻厂开展设计工作,这样可以更多的消化吸收其设计技能、设计管理技能。
  2. 自我完善是夯实基础,以工艺标准化为切入点,对设计工作的标准化,每位设计人员的工作范围、工作目标、工作标准进行固化,从而有利于技术设计管理、技术工艺的管理。将生产设计转向工艺设计,将零件制图转向装配制图,从而降低生产现场施工的难度。
  3. 自主创新是工艺创新,在自我完善的基础上方有能力应对工艺创新,让技术设计人员更多的关注工艺创新,来领导现场工艺的变革,提高现场施工质量与效率,从而降低生产成本。
  4. 技术扩张是指核心技术(技术管理模式、技术工艺标准、技术图纸标准固化、具有线型光顺及曲面建模能力)稳定的基础上,大量外包金字塔的塔基工作量,降低技术设计成本,提高技术设计的效率,使船厂的技术设计能力得到量变,能够在短时间内高质量完成某型船的生产设计,从而具有快速影响市场的应变能力。
Tags: Tribon, 发展路线, 思考, 生产设计

相关文章

Posted in tribon, 造船.

Tagged with , , , .


玩世博太累了

世博就是数字电视大渣会,一个比一个大。
世博就是走”S”弯,一个接着一个走。
世博就是匆匆走,走完一程继续走。
世博就是人看人,你看他来我看你。
世博就是比体力,看你还能站多久。
世博就是捉迷藏,不知馆里能看啥。

Posted with wordpress for blackberry.

Tags: 世博

相关文章

Posted in 生活点滴.

Tagged with .


今天参加公司活动游世博

由旅游公司带队,走7-1号门进园。在泰国錧先合影。

image  

第一站中国船舶馆。

image

这是游完后拍的照片。
和兄弟一起吃干粮。

Posted with wordpress for blackberry.

Tags: 世博

相关文章

Posted in 生活点滴.

Tagged with .


如何使用带有SLIC 2.1的BIOS在Vmware Workstation 7中激活OEM Windows 7

Posted on 2009-11-26 by 梦想天空

警告: 本文仅供学习与参考之用.请使用合法正版的软件.梦想天空对文章内容不承担任何责任.

Warning: This article is for your study and reference only. Please use legitimate genuine software. DreamingSky will NOT be responsible for its content.

  • 文章版本: 1.0
  • 修订日期: 2009.11.25

对象

  • Vmware Workstation 7
  • Windows 7

目的

使用带有SLIC 2.1的BIOS在Vmware Workstation 7中激活OEM Windows 7

工具

  • 7-zip 9.07 Beta
  • 010 Editor 3.05
  • Phoenix BIOS Editor Pro 2.2.0.1
  • Vmware Workstation 7
  • Windows 7
  • Windows 7 OEM证书文件
  • Windows 7 OEM密钥
  • 相应品牌的SLIC 2.1文件

方法

1. 提取原版BIOS

在Vmware Workstation 7的安装文件夹中找到vmware-vmx.exe文件(如果宿主系统是x64系统则该文件位于安装文件夹的x64\子文件夹中),复制到临时文件夹,通过右键菜单使用7-zip释放出其中的各个区段,在.rsrc\BINRES\文件夹中的6006即是Vmware Workstation 7的BIOS.方便起见可以将6006复制一份副本并重命名为vmwbios.rom.

2. 修改BIOS

使用Phoenix BIOS Editor Pro 2.2.0.1打开vmwbios.rom并且在以下过程中该文件必须保持打开状态!

2.1 使用010 Editor打开相应品牌的SLIC 2.1文件,如LENOVO.BIN,查看文件开始第9字节起的14个字节并将其复制,如联想某个SLIC 2.1为"LENOVOTC-5M   "(最后3位为空格,不带双引号).

2.2 浏览Phoenix BIOS Editor Pro所在文件夹中的TEMP子文件夹,使用010 Editor打开BIOSCOD0.ROM,搜索rsdt,类型为ASCII字符串,会找到三处.在第一处找到的rsdt前后均有"INTEL 440BX   "(最后3位为空格,共14个字符)字符串,替换为刚才复制的14位OEM标识字符串,保存.

2.3 将相应品牌的SLIC文件复制到Phoenix BIOS Editor Pro的TEMP子文件夹中.

2.4 使用010 Editor打开TEMP子文件夹中的ROM.SCR文件. 在文件末尾添加SLIC文件信息,如"ACPI LENOVO.BIN".

2.5 回到Phoenix BIOS Editor Pro窗口,点击DMI Strings窗口,双击Motherboard Version右侧的’None’,在弹出对话框中输入相应的OEM标识字符串,例如联想则输入’LEGEND Dragon’(包括单引号),确定.

2.6 从File菜单选择Build BIOS…构建新的BIOS.

至此BIOS已经修改完毕.

3. 修改虚拟机配置

在Vmware Workstation 7中全新安装Windows 7或使用现有虚拟机,复制vmwbios.rom到虚拟机所在文件夹,打开该文件夹找到*.vmx虚拟机配置文件,使用010 Editor打开并在末尾加入[bios440.filename = "vmwbios.rom"](不包含[]).

4. 完成激活

在Vmware Workstation 7中启动Windows 7,将OEM证书文件(*.xrm-ms)复制入虚拟系统根文件夹.以管理员身份运行命令提示符(cmd.exe),安装证书,如"slmgr.vbs -ilc c:\lenovo.xrm-ms". 等待成功确认对话框出现后继续输入密钥激活,如"slmgr.vbs -ipk xxxxx-xxxxx-xxxxx-xxxxx-xxxxx"(xxxxx代表相应的密钥).等待成功确认对话框出现即告激活正式完成.

Tags: bios, oem, VMWare, windows 7

相关文章

Posted in vmware, 生活点滴.

Tagged with , , , .


Finished Curved Hull model construction

Tihs is the Curved hull model limited from fr100-400 to fr130+400. The side block is named 541sdu,542sdu.The bottom block is named 541bot.

image

541sdu ( P and S)

imageimage

541bot

imageimage

shell expansion sketch.

image

 

the body plan sketch.

image

 

next ,  planar  HULL.

Tags: hull, Tihs Curved

相关文章

Posted in tribon, 造船.

Tagged with , .


Tribon shell profile generating and Unsolved problem.

 

Unsolved problem:

When generate the shell profile ,,this error encountered.

Error 20507 signalled when creating profile JAT23:
The space curve consists of more than one curve branch.!

 

Now ,the profile is generated like this. It’s used Bulb bar (230,13),

imageimage

imageimage

imageimage

Tags: shell profile, Tribon

相关文章

Posted in tribon, 造船.

Tagged with , .


Error when define the edge of shell plates and the solution

This log message show the error about there are no intersections in the edges of the shell plate  when create the shell plate.

WG936D – entry        0
WG939D – entry        0
WG939D – exit        0
WG936D – exit        0
WG936D – entry        0
WG939D – entry        0
WG939D – exit        0
WG936D – exit        0
WG936D – entry        0
WG939D – entry        0
WG939D – exit        0
WG936D – exit        0
WG936D – entry        0
WG939D – entry        0
WG939D – exit        0
WG936D – exit        0
WG936D – entry        0
WG939D – entry        0
WG939D – exit        0
WG936D – exit        0
WG936D – entry        0
WG939D – entry        0
WG939D – exit        0
WG936D – exit        0
WG936D – entry        0
WG939D – entry        0
WG939D – exit        0
WG936D – exit        0
WG936D – entry        0
WG939D – entry        0
WG939D – exit        0
WG936D – exit        0
WG936D – entry        0
WG939D – entry        0
WG939D – exit        0
WG936D – exit        0
   No intersection between the edges 1 and 2
_DP2                    STRIP= X   NUMBER OF STRIPS=     8
_DP2                    GAP=      0.00 AT EDGE  1
_DP2                    GAP=      0.02 AT EDGE  2
_DP2                    GAP=      0.00 AT EDGE  3
_DP2                    GAP=      0.02 AT EDGE  4
_DP2                    GAP=      0.02 AT THE BASELINE
   No intersection between the edges 1 and 3
   No intersection between the edges 1 and 2
WG936D – entry        0
WG939D – entry        0
WG939D – exit        0
WG936D – exit        0
WG936D – entry        0
WG939D – entry        0
WG939D – exit        0
WG936D – exit        0
Error    11005 occurred when defining edge    3

 

 

the solution : extend your seam or butt about 50mm , it could ensure the intersections  is existent  when system calculate the edges of shell plates.

 

imageimage

 

imageimage

 

Tags: BASELINE, EDGE, GAP, STRIPS

相关文章

Posted in 未分类.

Tagged with , , , .


Tribon Curved Hull shell Seam and Butt define

This is a sample about  the Shell Seam and Butt define. The highlight part show that it’s  a shell plate , The sketch nearby is the shell plate developed sketch.In tribon the designer could check the developed sketch realtime. It help that the designer could adjust the seam and butt  arrangement to save the material and manhour.

this is the pic about it.

image

image

Tags: Shell Seam Butt, Tribon

相关文章

Posted in 未分类.

Tagged with , .


About tribon TID server log file content.

This message shows the Server is started normally.

========================================================================================================================

tribon Surface Server version 3, 0, 5, 24
Started Sat Aug 21 14:24:04 2010
Logging information will be printed below

This message shows the error when the server can’t find the DML file

—————————————————————————————————-
tribon Surface Server version 3, 0, 5, 24, started Sat Aug 21 14:24:04 2010
Current time is Sat Aug 21 14:24:52 2010
Surface : MYHULL
Folder  : C:\tribon\M3\Projects\MY\TID\
Box     : -1000000.000      0.000 -1000000.000 1000000.000 1000000.000 1000000.000
Surface folder: C:\Tribon\M3\Projects\MY\TID\
Surface name: MYHULL
Ambiguous name MYHULL. Access (dml/dms/dm/sat) = -1/-1/-1/-1
Loading MYHULL
Opening model MYHULL
ERROR: cannot open MYHULL

This message shows the server servie the client successfully.

—————————————————————————————————-
Tribon Surface Server version 3, 0, 5, 24, started Sat Aug 21 14:39:51 2010
Current time is Sat Aug 21 14:40:25 2010
Surface : MYHULL
Folder  : C:\Tribon\M3\Projects\MY\TID\
Box     : -1000000.000      0.000 -1000000.000 1000000.000 1000000.000 1000000.000
Surface mapped to MYHULL.dml
Surface folder: C:\Tribon\M3\Projects\MY\TID\
Surface name: MYHULL.dml
Loading MYHULL.dml
Opening model MYHULL.dml
File type is DML, source 0


PLANAR INTERSECTION
Intersecting MYHULL.dml                       with plane       1.0000      0.0000      0.0000  18950.0000
Opening DML: MYHULL.dml
Raw data:  200 points across   11 curved patches.      2 points across    1 plane patches
Intersected with tol=   0.000500, Thinned with tol=   0.000500
Number of contours =    1
Contour    1
.                X             Y             Z      dX      dY      dZ
.  1     18950.000         0.000         0.000  0.000000  1.000000  0.000000
.  2     18950.000       586.064         0.000  0.000000  1.000000  0.000000
.  3     18950.000       827.355        11.998  0.000000  0.995559  0.094144
.  4     18950.000      1411.268       110.644  0.000000  0.975053  0.221970
.  5     18950.000      1620.101       161.826  0.000000  0.967241  0.253859
.  6     18950.000      2362.602       383.143  0.000000  0.958322  0.285690
.  7     18950.000      2767.010       489.338  0.000000  0.978324  0.207080
.  8     18950.000      3000.000       527.557  0.000000  0.994333  0.106314
.  9     18950.000      3000.000       527.557  0.000000  0.975510  0.219954
. 10     18950.000      3224.779       576.931  0.000000  0.976828  0.214026
. 11     18950.000      3403.990       620.286  0.000000  0.962962  0.269636
. 12     18950.000      3657.842       720.555  0.000000  0.876068  0.482188
. 13     18950.000      3996.469      1014.821  0.000000  0.632749  0.774357
. 14     18950.000      4221.738      1346.601  0.000000  0.503711  0.863872
. 15     18950.000      4457.530      1800.000  0.000000  0.431649  0.902042
. 16     18950.000      4457.530      1800.000  0.000000  0.509716  0.860343
. 17     18950.000      4560.312      1950.543  0.000000  0.590499  0.807038
. 18     18950.000      4632.418      2049.459  0.000000  0.582080  0.813131
. 19     18950.000      4840.605      2360.202  0.000000  0.546179  0.837668
. 20     18950.000      5046.285      2700.000  0.000000  0.471634  0.881794
. 21     18950.000      5046.285      2700.000  0.000000  0.448536  0.893765
. 22     18950.000      5215.380      3043.745  0.000000  0.450761  0.892645
. 23     18950.000      5480.669      3508.026  0.000000  0.540749  0.841184
. 24     18950.000      5721.855      3830.647  0.000000  0.664354  0.747418
. 25     18950.000      5785.979      3900.000  0.000000  0.694992  0.719018
. 26     18950.000      6000.000      4109.988  0.000000  0.727537  0.686068
. 27     18950.000      6354.406      4414.577  0.000000  0.791015  0.611797
. 28     18950.000      6888.679      4768.924  0.000000  0.866357  0.499425
. 29     18950.000      7380.019      5033.305  0.000000  0.891693  0.452641
. 30     18950.000      8063.873      5356.022  0.000000  0.917262  0.398284
. 31     18950.000      8451.559      5522.410  0.000000  0.915386  0.402578
. 32     18950.000      9000.000      5812.491  0.000000  0.825994  0.563679
. 33     18950.000      9000.000      5812.491  0.000000  0.855004  0.518621
. 34     18950.000      9293.611      5993.888  0.000000  0.846026  0.533142
. 35     18950.000     10126.320      6559.392  0.000000  0.803914  0.594745
. 36     18950.000     10804.766      7105.598  0.000000  0.752444  0.658657
. 37     18950.000     11324.114      7591.044  0.000000  0.708432  0.705780
. 38     18950.000     12000.000      8332.877  0.000000  0.633030  0.774127
. 39     18950.000     12605.158      9161.275  0.000000  0.551897  0.833912
. 40     18950.000     12930.607      9679.715  0.000000  0.511085  0.859530
. 41     18950.000     13406.640     10565.402  0.000000  0.432846  0.901468
. 42     18950.000     13783.842     11454.700  0.000000  0.346974  0.937875
. 43     18950.000     13992.473     12064.226  0.000000  0.305153  0.952303
. 44     18950.000     14330.000     13156.619  0.000000  0.300845  0.953673
. 45     18950.000     14510.628     13752.479  0.000000  0.282516  0.959263
. 46     18950.000     14762.328     14646.378  0.000000  0.254767  0.967002
. 47     18950.000     15000.000     15648.329  0.000000  0.208095  0.978109
. 48     18950.000     15023.984     15762.089  0.000000  0.204509  0.978865
. 49     18950.000     15244.386     16888.232  0.000000  0.181897  0.983318
. 50     18950.000     15401.588     17784.530  0.000000  0.162708  0.986674
. 51     18950.000     15559.663     18829.341  0.000000  0.135080  0.990835
. 52     18950.000     15609.118     19208.108  0.000000  0.123874  0.992298
Processing time was 0.05/0.05 seconds
Process size 29.3/29.3 Mb
Totals: Lines Ints(1), Surface Ints(0), Foreign Ints(0), Gen Cyls(0), Ext Curves(0)
----------------------------------------------------------------------------------------------------

By the way ,the TID server log file is  in   ($windows)\temp\ floder.

Tags: server, TID, Tribon

相关文章

Posted in tribon, 造船.

Tagged with , , .