從 Windows 2008 Server 中的 16 位元應用程式列印時發生錯誤

從 Windows 2008 Server 中的 16 位元應用程式列印時發生錯誤

我在嘗試在 Windows 2008 Server 中執行一堆舊的 16 位元應用程式時遇到問題。這些應用程式在 Windows 2003 Server 上運作良好,但是當我嘗試從其中任何一個進行列印時,所有應用程式都顯示列印錯誤(無法建立印表機驅動程式/術語錯誤/等)

  • LPT1 連接埠透過 NET USE LPT1 \ServerName\SharedPrinter 重定向到共用印表機
  • DIR > LPT1(或任何到印表機的 shell 重定向)工作正常。
  • 我使用的是管理員帳戶,所以應該不是權限問題,對吧?

為了重現該行為,我用 C 語言(TCC 1.01 for DOS)編寫了一個小測試程式。它在XP / 2003 Server 中運作良好,但在2008 Server 上它顯示句柄開啟(5),但當嘗試寫入該句柄時,會發出錯誤(寫入裝置LPT1 寫入故障錯誤、中止、重試、忽略、失敗)

#include <io.h>
#include <fcntl.h>
#include <sys\stat.h>

int main(void)
{
 int handle, status;
 char* sbuff;

 handle = open("LPT1", O_WRONLY, S_IFBLK);
 printf("%d\n", handle);

 if (!handle)
 {
    printf("open failed\n");
    exit(1);
 }

 sbuff = "[print test]\n";
 write(handle, sbuff, strlen(sbuff));

 close(handle);
 getch();

 return 0;
}

有什麼線索嗎?

蒂亞,巴布羅

答案1

我認為這個線程解決你的問題。關鍵步驟是使用印表機池而不是網路使用。

2) 開啟印表機屬性(在 Vista 中,以管理員身分開啟)

3) 開啟「印表機池」(在「連接埠」標籤下)

4) 除了已選擇的選項(例如 USB)之外,還選擇“LPT1:”

5)點擊應用

相關內容