およびニュースあなたの最もよい資料源約 秘密, ヴィスタハードウェア そして xp インターネット

ヴィスタの記事 上50 ヴィスタのビデオ 柔らかいヴィスタ ヴィスタの助け

クリップボードの無秩序!


注: 最初にこの内容からの http://mygreenpaste.blogspot.com. 読書他の場所からのそれ、訪問するのに時間をかけなさい 私の緑ののり、株式会社. ありがとう。

わかりました、は従って多分無秩序僅かな乱暴な言葉ここにである。 しかしクリップボードは最近nuts私を運転していた! 私がすることを試みていたすべてはそれへテキストをコピーすることであり操作は失敗していた。 当然、それがアドホックなappだったので、私はエラー処理種類のエラー処理をを持たなかった。 appは1つのシステムでうまく動作したが、クリップボードにテキストをコピーするために別のシステム(仮想計算機)のappを動かすことは一貫して失敗に終わった。

最終的に、私は問題が起こるとき私のappはクリップボードにデータを置くが、私はまだ適当な回避策をのための見つけていないことをどんなプロセスが防いでいたか定められた。 それはクリップボードにテキストのコピーの行為として私のために重大、である条件より正確さの多くではない。

とにかく、P/Invokeを使用して System.Diagnostics、私はvmusrvc.exe -事実上のPC 「仮想計算機ユーザー」の整備する-に開いたクリップボードがあったことを分った。 タイムスタンプを使用してからの プロセスモニター「でき事の(100つの氏間隔で発生する)側面図を描くsおよび私のappからの壊れる操作のタイムスタンプ、私はvmusrvc.exeの積み重ねを定められた:

ntdll.dllKiFastSystemCallRet
vmusrvc.exevmusrvc.exe + 0x9a17
vmusrvc.exevmusrvc.exe + 0x9c24
vmusrvc.exevmusrvc.exe + 0x91f8
vmusrvc.exevmusrvc.exe + 0x907f
USER32.dllInternalCallWinProc + 0x28
USER32.dllUserCallWinProcCheckWow + 0x150
USER32.dllDispatchClientMessage + 0xa3
USER32.dll__fnDWORD + 0x24
ntdll.dllKiUserCallbackDispatcher + 0x13
vmusrvc.exevmusrvc.exe + 0x2d29
vmusrvc.exevmusrvc.exe + 0xdba6
kernel32.dllBaseProcessStart + 0x23

変数は、当然、vmusrvc.exeのための記号情報は利用できないようではないしが明らかにuser32.dllメッセージを処理していない。 私はより遅いポイントをこの多く検討するかもしれない。

私のクリップボードの仕事と干渉していたプロセスを見つけるためには、私は呼ぶのにP/Invokeを使用した GetOpenClipboardWindow次に()および GetWindowThreadProcessId()、GetOpenClipboardWindow著戻るハンドルで渡る()。 それから、プロセスの実行可能な名前を見つけることは使用のちょうど問題だった モジュール のコレクション プロセス 例は()にGetWindowThreadProcessIdを取り出されたプロセスIDで通じることによって戻った System.Diagnostics.Process.GetProcessById().

次のコード:

System.Runtime.InteropServicesを使用して;
System.Diagnosticsを使用して;
...
ひもデータ= 「aasdlkjasdlk alkjsdl kajsdlkj Al」の;
試み
{
Clipboard.SetData (System.Windows.Forms.DataFormats.Textのデータ);
}
捕獲物(ExternalExceptionのee)
{
LogIt (ee.ToString ());
IntPtr hWnd = GetOpenClipboardWindow ();
(IntPtr.Zero! = hWnd)
{
uintのpid = 0;
uintのtid = GetWindowThreadProcessId (hWnd、pid);
LogIt (「hWnd {0}とのプロセス、PID {1} ({1: X})、TID {2} ({2: X})」、+
"name {3} has the clipboard", hWnd, pid, tid,
Process.GetProcessById( (int)pid ).Modules[0].FileName );
}
}

Resulted in the following output:


2008-03-25 00:54:45.4938864--> System.Runtime.InteropServices.ExternalException: Requested Clipboard operation did not succeed.
at System.Windows.Forms.Clipboard.ThrowIfFailed(Int32 hr)
at System.Windows.Forms.Clipboard.SetDataObject(Object data, Boolean copy, Int32 retryTimes, Int32 retryDelay)
at System.Windows.Forms.Clipboard.SetData(String format, Object data)
at Clippy.Form1.button1_Click(Object sender, EventArgs e)
2008-03-25 00:54:45.5339440--> Process with hWnd 65716 (65716), PID 1492 (5d4), TID 1496 (5d8), name C:\Program Files\Virtual Machine Additions\vmusrvc.exe has the clipboard

Interestingly, trying an alternative method of the Clipboard to set the content also failed. The Clipboard.SetDataObject() overload that takes a retryTimes and retryDelay parameter failed in the same fashion after roughly ten seconds when invoked as follows:


Clipboard.SetDataObject( data, false, 100, 100 );

I tried variations on retryTimes and retryDelay, to no avail.

Not sure what vmusrvc.exe is doing with the clipboard (probably has to do with monitoring it for host / guest VM interaction), but the act of setting the contents of the clipboard didn't fail 100% of the time in the VM. Often enough to make it extremely unreliable, though. During "normal" system usage, I was not able to cause a failure when running the app on a non-virtual (actual?) system.

Popularity: 2%


Written by «/\/\Ø|ö±ò\/»®©. Read more great feeds at is source WEBSITE
no comments.
Read more articles on P/Invoke and GetOpenClipboardWindow and System.Diagnostics and Clipboard and GetWindowThreadProcessId and Process Monitor and c# and processes and Virtual Machine and otherSoftware and Virtual PC.

No comments

There are still no comments on this article.

Leave your comment...

If you want to leave your comment on this article, simply fill out the next form:




You can use these XHTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong> .