13 ms·
Is there a maximum size for Windows clipboard data?
- theandrewbailey 4y agoThe Old New Thing is such a treasure of insights into how Windows works (or used to work).
- dixie_land 4y agoAnd Raymond tells the story in a fun and engaging way. I really look forward to a volume 2 of The Old New Thing book (a compilation of his blog entries)
- ripley12 4y agoIt's interesting how The Old New Thing is clearly a passion project for Raymond, but it's also an essential part of Windows documentation. I've run into a lot of situations where Raymond's blog is way more useful than the official docs.
- avisser 4y agoI love how I read the subject and knew it was a Raymond Chen post.
- bombcar 4y ago> over 300,000 rows Any process you ever enable in code will be pushed to limits you never dreamed possible. This is exactly where discoverability can come into play - someone starts by copying 50 rows and using that to get their job done, and may never realize there are other ways (CSV export, etc). If code can "recognize" when something like this is being done and provide documentation on other ways, it can help people learn new methods.
- Arrath 4y ago> If code can "recognize" when something like this is being done and provide documentation on other ways, it can help people learn new methods. Now I'm imaging Clippy popping up when you copy a ludicrous amount of data to the clipboard. "You appear to be using a cludgy method, may I suggest something better?" Of course, I'm guilty of things like this. I have one excel macro that splits data from a giant stream* (one monolithic CSV, actually) into discrete units, graphs them, and then sorts the graphs for printing. It makes a lot of use of the clipboard, and god help you if you try to copy/paste something while the macro is running. *Giant enough that at one point it grew to where I overran my Int and had to upgrade some of the code to Longs :V
- ody4242 4y agoThere are some exotic scenarios, where copy-paste is the good(fast) solution. For example, one of my clients can be accessed via a VPN. Once I'm on the VPN, I have to start their VDI. Inside the VDI, I need to start another VPN, that then allows me to open a Putty session to a bastion host, that I can use to reach my destination cluster. Believe it or not, they don't want to make it simpler. Copy/paste works flawlessly through the VDI into the putty session, so I usually just uuencode my blob, and copy it to destination cluster and uudecode there, instead of uploading the file to the VDI, then pscp to the bastion host, and then scp to the destination cluster. (I know of zmodem, port forwarding and such, none of this is allowed...)
- ntoskrnl 4y agoThat sounds horrific. I wonder if anyone has built a TCP tunnel that works over shared clipboard? :)
- sandermvanvliet 4y agoNot sure but I’ve made something more ugly. Once upon a time at $workplace we had a production and development LAN and we had two PC’s sitting on our desks, one for prod and one for dev. Now there was a special SMB share to move stuff between the two networks but trying to copy something from one Pc to the other was tedious. So of course I wrote a magic clipboard utility that used a file on that SMB share as the clipboard “storage”. Running the utility on both PCs allowed me to use copy-paste between the two PCs…
- funcDropShadow 4y agoI have once worked for a customer where other freelancer had developed a special proxy. The customer required working in a hermetically closed vpn environment even to access the test systems. Whitelisting a single web page cost an unreasonable amount of budget and took days to weeks. Therefore someone had decided to run the vpn inside a virtual machine, and developed an http proxy that consisted of two processes, one running inside the VM and one outside. Now, you gan guess how they exchanged requests and responses. That whole setup was surprisingly usable.
- cnity 4y agoThis is a chicken and egg problem. This limit seems impossibly high because users lack the expectation they can perform this action, because designers of software don't expect users to perform this action, because users lack the expectation they can... I disagree with sibling comments that copy/paste is a hacky solution. It's a very natural one for lots of users and there's no actual fundamental reason not to be able to accommodate it.
- akira2501 4y agoThere's no actual fundamental reason that opening and accessing workbook data from the command line should be so hard, either. Particularly from PowerShell. This is a "Microsoft refuses to make composable software" problem.
- juki 4y agoThe ImportExcel (https://github.com/dfinke/ImportExcel https://github.com/dfinke/ImportExcel) PowerShell module is quite useful.
- deleted 4y ago[deleted]
- babypuncher 4y agoSome video games have tutorial systems similar to this. They will recognize when players are struggling with a certain mechanic or system, and pop up a relevant tutorial. i.e. if a user is trying and failing to jump across a gap, they probably forgot to use their hover boots. This can get annoying though if the user is deliberately doing something that ends up triggering these messages.
- egypturnash 4y ago“I bet I could get across this if I had those hover boots” as a voice line from the character can be somewhat less annoying. If it’s implemented well. I think it was the new Horizon Zero Dawn game that I’ve heard constantly does that to an annoying amount? Haven’t played that one.
- treeman79 4y agoFiled a bug report once. App crashes when font is more then 13,000 points. There was a long discussion on memory management before they just stuck a max size on it.
- sudosysgen 4y agoWhen I was a dumb kid, with my friends, we'd inject 100k point unicode fish into the chats of online games and crash every single client. Eventually they encrypted their chat protocol instead of just removing HTML support and doing sanitation. We eventually figured it out but it was exam season so we dropped it
- geraldcombs 4y agoWe (Wireshark) ended up doing this when someone tried to load a capture with 54 million packets: https://gitlab.com/wireshark/wireshark/-/issues/16908 https://gitlab.com/wireshark/wireshark/-/issues/16908
- markmark 4y agoVisual Studio used to (or maybe still does) have an issue where it wouldn't hit breakpoints after the 65,536th line in a source file. It wasn't something I ever encountered, I just came across the issue in the docs somewhere, but I pity the person that ran into it.
- tomcam 4y ago> Any process you ever enable in code will be pushed to limits you never dreamed possible. Not me. And that’s not a brag. It is probably not a productive way to think using modern toolsets. But in my world, if you can copy a few things, you should definitely expect someone to copy a shitload of things or at the very least, document clearly and with rich error messages what went wrong. Likewise, I tend to get nervous when I can’t explicitly handle out of memory conditions, and the problem is I’m a Go programmer. It kind of bothers me that there’s no standard way to deal with that on my end with built-in data structures such as maps and strings. This is probably sheer paranoia because most modern systems have plenty of memory… But it still leaves me uneasy.
- capableweb 4y ago> Next time, we’ll see what we can do to extend this timeout. That, somehow, seems like the wrong conclusion. Why not try to solve the problem of Excel taking longer than 30 seconds to export a RTF table?
- kencausey 4y agoGiven the range of computers on which Excel is likely to be running that seems like a complete non-starter. There will always be cases that take longer than X no matter what you choose for X.
- capableweb 4y agoYeah, why not display a "Exporting..." dialog then that the user themselves can cancel if they think it's taking too long? Extending the timeout to X won't solve anything.
- elpocko 4y agoWhen you press Ctrl+V, the target window is focused. Forcibly switching back to Excel to show this dialog seems weird and confusing to me.
- glenneroo 4y agoThen why not show a system dialog similar to copy/move files dialog after e.g. 5 seconds of waiting for a copy-to-clipboard operation?
- hackmiester 4y agoActually, now that you point out that this could be done, I’m surprised it wasn’t.
- seritools 4y agoCool, now it's optimized and it manages to export up to a million lines in 30 seconds. What do you propose to do when the next customer wants to copy 1.5 million lines?
- dataflow 4y ago> Next time, we’ll see what we can do to extend this timeout. I guess I'm impatient... how does one go about this?
- hermitdev 4y agoI don't know, but I'd except a follow up post from Raymond on this tomorrow. He often does these multipart posts, broken up in rather digestible chunks.
- jbverschoor 4y agoThere shouldn't be an arbitrary timeout. Anything that isn't instantly should have a UI showing progress / ability to cancel (or even pause).
- londons_explore 4y agoI believe there is such an API... If you copy a file out of a rar archive and paste it into Gmail, you get to see the UI pop up and extraction begin...
- dragontamer 4y agoThe Windows Clipboard, for all of its problems, remains one of the easiest program-to-program communication methods to use in modern GUIs. I can take a screenshot of my Firefox with "PrtScn" button (moving a bitmap of the page into the Clipboard), paste it into Microsoft Paint, edit it a bit, and then copy/paste that into my Discord chat screen for commentary. -------- Yes, Linux / *Nix users have pipes and great text processing tools. Yes, Powershell has interesting objects that can be passed round. But practically speaking? Most of my "inter-process communications" is over this silly "Clipboard" Windows has, and it works way better than it probably should.
- magicalhippo 4y agoEven better, you can copy an attachment in a mail in Outlook, and paste it into an application running on another computer via RDP. The file will be copied over without the applications knowing any better. We use this so users can attach invoices and other documents they've received through mail to orders in our application. Users typically run Outlook on their laptop/PC, but our application as a published application. We rely on Excel exposing the data in an XML format on the clipboard to reliably import data from Excel. Same for Open/LibreOffice. Without it it's impossible to handle cells which contain both the quote character and newlines, due to the way Excel formats plaintext. We don't want to import the whole file, because the users typically only need to import parts of the spreadsheet. This saves us from writing a complex UI to select the data to import. And FWIW, I've used that with >100k rows of data.
- Melatonic 4y agoYea this is a super underrated feature - copy and paste through RDP is awesome. Although in some cases you would probably want to of course disable that for security reasons.
- yardshop 4y agoIt works several layers deep too. My typical WFH scenario these days is: home PC -> RDP to work laptop at home -> VNC to work network -> RDP to work desktop -> RDP to other VMs and PCs at work I can copy text or a file or a screen shot at any level and paste at any other level. Pretty amazing.
- ErikAugust 4y agoWouldn’t it be nice if it threw an error, and didn’t just return NULL?
- Akronymus 4y agoItd be nice if the proviser were to show a dialog that a copy was requested but couldnt be provided. Altough, dunno what a good message for that would be.
- hackmiester 4y agoVery old school windows apps like SecureCRT display semi-helpful messages for this. Better than a silent failure anyway.
- passivate 4y agoI don't think low level system APIs when called from an App should be messing with UI components. Can you explain what is better about it?
- Akronymus 4y agoI don't think it is the system level API, but rather the program receiving a notification that the copy paste didn't succeed where the program can then display an error/warning. At least from my understanding.
- bsnal 4y agoIf you get NULL, you are supposed to call GetLastError to get information on what happened.
- taspeotis 4y agoHow would you like this C API to throw an error?
- deleted 4y ago[deleted]
- jeffwask 4y agoThe world is run by one giant excel spreadsheet
- Kipters 4y agoI must admit, just by reading the title and the domain on HN's homepage I was dead sure it was a Raymond Chen post
- 867-5309 4y agoI find the size always seems to run run parallel with my patience at that given moment
- asciimov 4y agoThe Old New Thing and Dave's Garage (on youtube) have helped me develop an appreciation for the decisions made in Windows development, kinda wish we had this kind of stuff from the Mac and Linux side of things.
- EFruit 4y agoRaymond's blog always hits a note of morbid fascination. At times it almost feels like schadenfreude. "Neat, but thank God I didn't have to be the one that wrote/discovered that."
- nice_byte 4y agoI'm actually quite surprised that it takes over 30 seconds to go through only 300000 items and generate some text with them. Unless the story is from ancient times, that is.
- jayd16 4y ago300k rows but who knows how many columns.
- nolok 4y ago30 seconds seems awefully long indeed and it's probably not on a modern / 2022 computer, but RichText clipboard data in windows does a lot of processing to render in a way that fit context, eg copy a few excel row, paste them in whatsapp webapp and you have a picture, not text. As a tech user, you quickly learn to fall in love with "paste as raw text", which skips all that and just give you text data.
- rasz 4y agoYou would think that, but try injecting 5K rows table into html document. My experience in Chrome and modern 4GHz CPU: '6K rows, 300ms to insert into page on paper (console.time(1); console.timeEnd(1)), but in reality browser freezes for 3 seconds (1.8s style, 900ms layout, 300ms update tree). Freezing goes away with position: absolute, but it still takes 3 seconds to show up after .appendChild. I tried replacing Table with Flex divs, even worse speed.' I imagine I could make Chrome hang for more than 30 seconds with plain old HTML Tables :)
- jayd16 4y agotl;dr: Yes, but its measured in seconds. wild.
- sprremix 4y ago> This is known as clipboard delay-rendering Aha, so that's why Word[1] just explicitly asked me if I want to save the current copied image before quitting. It's probably asking before loading something big into memory?. [1] https://i.imgur.com/sNfE3Be.png https://i.imgur.com/sNfE3Be.png
- bobbylarrybobby 4y agoYep, Excel does something similar where it asks you "you have a large selection copied [(marching ants)], do you want to keep it available after closing Excel?"
- dylan604 4y agowow, that's a big selection. after all, it's just text, right? or am i selling it short? I understand when Adobe notifies that the clipboard is large since it's rasterized (typically) image data. what in the world is in the buffer for Excel that size is pushing limts?
- bobbylarrybobby 4y agoA lot of the time it's not just text, but rich text. For instance I'm pretty sure the font is preserved if you paste into a font-aware app.
- dylan604 4y agookay, but I have way more RAM than even the largest of font's I have encountered (and I've seen a few). also, what an absolute bozo way of doing things to include the font rather than the path to the font
- ookgfyhfg 4y agoThe Rich Text Format specifies the font of each word, etc. That is what the GP meant. I don't think there is any implication that font files are being included with the data.
- adenverd 4y agoSide note/feel good moment: the author Raymond Chen is an OG beyond-super-engineer at Microsoft, and is an incredible person to work with. He assisted me with my intern project many years ago, and was amazingly eager to share his wealth of experience with a green-eared intern from outside his org. Thanks Raymond! I decided to go the startup route instead of returning to MSFT, but you were an inspiration all the same.
- hoseja 4y agoHis "people send us dumb vulnerability reports" series seems quite arrogant to me, with new severe hole being found in Windows every other week.
- deleted 4y ago[deleted]
- SquareWheel 4y agoFollow up post: "How can I wait more than 30 seconds for a delay-rendered clipboard format to become rendered?" https://devblogs.microsoft.com/oldnewthing/20220609-00/?p=106731 https://devblogs.microsoft.com/oldnewthing/20220609-00/?p=10...