<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Rのメモ帳 &#187; Optimus</title>
	<atom:link href="http://brandish.xrea.jp/wordpress/?feed=rss2&#038;tag=optimus" rel="self" type="application/rss+xml" />
	<link>http://brandish.xrea.jp/wordpress</link>
	<description>Regihsが送るぐだぐだな日々の中で思いついたことを書き綴るページです。</description>
	<lastBuildDate>Wed, 25 Jul 2012 01:19:38 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>NVIDIAのOptimusとPlayOnline Viewer</title>
		<link>http://brandish.xrea.jp/wordpress/?p=194</link>
		<comments>http://brandish.xrea.jp/wordpress/?p=194#comments</comments>
		<pubDate>Sat, 25 Jun 2011 12:13:30 +0000</pubDate>
		<dc:creator>regihs</dc:creator>
				<category><![CDATA[ソフトウェア]]></category>
		<category><![CDATA[トラブルシューティング（ソフトウェア）]]></category>
		<category><![CDATA[FF11]]></category>
		<category><![CDATA[Optimus]]></category>
		<category><![CDATA[トラブルシューティング（プログラミング）]]></category>

		<guid isPermaLink="false">http://brandish.xrea.jp/wordpress/?p=194</guid>
		<description><![CDATA[ThinkPad X60の熱問題に耐えられなくなり、ThinkPad T420を購入しました。届いたのでFF11をインストールしたのですが、PlayOnline Viewerが起動しない（原因不明のエラーにより「動作を停 &#8230; <a href="http://brandish.xrea.jp/wordpress/?p=194">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>ThinkPad X60の熱問題に耐えられなくなり、ThinkPad T420を購入しました。届いたのでFF11をインストールしたのですが、PlayOnline Viewerが起動しない（原因不明のエラーにより「動作を停止しました」状態になる）という不具合に遭いました。まだ根本的には解決していないのですが、対症療法的なものを見つけたので、ここにメモしておきます。</p>
<p><a href="http://oshiete.goo.ne.jp/qa/6708670.html">こちら</a>の記事によれば、PlayOnline Viewerが起動しないのはNVIDIAのOptimusに問題があるとのことです（ThinkPad T420固有の問題というわけではないらしい）。何が原因なのかわかりませんが、PlayOnline Viewerを起動するとNVIDIAのドライバ（<code>nvumdshim.dll</code>）でエラーが生じて、そのままハングアップしてしまうようです。このハングアップが厄介で、これまた理由は分からないのですが、シェルを巻き添えにしてしまいます。タスクマネージャすら応答しなくなりプロセスの終了もさせられなくなるので、Ctrl+Alt+Deleteでログオフを選ぶしかありません。</p>
<p>対症療法的な対策として、<code>C:\Windows\SysWOW64\nvumdshim.dll</code>を一時的にリネームするなどして除いておくというものがあります。前記DLLが存在しない状態ならばPlayOnline Viewerを起動することができるようになります（これまたこれまた理由が分かりません）。ただし、そのままではFF11が起動しなくなるので、PlayOnline Viewerが起動した後は元の状態に戻しておかなければなりません。</p>
<p>また、<a href="http://oshiete.goo.ne.jp/qa/6708670.html"><code>nvumdshim.dll</code>を置き換えるという手段</a>があります。<a href="http://www.dllme.com/dll/files/nvumdshim_dll.html">古いドライバのDLL</a>に置き換えることで、不具合を避けることができるとのことです。置き換えると、確かに、PlayOnline Viewerがエラーで停止することはなくなります。ただし、他に影響が生じない保証はありませんし、リンク先のファイル自体が安全である保証もありません（いちおうAvira Antivirusでスキャンしましたが何も検出されませんでした）。くれぐれも自己責任で試してみてください。また、既存のファイルはリネームするなどして保存しておくようにしましょう。何らかの問題が生じても、ファイルを元に戻せば復旧できるものと思われます。こちらの手段をとる場合、次のようなスクリプトを使う必要はありません。</p>
<p>ファイルを置き換えた場合、他のDirectX使用アプリケーションが正常に動作しなくなるおそれがあります。実際、Google EarthのDirectXモードは起動しませんでした（OpenGLモードならば起動できます）。</p>
<p><span id="more-194"></span></p>
<p>リネーム作業を毎回手動で行うのも大変なので、自動的に行うようスクリプトを組んでみました。処理系をインストールしなくても済むように、Windows Scripting Hostで書いています（ファイル名<code>runpol.vbs</code>）。なお、このスクリプトは異常系への対処がなされていないので、使用する場合は自己責任でお願いします。</p>
<hr/>
<p>ファイルを置き換える方法でPlayOnline Viewerを起動させるスクリプトは、次の通りです。</p>
<p>事前に、置き換えるファイルを<code>C:\Windows\SysWOW64</code>へ<code>nvumdshim_pol.dll</code>として配置しておいてください。スクリプトは、リネームにより、このファイルを<code>nvumdshim.dll</code>と入れ替えてPlayOnline Viewerを起動します。起動後、もとの名前に戻します。理由はよく分かりませんが、このスクリプトでは、後に掲載する方法とは異なり、FF11から正常にシャットダウンを行うことができます。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #151B8D; font-weight: bold;">Dim</span> currpath, polpath, temppath
&nbsp;
<span style="color: #151B8D; font-weight: bold;">Set</span> fs = WScript.<span style="color: #E56717; font-weight: bold;">CreateObject</span>(<span style="color: #800000;">&quot;Scripting.FileSystemObject&quot;</span>)
<span style="color: #151B8D; font-weight: bold;">Set</span> shell = WScript.<span style="color: #E56717; font-weight: bold;">CreateObject</span>(<span style="color: #800000;">&quot;WScript.Shell&quot;</span>)
&nbsp;
currpath = <span style="color: #800000;">&quot;C:\Windows\SysWOW64\nvumdshim.dll&quot;</span>
polpath = <span style="color: #800000;">&quot;C:\Windows\SysWOW64\nvumdshim_pol.dll&quot;</span>
temppath = <span style="color: #800000;">&quot;C:\Windows\SysWOW64\nvumdshim_temp.dll&quot;</span>
&nbsp;
<span style="color: #151B8D; font-weight: bold;">Dim</span> polexists, tempexists
&nbsp;
polexists = fs.FileExists(polpath)
tempexists = fs.FileExists(temppath)
&nbsp;
<span style="color: #8D38C9; font-weight: bold;">If</span> tempexists <span style="color: #8D38C9; font-weight: bold;">Then</span>
  <span style="color: #151B8D; font-weight: bold;">Set</span> currfile = fs.GetFile(temppath)
  <span style="color: #151B8D; font-weight: bold;">Set</span> polfile = fs.GetFile(currpath)
<span style="color: #8D38C9; font-weight: bold;">Else</span>
  <span style="color: #8D38C9; font-weight: bold;">If</span> polexists <span style="color: #8D38C9; font-weight: bold;">Then</span>
    <span style="color: #151B8D; font-weight: bold;">Set</span> currfile = fs.GetFile(currpath)
    <span style="color: #151B8D; font-weight: bold;">Set</span> polfile = fs.GetFile(polpath)
&nbsp;
    <span style="color: #008000;">' POL起動前にDLLを入れ替える
</span>    currfile.Name = <span style="color: #800000;">&quot;nvumdshim_temp.dll&quot;</span>
    polfile.Name = <span style="color: #800000;">&quot;nvumdshim.dll&quot;</span>
  <span style="color: #8D38C9; font-weight: bold;">Else</span>
    WScript.Echo <span style="color: #800000;">&quot;入れ替えるDLLが見つかりません。&quot;</span>
    WScript.Quit
  <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">If</span>
<span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">If</span>
&nbsp;
<span style="color: #008000;">' POLを起動する
</span>shell.CurrentDirectory = <span style="color: #800000;">&quot;C:\Program Files (x86)\PlayOnline\SquareEnix\PlayOnlineViewer&quot;</span>
shell.Run <span style="color: #800000;">&quot;pol.exe&quot;</span>, 1, <span style="color: #00C2FF; font-weight: bold;">true</span>
&nbsp;
<span style="color: #008000;">' 入れ替えたDLLを元に戻す
</span>polfile.Name = <span style="color: #800000;">&quot;nvumdshim_pol.dll&quot;</span>
currfile.Name = <span style="color: #800000;">&quot;nvumdshim.dll&quot;</span></pre></td></tr></table></div>

<p>なお、このスクリプトをそのまま動かしても、管理者特権がないのでシステム領域にあるファイル名を変更することができず、動作しません。管理者権限でコマンドラインシェル（cmd.exe）を起動したうえで実行しなければなりません。wscript.exeへのショートカットを作っても、システムの一部を構成しているという理由により、管理者権限での実行を設定することができません。</p>
<p>これは、<a href="http://www.vector.co.jp/soft/winnt/prog/se389017.html">このようなスクリプトを実行ファイル（exeファイル）に変換するフリーソフト</a>を通して実行ファイルに変換し、「管理者権限で実行」というプロパティを設定することで対処することができます。起動時に管理者権限への昇格が求められますが、それはPlayOnline Viewerを起動する場合も同じです。</p>
<hr/>
<p>以下は、<code>nvumdshim.dll</code>をリネームにより取り除くスクリプトです。</p>
<p>この方法には、ひとつ問題があります。FF11終了時にPlayOnline Viewerを通るのですが、ここでハングアップが生じてしまいます。これは変更したファイル名をPlayOnline Viewer起動後元に戻しても発生してしまうので、避けることができません（FF11を「シャットダウン」で終了させても発生します）。このハングアップも前述の通りエクスプローラを巻き込みます。そのため、他のアプリケーションを動かしていると強制終了させなければならない（Windowsからログアウトしなければならない）ことになるので注意が必要です。回避策があるのかどうかも不明です。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #151B8D; font-weight: bold;">Dim</span> path, renamed
&nbsp;
<span style="color: #151B8D; font-weight: bold;">Set</span> fs = WScript.<span style="color: #E56717; font-weight: bold;">CreateObject</span>(<span style="color: #800000;">&quot;Scripting.FileSystemObject&quot;</span>)
<span style="color: #151B8D; font-weight: bold;">Set</span> shell = WScript.<span style="color: #E56717; font-weight: bold;">CreateObject</span>(<span style="color: #800000;">&quot;WScript.Shell&quot;</span>)
&nbsp;
path = <span style="color: #800000;">&quot;C:\Windows\SysWOW64\nvumdshim.dll&quot;</span>
renamed = 0
<span style="color: #8D38C9; font-weight: bold;">If</span> fs.FileExists(path) <span style="color: #8D38C9; font-weight: bold;">Then</span>
  <span style="color: #151B8D; font-weight: bold;">Set</span> file = fs.GetFile(path)
  file.Name = <span style="color: #800000;">&quot;_nvumdshim.dll&quot;</span>
  renamed = 1
<span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">If</span>
&nbsp;
shell.CurrentDirectory = <span style="color: #800000;">&quot;C:\Program Files (x86)\PlayOnline\SquareEnix\PlayOnlineViewer&quot;</span>
shell.Run(<span style="color: #800000;">&quot;pol.exe&quot;</span>)
&nbsp;
<span style="color: #8D38C9; font-weight: bold;">If</span> renamed = 0 <span style="color: #8D38C9; font-weight: bold;">Then</span>
  str = <span style="color: #800000;">&quot;POLが起動した後にOKを押してください。FF11起動に備えてnvumdshim.dllに戻します。&quot;</span>
<span style="color: #8D38C9; font-weight: bold;">Else</span>
  str = <span style="color: #800000;">&quot;nvumdshim.dllをリネームしました。POLが起動した後にOKを押してください。FF11起動に備えてnvumdshim.dllに戻します。&quot;</span>
<span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">If</span>
&nbsp;
WScript.Echo str
&nbsp;
path = <span style="color: #800000;">&quot;C:\Windows\SysWOW64\_nvumdshim.dll&quot;</span>
renamed = 0
<span style="color: #8D38C9; font-weight: bold;">If</span> fs.FileExists(path) <span style="color: #8D38C9; font-weight: bold;">Then</span>
  <span style="color: #151B8D; font-weight: bold;">Set</span> file = fs.GetFile(path)
  file.Name = <span style="color: #800000;">&quot;nvumdshim.dll&quot;</span>
  renamed = 1
<span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">If</span>
&nbsp;
<span style="color: #8D38C9; font-weight: bold;">If</span> renamed = 0 <span style="color: #8D38C9; font-weight: bold;">Then</span>
  str = <span style="color: #800000;">&quot;_nvumdshim.dllが見つかりませんでした。退避したnvumdshim.dllを元に戻しておいてください。&quot;</span>
<span style="color: #8D38C9; font-weight: bold;">Else</span>
  str = <span style="color: #800000;">&quot;ファイル名をnvumdshim.dllに戻しました。&quot;</span>
<span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">If</span>
&nbsp;
WScript.Echo str</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://brandish.xrea.jp/wordpress/?feed=rss2&#038;p=194</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
