Police stations and local security offices reported problems on social media, while university students reported being locked out of final thesis papers. Electronic payment systems at gas stations run by the state oil giant PetroChina were cut off for much of the weekend. Over all, according to the official state television broadcaster, about 40,000 institutions were hit. Separately, the Chinese security company Qihoo 360 reported that computers at more than 29,000 organizations had been infected.

At China Telecom, one of the country’s three main state-run telecommunications providers, a similar scramble occurred over the weekend, according to an employee who was not authorized to speak on the matter. When a company-provided software patch did not work, the employee was told to use one from Qihoo 360, which supports pirated and out-of-date versions of Windows, the person said. A spokesman for China Telecom did not immediately respond to a request for comment.

On Monday, the main internet regulator, the Cyberspace Administration of China, quoted an unidentified person in charge of internet security saying that the ransomware was still spreading but the speed of transmission had slowed. It said that regulators overseeing banks, schools, the police and other groups had given orders to stop the risk and that it had instructed users on how to avoid exposure.

Using copied software and other media has become embedded in China’s computing culture, said Thomas Parenty, founder of Archefact Group, which advises companies on cybersecurity. Some people are under the impression that using pirated goods in China is legal, while others are simply not used to paying for software, he said.

Mr. Parenty cited an instance when he was working at the Beijing office of an American client. “It turned out every single one of their computers, all the software, was bootlegged,” he said.

The twin problems of malware and the unwillingness to pay for software are so ingrained that they have led to an alternative type of security company in China. Qihoo 360 built its business by offering free security programs; it makes money from advertising.