{"id":51449332,"url":"https://github.com/leeguooooo/wince-file-timestamp","last_synced_at":"2026-07-05T19:01:21.591Z","repository":{"id":356043638,"uuid":"1230780883","full_name":"leeguooooo/wince-file-timestamp","owner":"leeguooooo","description":"Modify file creation/write/access timestamps on Windows CE / .NET Compact Framework 3.5 devices. GUI + CLI base64 config.","archived":false,"fork":false,"pushed_at":"2026-05-06T10:22:26.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-06T12:20:32.771Z","etag":null,"topics":["compact-framework","coredll","csharp","dotnet-cf","dotnet-compact-framework","embedded-windows","file-time","file-timestamp","gui-tool","p-invoke","setfiletime","settime","touch-alternative","wince","windows-ce","windows-mobile"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leeguooooo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-06T10:08:34.000Z","updated_at":"2026-05-06T10:22:28.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/leeguooooo/wince-file-timestamp","commit_stats":null,"previous_names":["leeguooooo/wince-file-timestamp"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/leeguooooo/wince-file-timestamp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leeguooooo%2Fwince-file-timestamp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leeguooooo%2Fwince-file-timestamp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leeguooooo%2Fwince-file-timestamp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leeguooooo%2Fwince-file-timestamp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leeguooooo","download_url":"https://codeload.github.com/leeguooooo/wince-file-timestamp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leeguooooo%2Fwince-file-timestamp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35165568,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-05T02:00:06.290Z","response_time":100,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compact-framework","coredll","csharp","dotnet-cf","dotnet-compact-framework","embedded-windows","file-time","file-timestamp","gui-tool","p-invoke","setfiletime","settime","touch-alternative","wince","windows-ce","windows-mobile"],"created_at":"2026-07-05T19:01:20.801Z","updated_at":"2026-07-05T19:01:21.584Z","avatar_url":"https://github.com/leeguooooo.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WinCE File Timestamp Tool\n\n\u003e Modify file **creation**, **last write**, and **last access** timestamps on\n\u003e **Windows CE** / **Windows Mobile** devices running **.NET Compact Framework 3.5**.\n\u003e A `touch`-equivalent for embedded Windows. GUI + CLI.\n\n[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n[![Language: C#](https://img.shields.io/badge/language-C%23-178600.svg)](SetTime.cs)\n[![Target: .NET CF 3.5](https://img.shields.io/badge/target-.NET%20CF%203.5-512bd4.svg)](https://learn.microsoft.com/en-us/previous-versions/windows/embedded/cc500517(v=msdn.10))\n[![Platform: WinCE](https://img.shields.io/badge/platform-Windows%20CE%20%7C%20Mobile-0078d4.svg)](#)\n\nA small, dependency-free C# tool to change file timestamps on Windows CE devices.\nOriginally built for industrial PM2.5 monitoring devices (CEP series), but works on\nany Windows CE 5.x / 6.x / Windows Mobile 5/6 device with .NET Compact Framework 3.5.\n\n## Why\n\nWindows CE / Windows Mobile devices rarely ship with a `touch`-equivalent utility,\nand the .NET Compact Framework `File` API does **not reliably expose**\n`SetCreationTime` / `SetLastAccessTime` (only `SetLastWriteTime` is consistent).\n\nThis tool calls the underlying Win32 API `SetFileTime` via P/Invoke into\n`coredll.dll` (CE) or `kernel32.dll` (desktop test build), which lets you set\nall three timestamps independently and reliably.\n\nUse cases:\n\n- **Industrial PDAs / HMIs / Pocket PCs** — fix data file timestamps after a clock issue\n- **Battery-died devices** — restore correct timestamps after RTC reset\n- **Pre-production normalization** — set deterministic timestamps on golden images\n- **Air quality / environmental monitors** — correct device-side data file metadata\n- **Forensic / archival** — controlled backdating in audited workflows\n\n## Features\n\n- ✅ Modify creation / last write / last access **independently** (each can be skipped)\n- ✅ **GUI mode** — double-click on the device, no command line needed\n- ✅ **Batch mode** — Base64-encoded config, deployable via SD card / FTP / over-the-air\n- ✅ **Tolerant Chinese-friendly date parsing** — `2025-01-15 10:30`, `2025年1月15日`, `2025/1/15`, etc.\n- ✅ **Wildcard expansion** — `*.dat`, `**/*.txt` recursive globs\n- ✅ **Dry-run preview** in batch mode\n- ✅ **Single 32 KB exe**, no installer, no runtime download (CF 3.5 is shipped on most CE images)\n- ✅ **Dual build** — CE binary for production, desktop test binary for verifying logic on Win10\n\n## Quick Start\n\n### 1. Build\n\nOn a Windows machine with **.NET Framework 3.5** enabled and the\n**.NET Compact Framework 3.5 reference assemblies** available\n(typically from a Visual Studio 2008 Pro install — see [docs/BUILD_GUIDE.md](docs/BUILD_GUIDE.md)):\n\n```bat\nbuild_settime_ce.bat\n```\n\nOutput: `SetTime.exe` (~32 KB).\n\n### 2. Deploy\n\nCopy `SetTime.exe` to the device (e.g. `\\Storage Card\\SetTime\\` or `\\硬盘\\SetTime\\`).\n\n### 3. Use\n\n**GUI mode** (recommended for end-users):\n\nDouble-click `SetTime.exe` on the device. A window appears with:\n\n- Directory picker (Browse button uses `OpenFileDialog`)\n- Filename filter (e.g. `*.dat`)\n- \"Include subdirectories\" checkbox\n- Target time input (accepts many formats)\n- Three checkboxes: ☑ Creation / ☑ Last Write / ☑ Last Access\n- Confirm dialog before applying\n\n**Batch mode** (for automation):\n\nProvide a Base64-encoded config:\n\n```\nsettime\n\\Storage Card\\data\\sample.txt,2025-01-15 10:30:00\n\\Storage Card\\data\\*.dat,2025-03-01 08:00:00,+30s\n```\n\nEncode it (PowerShell):\n\n```powershell\n[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes((Get-Content .\\config.txt -Raw))) | Set-Content .\\settime.ini -Encoding ASCII\n```\n\nThen run:\n\n```\nSetTime.exe settime.ini\nSetTime.exe settime.ini --dry-run    # preview without modifying\n```\n\nSee [`settime_sample.txt`](settime_sample.txt) for a working example.\n\n## Date Format Support (GUI Mode)\n\nThe GUI input accepts (case-insensitive, whitespace-tolerant):\n\n```\n2025-01-15 10:30:00\n2025-01-15 10:30\n2025-1-15 10:30\n2025/01/15 10:30:00\n2025/1/15\n2025-01-15\n2025年1月15日 10:30\n2025年1月15日\n2025年1月15日 10点30分\n```\n\nIf only a date is given, time defaults to `00:00:00`.\n\n## Builds\n\n| Build | Output | Target | Use |\n|---|---|---|---|\n| `build_settime_ce.bat` | `SetTime.exe` | .NET CF 3.5 | **Production — deploy to CE devices** |\n| `build_settime_win10.bat` | `SetTime_Desktop.exe` | .NET Framework 3.5 desktop | Development verification on Windows 10 |\n\nBoth are produced from the **same `SetTime.cs`** via the `WIN10_DESKTOP` preprocessor symbol,\nwhich switches:\n\n- P/Invoke target: `coredll.dll` (CE) ↔ `kernel32.dll` (desktop)\n- `[STAThread]` attribute on `Main` (required for desktop `MessageBox`, absent on CF)\n- Assembly path resolution: `Assembly.Location` (desktop) ↔ `GetName().CodeBase` (CF)\n\n## How It Works\n\nP/Invoke chain in [`SetTime.cs`](SetTime.cs):\n\n```csharp\n[DllImport(\"coredll.dll\", EntryPoint = \"CreateFileW\", ...)]   // CE\n// or \"kernel32.dll\" on desktop\nprivate static extern IntPtr CreateFile(string fileName, uint access, ...);\n\n[DllImport(\"coredll.dll\", EntryPoint = \"SetFileTime\", ...)]\nprivate static extern bool SetFileTime(\n    IntPtr hFile,\n    IntPtr lpCreationTime,    // IntPtr.Zero to skip\n    IntPtr lpLastAccessTime,\n    IntPtr lpLastWriteTime);\n\n[DllImport(\"coredll.dll\", EntryPoint = \"CloseHandle\", ...)]\nprivate static extern bool CloseHandle(IntPtr handle);\n```\n\nEach timestamp pointer is allocated via `Marshal.AllocHGlobal` only when that\ncheckbox is ticked, allowing **independent modification of any subset** of the\nthree timestamps. `IntPtr.Zero` tells the Win32 API to leave that field unchanged.\n\nRead-only / hidden / system attributes are temporarily cleared before\n`SetFileTime` and restored after, so protected files can be modified without\npermanently changing their attributes.\n\n## CF 3.5 API Quirks Handled\n\nIf you're targeting CF 3.5 yourself, watch out for these (all addressed in this code):\n\n| Desktop API | CF 3.5 alternative |\n|---|---|\n| `[STAThread]` on `Main` | Not supported; use plain `Main` |\n| `File.GetAttributes` / `File.SetAttributes` | Use `FileInfo.Attributes` instead |\n| `Application.ExecutablePath` | Use `Assembly.GetExecutingAssembly().GetName().CodeBase` |\n| `Control.SetBounds(x, y, w, h)` | Use `Location = new Point(...)` and `Size = new Size(...)` |\n| `MessageBox.Show(text, caption, buttons)` (3-arg) | Must include `MessageBoxIcon` and `MessageBoxDefaultButton` |\n| `DateTime.TryParseExact` | Use `ParseExact` wrapped in `try/catch (FormatException)` |\n| `Directory.GetFiles(path, pattern, AllDirectories)` | Manually recurse with `Directory.GetDirectories` |\n| `File.ReadAllBytes` | Use `FileStream.Read` loop |\n| Generic `List\u003cT\u003e` | Use `ArrayList` for portability across CF revisions |\n\n## Documentation\n\n- [BUILD_GUIDE.md](docs/BUILD_GUIDE.md) — extracting CF 3.5 reference assemblies from a VS2008 ISO without a full install\n- [VERIFICATION.md](docs/VERIFICATION.md) — three-tier verification approach (static / desktop emulator / device)\n\n## Limitations\n\n- **No multi-file picker** in GUI mode — pick a directory + filter, or pick one file via `OpenFileDialog`. Multi-select on CF 3.5 `OpenFileDialog` is unreliable across CE images.\n- **No relative date support** — `today`, `now`, etc. are not parsed (deliberately, to avoid timezone surprises).\n- **Time zone**: timestamps are interpreted in the device's local time. Verify the device clock displays the expected time before running.\n- **CE x86 target only** — recompile for ARM if needed (csc with `/platform:ARM` is not available; use `corflags` or rebuild with appropriate flags).\n\n## Contributing\n\nIssues and PRs welcome. Common asks:\n\n- ARM build instructions\n- Native C++ port (for CE images without .NET CF)\n- More date formats (e.g. ISO 8601 with timezone)\n- Localization beyond Chinese / English\n\n## License\n\nMIT — see [LICENSE](LICENSE).\n\n---\n\n## 中文简介\n\nWinCE 文件时间戳修改工具——给跑 .NET Compact Framework 3.5 的 Windows CE / Windows Mobile 设备改文件的**创建时间、修改时间、访问时间**。最初为工业 PM2.5 监测设备开发，适用于任何带 CF 3.5 的 PocketPC / WM5 / WM6 / WinCE 5.x / WinCE 6.x 设备。\n\n**功能**：\n\n- 三个时间戳分别勾选（任选其一或全选）\n- GUI 模式：设备上双击，零命令行\n- 批处理模式：base64 编码配置，可走 SD 卡 / FTP / 远程下发\n- 中文友好的日期解析（年月日点分秒，全角冒号都吃）\n- 通配符 `*` `**`，支持递归\n- 32 KB 单文件 exe，无依赖\n\n**构建**：\n\n需要 Windows 上的 **.NET Framework 3.5** + **.NET CF 3.5 引用程序集**（VS2008 Pro ISO 里有）。详见 [`docs/BUILD_GUIDE.md`](docs/BUILD_GUIDE.md)。\n\n**部署**：把 `SetTime.exe` 拷到设备（如 `\\硬盘\\SetTime\\`）双击运行。\n\n**许可证**：MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleeguooooo%2Fwince-file-timestamp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleeguooooo%2Fwince-file-timestamp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleeguooooo%2Fwince-file-timestamp/lists"}